Skip to content

Commit

Permalink
Xbox: Fix singleplayer mode not rendering properly
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Apr 29, 2024
1 parent 9080772 commit ddf842c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions src/Graphics_Xbox.c
Expand Up @@ -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) {
Expand Down
24 changes: 13 additions & 11 deletions src/Platform_NDS.c
Expand Up @@ -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;
}

Expand All @@ -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);
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}
}


Expand Down
2 changes: 2 additions & 0 deletions src/Window_NDS.c
Expand Up @@ -68,6 +68,8 @@ static void consoleNewLine(void) {
}

static void consolePrintChar(char c) {
if (c < ' ') return; // only ASCII supported

if (conCursorX >= CON_WIDTH)
consoleNewLine();

Expand Down
2 changes: 2 additions & 0 deletions src/Window_PS2.c
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/Window_PS3.c
Expand Up @@ -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);
Expand Down

0 comments on commit ddf842c

Please sign in to comment.