Xbox: Fix singleplayer mode not rendering properly

This commit is contained in:
UnknownShadow200 2024-04-29 21:13:37 +10:00
parent 908077203e
commit ddf842c86d
6 changed files with 27 additions and 13 deletions

6
.gitignore vendored
View file

@ -38,6 +38,12 @@ build-saturn/
cd/
# Microsoft console build results
build-360/
main.exe
main.lib
misc/xbox/ps_coloured.inl
misc/xbox/ps_textured.inl
misc/xbox/vs_coloured.inl
misc/xbox/vs_textured.inl
# Sony console build results
build-ps2/
build-ps3/

View file

@ -536,8 +536,8 @@ void Gfx_CalcPerspectiveMatrix(struct Matrix* matrix, float fov, float aspect, f
void Gfx_OnWindowResize(void) { }
static struct Vec4 vp_offset = { 320, -240, 8388608, 1 };
static struct Vec4 vp_scale = { 320, 240, 8388608, 1 };
static struct Vec4 vp_scale = { 320, -240, 8388608, 1 };
static struct Vec4 vp_offset = { 320, 240, 8388608, 1 };
static struct Matrix _view, _proj, _mvp;
static void UpdateVSConstants(void) {

View file

@ -108,16 +108,15 @@ static bool fat_available;
static void GetNativePath(char* str, const cc_string* path) {
Mem_Copy(str, root_path.buffer, root_path.length);
str += root_path.length;
str += root_path.length;
String_EncodeUtf8(str, path);
Platform_Log1("Open %c", str - root_path.length);
}
cc_result Directory_Create(const cc_string* path) {
if (!fat_available) return ENOTSUP;
char str[NATIVE_STR_LEN];
GetNativePath(str, path);
Platform_Log1("mkdir %c", str);
return mkdir(str, 0) == -1 ? errno : 0;
}
@ -127,6 +126,8 @@ int File_Exists(const cc_string* path) {
char str[NATIVE_STR_LEN];
struct stat sb;
GetNativePath(str, path);
Platform_Log1("Check %c", str);
return stat(str, &sb) == 0 && S_ISREG(sb.st_mode);
}
@ -137,6 +138,8 @@ cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCall
static cc_result File_Do(cc_file* file, const cc_string* path, int mode) {
char str[NATIVE_STR_LEN];
GetNativePath(str, path);
Platform_Log1("Open %c", str);
*file = open(str, mode, 0);
return *file == -1 ? errno : 0;
}
@ -187,6 +190,12 @@ cc_result File_Length(cc_file file, cc_uint32* len) {
}
static void InitFilesystem(cc_bool dsiMode) {
char* dir = fatGetDefaultCwd();
if (dir && dir[0]) {
root_path.buffer = dir;
root_path.length = String_Length(dir);
}
// I don't know why I have to call this function, but if I don't,
// then when running in DSi mode AND an SD card is readable,
// fatInitDefault gets stuck somewhere (in disk_initialize it seems)
@ -197,13 +206,6 @@ static void InitFilesystem(cc_bool dsiMode) {
fat_available = fatInitDefault();
Platform_ReadonlyFilesystem = !fat_available;
if (!fat_available) return;
char* dir = fatGetDefaultCwd();
if (dir && dir[0]) {
root_path.buffer = dir;
root_path.length = String_Length(dir);
}
}

View file

@ -68,6 +68,8 @@ static void consoleNewLine(void) {
}
static void consolePrintChar(char c) {
if (c < ' ') return; // only ASCII supported
if (conCursorX >= CON_WIDTH)
consoleNewLine();

View file

@ -110,6 +110,8 @@ static void HandleButtons(int port, int buttons) {
Gamepad_SetButton(port, CCPAD_START, buttons & PAD_START);
Gamepad_SetButton(port, CCPAD_SELECT, buttons & PAD_SELECT);
Gamepad_SetButton(port, CCPAD_LSTICK, buttons & PAD_L3);
Gamepad_SetButton(port, CCPAD_RSTICK, buttons & PAD_L3);
Gamepad_SetButton(port, CCPAD_LEFT, buttons & PAD_LEFT);
Gamepad_SetButton(port, CCPAD_RIGHT, buttons & PAD_RIGHT);

View file

@ -276,6 +276,8 @@ static void HandleButtons(int port, padData* data) {
Gamepad_SetButton(port, CCPAD_START, data->BTN_START);
Gamepad_SetButton(port, CCPAD_SELECT, data->BTN_SELECT);
Gamepad_SetButton(port, CCPAD_LSTICK, data->BTN_L3);
Gamepad_SetButton(port, CCPAD_RSTICK, data->BTN_R3);
Gamepad_SetButton(port, CCPAD_LEFT, data->BTN_LEFT);
Gamepad_SetButton(port, CCPAD_RIGHT, data->BTN_RIGHT);