Fix headless compilation and do some formatting

This commit is contained in:
Agent X 2024-06-30 20:55:47 -04:00
parent 1bde63d3d8
commit fe114133ff
13 changed files with 68 additions and 70 deletions

View File

@ -753,6 +753,12 @@ else ifeq ($(findstring SDL,$(WINDOW_API)),SDL)
endif
endif
ifeq ($(WINDOW_API),DUMMY)
ifeq ($(WINDOWS_BUILD),1)
BACKEND_LDFLAGS += -lole32 -luuid -lshlwapi
endif
endif
ifneq (,$(findstring SDL2,$(AUDIO_API)$(WINDOW_API)$(CONTROLLER_API)))
SDL2_USED := 1
endif

View File

@ -41,11 +41,11 @@ const Gfx burn_smoke_seg4_dl_04022048[] = {
// 0x04022070 - 0x040220C8
const Gfx burn_smoke_seg4_dl_04022070[] = {
gsSPDisplayList(burn_smoke_seg4_dl_04022000),
#ifdef TEXTURE_FIX
#ifdef TEXTURE_FIX
gsDPLoadTextureBlock(burn_smoke_seg4_texture_04021800, G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
#else
#else
gsDPLoadTextureBlock(burn_smoke_seg4_texture_04021800, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
#endif
#endif
gsSPDisplayList(burn_smoke_seg4_dl_04022028),
gsSPDisplayList(burn_smoke_seg4_dl_04022048),
gsSPEndDisplayList(),

View File

@ -1036,13 +1036,13 @@ const Gfx koopa_seg6_dl_0600C498[] = {
gsSPVertex(koopa_seg6_vertex_0600B560, 9, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP1Triangle( 6, 7, 8, 0x0),
#ifdef TEXTURE_FIX
#ifdef TEXTURE_FIX
gsSPLight(&koopa_seg6_lights_06002630.l, 1),
gsSPLight(&koopa_seg6_lights_06002630.a, 2),
#else
#else
gsSPLight((u8*)koopa_seg6_texture_06002648 + 0x20, 1), //! this malformed light results in a
gsSPLight((u8*)koopa_seg6_texture_06002648 + 0x18, 2), //! koopa appearing to wear pink shorts.
#endif
#endif
gsSPVertex(koopa_seg6_vertex_0600B5F0, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 6, 7, 0, 0x0, 8, 5, 9, 0x0),

View File

@ -290,18 +290,18 @@ static void newcam_rotate_button(void) {
if ((newcam_modeflags & NC_FLAG_8D || newcam_modeflags & NC_FLAG_4D) && newcam_modeflags & NC_FLAG_XTURN) {
//8 directional camera rotation input for buttons.
if ((gPlayer1Controller->buttonPressed & L_CBUTTONS) && newcam_analogue == 0) {
#ifndef nosound
#ifndef nosound
play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
#endif
#endif
if (newcam_modeflags & NC_FLAG_8D)
newcam_yaw_target = newcam_yaw_target+(ivrt(0)*0x2000);
else
newcam_yaw_target = newcam_yaw_target+(ivrt(0)*0x4000);
newcam_centering = 1;
} else if ((gPlayer1Controller->buttonPressed & R_CBUTTONS) && newcam_analogue == 0) {
#ifndef nosound
#ifndef nosound
play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
#endif
#endif
if (newcam_modeflags & NC_FLAG_8D)
newcam_yaw_target = newcam_yaw_target-(ivrt(0)*0x2000);
else
@ -315,11 +315,11 @@ static void newcam_rotate_button(void) {
} else if ((gPlayer1Controller->buttonDown & R_CBUTTONS) && newcam_analogue == 0) {
newcam_yaw_acc = newcam_adjust_value(newcam_yaw_acc, accel, 100);
} else if (!newcam_analogue) {
#ifdef noaccel
#ifdef noaccel
newcam_yaw_acc = 0;
#else
#else
newcam_yaw_acc -= (newcam_yaw_acc*((f32)newcam_degrade/100));
#endif
#endif
}
}
@ -328,11 +328,11 @@ static void newcam_rotate_button(void) {
} else if (gPlayer1Controller->buttonDown & D_CBUTTONS && newcam_modeflags & NC_FLAG_YTURN && newcam_analogue == 0) {
newcam_tilt_acc = newcam_adjust_value(newcam_tilt_acc, -accel, -100);
} else if (!newcam_analogue) {
#ifdef noaccel
#ifdef noaccel
newcam_tilt_acc = 0;
#else
#else
newcam_tilt_acc -= (newcam_tilt_acc*((f32)newcam_degrade/100));
#endif
#endif
}
newcam_framessincec[0] ++;
@ -341,9 +341,9 @@ static void newcam_rotate_button(void) {
if (newcam_framessincec[0] < 6) {
newcam_yaw_target = newcam_yaw+(ivrt(0)*0x3000);
newcam_centering = 1;
#ifndef nosound
#ifndef nosound
play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
#endif
#endif
}
newcam_framessincec[0] = 0;
}
@ -351,9 +351,9 @@ static void newcam_rotate_button(void) {
if (newcam_framessincec[1] < 6) {
newcam_yaw_target = newcam_yaw-(ivrt(0)*0x3000);
newcam_centering = 1;
#ifndef nosound
#ifndef nosound
play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
#endif
#endif
}
newcam_framessincec[1] = 0;
}
@ -370,9 +370,9 @@ static void newcam_rotate_button(void) {
if (newcam_cstick_down == 0) {
newcam_cstick_down = 1;
newcam_centering = 1;
#ifndef nosound
#ifndef nosound
play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
#endif
#endif
if (newcam_stick2[0] > 20) {
if (newcam_modeflags & NC_FLAG_8D)
newcam_yaw_target = newcam_yaw_target+(ivrt(0)*0x2000);
@ -424,9 +424,9 @@ static void newcam_zoom_button(void) {
newcam_centering = 1;
} else if (gPlayer1Controller->buttonPressed & R_TRIG && newcam_modeflags & NC_FLAG_XTURN) {
//Each time the player presses R, but NOT L the camera zooms out more, until it hits the limit and resets back to close view.
#ifndef nosound
#ifndef nosound
play_sound(SOUND_MENU_CLICK_CHANGE_VIEW, gGlobalSoundSource);
#endif
#endif
if (newcam_distance_target == newcam_distance_values[0])
newcam_distance_target = newcam_distance_values[1];
@ -796,7 +796,7 @@ void newcam_loop(struct Camera *c) {
newcam_fade_target_closeup();
//Just some visual information on the values of the camera. utilises ifdef because it's better at runtime.
#ifdef NEWCAM_DEBUG
#ifdef NEWCAM_DEBUG
newcam_diagnostics();
#endif // NEWCAM_DEBUG
#endif // NEWCAM_DEBUG
}

View File

@ -2107,15 +2107,15 @@ void render_dialog_entries(void) {
if (gLastDialogPageStrPos == -1 && gLastDialogResponse == 1) {
render_dialog_triangle_choice();
}
#ifdef VERSION_EU
#undef BORDER_HEIGHT
#define BORDER_HEIGHT 8
#endif
#ifdef VERSION_EU
#undef BORDER_HEIGHT
#define BORDER_HEIGHT 8
#endif
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 2, 2, SCREEN_WIDTH - BORDER_HEIGHT/2, SCREEN_HEIGHT - BORDER_HEIGHT/2);
#ifdef VERSION_EU
#undef BORDER_HEIGHT
#define BORDER_HEIGHT 1
#endif
#ifdef VERSION_EU
#undef BORDER_HEIGHT
#define BORDER_HEIGHT 1
#endif
if (gLastDialogPageStrPos != -1 && gDialogBoxState == DIALOG_STATE_VERTICAL) {
render_dialog_string_color(dialog->linesPerBox);
}

View File

@ -2064,9 +2064,9 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) {
play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED);
#else
play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED);
#ifndef VERSION_JP
#ifndef VERSION_JP
play_sound_if_no_flag(m, SOUND_ACTION_HIT_3, MARIO_ACTION_SOUND_PLAYED);
#endif
#endif
#endif
set_character_animation(m, CHAR_ANIM_SINGLE_JUMP);

View File

@ -2542,13 +2542,13 @@ void print_sound_mode_menu_strings(void) {
} else {
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, sTextBaseAlpha);
}
#ifndef VERSION_JP
#ifndef VERSION_JP
// Mode names are centered correctly on US and Shindou
textX = get_str_x_pos_from_center(mode * 74 + 87, textSoundModes[mode], 10.0f);
print_generic_string(textX, 87, textSoundModes[mode]);
#else
#else
print_generic_string(mode * 74 + 67, 87, textSoundModes[mode]);
#endif
#endif
}
#endif

View File

@ -13,9 +13,9 @@
// moved these from sdl controller implementations
static struct ControllerAPI *controller_implementations[] = {
#if defined(CAPI_SDL2) || defined(CAPI_SDL1)
#if defined(CAPI_SDL2) || defined(CAPI_SDL1)
&controller_sdl,
#endif
#endif
&controller_keyboard,
};

View File

@ -1,16 +1,14 @@
#include "controller_mouse.h"
#ifdef WAPI_DXGI
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
extern HWND gfx_dxgi_get_h_wnd(void);
static bool mouse_relative_prev_cursor_state;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
extern HWND gfx_dxgi_get_h_wnd(void);
static bool mouse_relative_prev_cursor_state;
#elif defined(CAPI_SDL1)
#include <SDL/SDL.h>
#include <SDL/SDL.h>
#elif defined(CAPI_SDL2)
#include <SDL2/SDL.h>
#include <SDL2/SDL.h>
#endif
bool mouse_init_ok;
@ -39,10 +37,8 @@ void controller_mouse_read_window(void) {
mouse_window_x = p.x;
mouse_window_y = p.y;
}
#elif defined(CAPI_SDL1) || defined(CAPI_SDL2)
mouse_window_buttons = SDL_GetMouseState(&mouse_window_x, &mouse_window_y);
#endif
}
@ -81,7 +77,7 @@ void controller_mouse_enter_relative(void) {
if (!mouse_relative_enabled) {
mouse_relative_enabled = true;
#if defined(WAPI_DXGI)
#if defined(WAPI_DXGI)
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if (GetCursorInfo(&ci)) {
@ -91,14 +87,11 @@ void controller_mouse_enter_relative(void) {
}
ShowCursor(FALSE);
#elif defined(CAPI_SDL1)
#elif defined(CAPI_SDL1)
SDL_WM_GrabInput(SDL_GRAB_ON);
#elif defined(CAPI_SDL2)
#elif defined(CAPI_SDL2)
SDL_SetRelativeMouseMode(SDL_TRUE);
#endif
#endif
}
}
@ -106,16 +99,13 @@ void controller_mouse_leave_relative(void) {
if (mouse_relative_enabled) {
mouse_relative_enabled = false;
#if defined(WAPI_DXGI)
#if defined(WAPI_DXGI)
ShowCursor(mouse_relative_prev_cursor_state);
#elif defined(CAPI_SDL1)
#elif defined(CAPI_SDL1)
SDL_WM_GrabInput(SDL_GRAB_OFF);
#elif defined(CAPI_SDL2)
#elif defined(CAPI_SDL2)
SDL_SetRelativeMouseMode(SDL_FALSE);
#endif
#endif
}
}

View File

@ -1,3 +1,4 @@
#include <ctype.h>
#include "djui.h"
#include "djui_panel.h"
#include "djui_panel_menu.h"

View File

@ -130,11 +130,11 @@ static void gfx_sdl_init(const char *window_title) {
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#ifdef USE_GLES
#ifdef USE_GLES
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); // These attributes allow for hardware acceleration on RPis.
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif
#endif
int xpos = (configWindow.x == WAPI_WIN_CENTERPOS) ? SDL_WINDOWPOS_CENTERED : configWindow.x;
int ypos = (configWindow.y == WAPI_WIN_CENTERPOS) ? SDL_WINDOWPOS_CENTERED : configWindow.y;

View File

@ -1,3 +1,4 @@
#include <inttypes.h>
#include "sm64.h"
#include "types.h"

View File

@ -6,9 +6,9 @@
#include <ctype.h>
#ifdef _WIN32
#include <windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#endif
#include "cliopts.h"