diff --git a/data/dynos.c.h b/data/dynos.c.h index 7bbb015ca..e63c1cd60 100644 --- a/data/dynos.c.h +++ b/data/dynos.c.h @@ -17,7 +17,7 @@ s32 dynos_tex_import(void **output, void *ptr, s32 tile, void *grapi, void **h void dynos_gfx_swap_animations(void *ptr); // -- warps -- // -LevelScript* dynos_get_level_script(char* scriptEntryName); +LevelScript* dynos_get_level_script(const char* scriptEntryName); bool dynos_warp_to_warpnode(s32 aLevel, s32 aArea, s32 aAct, s32 aWarpId); bool dynos_warp_to_level(s32 aLevel, s32 aArea, s32 aAct); bool dynos_warp_restart_level(void); diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index af532bd4a..b07ea6b5b 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -937,7 +937,7 @@ void DynOS_Tex_ModShutdown(); // Array> &DynOS_Lvl_GetArray(); -LevelScript* DynOS_Lvl_GetScript(char* aScriptEntryName); +LevelScript* DynOS_Lvl_GetScript(const char* aScriptEntryName); void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilePath, const char *aLevelName); GfxData* DynOS_Lvl_GetActiveGfx(void); const char* DynOS_Lvl_GetToken(u32 index); diff --git a/data/dynos_c.cpp b/data/dynos_c.cpp index c223b033a..3d3da3f2e 100644 --- a/data/dynos_c.cpp +++ b/data/dynos_c.cpp @@ -32,7 +32,7 @@ void dynos_gfx_swap_animations(void *ptr) { // -- warps -- // -LevelScript* dynos_get_level_script(char* scriptEntryName) { +LevelScript* dynos_get_level_script(const char* scriptEntryName) { return DynOS_Lvl_GetScript(scriptEntryName); } diff --git a/data/dynos_mgr_lvl.cpp b/data/dynos_mgr_lvl.cpp index 3345c6f1f..c9a111131 100644 --- a/data/dynos_mgr_lvl.cpp +++ b/data/dynos_mgr_lvl.cpp @@ -21,7 +21,7 @@ Array> &DynOS_Lvl_GetArray() { return sDynosCustomLevelScripts; } -LevelScript* DynOS_Lvl_GetScript(char* aScriptEntryName) { +LevelScript* DynOS_Lvl_GetScript(const char* aScriptEntryName) { auto& _CustomLevelScripts = DynOS_Lvl_GetArray(); for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) { auto& pair = _CustomLevelScripts[i]; diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index df4f501f6..baba53301 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -8690,7 +8690,7 @@ - `string` ### C Prototype -`char* network_get_player_text_color_string(u8 localIndex);` +`const char* network_get_player_text_color_string(u8 localIndex);` [:arrow_up_small:](#) diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 989dc0264..467ced20c 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -7558,7 +7558,7 @@ [CustomLevelInfo](structs.md#CustomLevelInfo) ### C Prototype -`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName);` +`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName);` [:arrow_up_small:](#) diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 7761d85b8..539b170a1 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -904,7 +904,7 @@ - `string` ### C Prototype -`char* get_os_name(void);` +`const char* get_os_name(void);` [:arrow_up_small:](#) @@ -2413,7 +2413,7 @@ - `string` ### C Prototype -`char* smlua_text_utils_get_language(void);` +`const char* smlua_text_utils_get_language(void);` [:arrow_up_small:](#) diff --git a/src/bass_audio/bass_audio_helpers.c b/src/bass_audio/bass_audio_helpers.c index bcd16d4b6..76acb52af 100644 --- a/src/bass_audio/bass_audio_helpers.c +++ b/src/bass_audio/bass_audio_helpers.c @@ -4,7 +4,7 @@ #include "bass_audio_helpers.h" -HSTREAM bassh_create_fx_stream_from_file(char* data, QWORD length, QWORD offset) { +HSTREAM bassh_create_fx_stream_from_file(const char* data, QWORD length, QWORD offset) { HSTREAM raw_stream = BASS_StreamCreateFile(TRUE, data, offset, length, BASS_STREAM_PRESCAN | BASS_STREAM_DECODE); HSTREAM stream = BASS_FX_TempoCreate(raw_stream, BASS_STREAM_PRESCAN); @@ -12,7 +12,7 @@ HSTREAM bassh_create_fx_stream_from_file(char* data, QWORD length, QWORD offset) return stream; } -HSAMPLE bassh_create_sample_from_file(char* data, QWORD length, QWORD offset) { +HSAMPLE bassh_create_sample_from_file(const char* data, QWORD length, QWORD offset) { return BASS_SampleLoad(TRUE, data, offset, length, MAX_SAMPLE_CONCURRENT_PLAYBACKS, BASS_SAMPLE_OVER_POS); } diff --git a/src/bass_audio/bass_audio_helpers.h b/src/bass_audio/bass_audio_helpers.h index 9dee7a253..eb730e23b 100644 --- a/src/bass_audio/bass_audio_helpers.h +++ b/src/bass_audio/bass_audio_helpers.h @@ -2,8 +2,8 @@ #define MAX_SAMPLE_CONCURRENT_PLAYBACKS 32 -HSTREAM bassh_create_fx_stream_from_file(char* data, QWORD length, QWORD offset); -HSAMPLE bassh_create_sample_from_file(char* data, QWORD length, QWORD offset); +HSTREAM bassh_create_fx_stream_from_file(const char* data, QWORD length, QWORD offset); +HSAMPLE bassh_create_sample_from_file(const char* data, QWORD length, QWORD offset); HSTREAM bassh_sample_get_stream(HSAMPLE sample); void bassh_free_sample(HSAMPLE sample); diff --git a/src/pc/crash_handler.c b/src/pc/crash_handler.c index b7fc8ae6b..5e431c061 100644 --- a/src/pc/crash_handler.c +++ b/src/pc/crash_handler.c @@ -280,7 +280,7 @@ static void crash_handler_produce_one_frame() { gfx_end_frame(); } -static void crash_handler_add_info_str(CrashHandlerText** pTextP, f32 x, f32 y, char* title, char* value) { +static void crash_handler_add_info_str(CrashHandlerText** pTextP, f32 x, f32 y, const char* title, const char* value) { CrashHandlerText* pText = *pTextP; crash_handler_set_text(x, y, 0xFF, 0xFF, 0x00, "%s", title); crash_handler_set_text(-1, y, 0xFF, 0xFF, 0xFF, "%s", ": "); @@ -288,7 +288,7 @@ static void crash_handler_add_info_str(CrashHandlerText** pTextP, f32 x, f32 y, *pTextP = pText; } -static void crash_handler_add_info_int(CrashHandlerText** pTextP, f32 x, f32 y, char* title, int value) { +static void crash_handler_add_info_int(CrashHandlerText** pTextP, f32 x, f32 y, const char* title, int value) { CrashHandlerText* pText = *pTextP; crash_handler_set_text(x, y, 0xFF, 0xFF, 0x00, "%s", title); crash_handler_set_text(-1, y, 0xFF, 0xFF, 0xFF, "%s", ": "); diff --git a/src/pc/discord/discord_activity.c b/src/pc/discord/discord_activity.c index e25f9d89e..bcac8025f 100644 --- a/src/pc/discord/discord_activity.c +++ b/src/pc/discord/discord_activity.c @@ -67,7 +67,7 @@ static void strncat_len(char* destination, char* source, size_t destinationLengt static void discord_populate_details(char* buffer, int bufferLength) { // get version - char* version = get_version(); + const char* version = get_version(); int versionLength = strlen(version); snprintf(buffer, bufferLength, "%s", version); buffer += versionLength; diff --git a/src/pc/djui/djui_chat_message.c b/src/pc/djui/djui_chat_message.c index 90f411e75..f7b04a8da 100644 --- a/src/pc/djui/djui_chat_message.c +++ b/src/pc/djui/djui_chat_message.c @@ -58,7 +58,7 @@ void djui_chat_message_create_from(u8 globalIndex, const char* message) { return; } - char* playerColorString = network_get_player_text_color_string(np->localIndex); + const char* playerColorString = network_get_player_text_color_string(np->localIndex); char chatMsg[256] = { 0 }; snprintf(chatMsg, 256, "%s%s:\\#dcdcdc\\ %s", playerColorString, (np != NULL) ? np->name : "Player", message); diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index fd84b1d3f..2fe18d7bb 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -34,7 +34,7 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_button_create(body, DLANG(MAIN, QUIT), DJUI_BUTTON_STYLE_BACK, djui_panel_main_quit); } - char* version = get_version_local(); + const char* version = get_version_local(); struct DjuiText* footer = djui_text_create(&panel->base, version); djui_base_set_size_type(&footer->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&footer->base, 1.0f, 1.0f); diff --git a/src/pc/gfx/gfx_cc.c b/src/pc/gfx/gfx_cc.c index a67ffec00..ea14c06cc 100644 --- a/src/pc/gfx/gfx_cc.c +++ b/src/pc/gfx/gfx_cc.c @@ -54,7 +54,7 @@ void gfx_cc_get_features(struct ColorCombiner* cc, struct CCFeatures* ccf) { } } -void gfx_cc_print(struct ColorCombiner *cc) { +void gfx_cc_print(UNUSED struct ColorCombiner *cc) { if (!sAllowCCPrint) { return; } // disabled for now return; diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c index 9181bd489..67f528680 100644 --- a/src/pc/lua/smlua.c +++ b/src/pc/lua/smlua.c @@ -47,7 +47,7 @@ int smlua_pcall(lua_State* L, int nargs, int nresults, UNUSED int errfunc) { return rc; } -void smlua_exec_file(char* path) { +void smlua_exec_file(const char* path) { lua_State* L = gLuaState; if (luaL_dofile(L, path) != LUA_OK) { LOG_LUA("Failed to load lua file '%s'.", path); @@ -56,7 +56,7 @@ void smlua_exec_file(char* path) { lua_pop(L, lua_gettop(L)); } -void smlua_exec_str(char* str) { +void smlua_exec_str(const char* str) { lua_State* L = gLuaState; if (luaL_dostring(L, str) != LUA_OK) { LOG_LUA("Failed to load lua string."); diff --git a/src/pc/lua/smlua.h b/src/pc/lua/smlua.h index 1293c2332..a4d81447c 100644 --- a/src/pc/lua/smlua.h +++ b/src/pc/lua/smlua.h @@ -41,8 +41,8 @@ extern struct Mod* gLuaLastHookMod; void smlua_mod_error(void); int smlua_error_handler(UNUSED lua_State* L); int smlua_pcall(lua_State* L, int nargs, int nresults, int errfunc); -void smlua_exec_file(char* path); -void smlua_exec_str(char* str); +void smlua_exec_file(const char* path); +void smlua_exec_str(const char* str); void smlua_init(void); void smlua_update(void); diff --git a/src/pc/lua/smlua_cobject.c b/src/pc/lua/smlua_cobject.c index f7086d692..0a59a4c04 100644 --- a/src/pc/lua/smlua_cobject.c +++ b/src/pc/lua/smlua_cobject.c @@ -643,7 +643,7 @@ void smlua_cobject_init_globals(void) { } } -void smlua_cobject_init_per_file_globals(char* path) { +void smlua_cobject_init_per_file_globals(const char* path) { lua_State* L = gLuaState; lua_getfield(L, LUA_REGISTRYINDEX, path); // push per-file globals diff --git a/src/pc/lua/smlua_cobject.h b/src/pc/lua/smlua_cobject.h index 865cf3fce..f0a3381c5 100644 --- a/src/pc/lua/smlua_cobject.h +++ b/src/pc/lua/smlua_cobject.h @@ -71,7 +71,7 @@ struct LuaObjectField* smlua_get_object_field_from_ot(struct LuaObjectTable* ot, struct LuaObjectField* smlua_get_object_field(u16 lot, const char* key); struct LuaObjectField* smlua_get_custom_field(lua_State* L, u32 lot, int keyIndex); void smlua_cobject_init_globals(void); -void smlua_cobject_init_per_file_globals(char* path); +void smlua_cobject_init_per_file_globals(const char* path); void smlua_bind_cobject(void); #endif \ No newline at end of file diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index e75b7ab37..a97eaa5f1 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -27451,7 +27451,7 @@ int smlua_func_smlua_level_util_get_info_from_short_name(lua_State* L) { return 0; } - char* shortName = (char*)smlua_to_cobject(L, 1, LOT_NONE); + const char* shortName = smlua_to_string(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_short_name"); return 0; } smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName)); diff --git a/src/pc/lua/smlua_sync_table.c b/src/pc/lua/smlua_sync_table.c index c01a4dcdf..07f29a5e3 100644 --- a/src/pc/lua/smlua_sync_table.c +++ b/src/pc/lua/smlua_sync_table.c @@ -429,7 +429,7 @@ void smlua_set_sync_table_field_from_network(u64 seq, u16 modRemoteIndex, u16 ln LUA_STACK_CHECK_END(); } -void smlua_sync_table_init_globals(char* path, u16 modRemoteIndex) { +void smlua_sync_table_init_globals(const char* path, u16 modRemoteIndex) { LUA_STACK_CHECK_BEGIN(); lua_State* L = gLuaState; diff --git a/src/pc/lua/smlua_sync_table.h b/src/pc/lua/smlua_sync_table.h index b6fdaaa17..49a1c8751 100644 --- a/src/pc/lua/smlua_sync_table.h +++ b/src/pc/lua/smlua_sync_table.h @@ -11,7 +11,7 @@ enum LuaSyncTableType { struct LSTNetworkType; void smlua_set_sync_table_field_from_network(u64 seq, u16 modRemoteIndex, u16 lntKeyCount, struct LSTNetworkType* lntKeys, struct LSTNetworkType* lntValue); -void smlua_sync_table_init_globals(char* path, u16 remoteIndex); +void smlua_sync_table_init_globals(const char* path, u16 remoteIndex); void smlua_bind_sync_table(void); void smlua_sync_table_send_all(u8 toLocalIndex); diff --git a/src/pc/lua/smlua_utils.c b/src/pc/lua/smlua_utils.c index 3c4b26d6b..f4bf9cd38 100644 --- a/src/pc/lua/smlua_utils.c +++ b/src/pc/lua/smlua_utils.c @@ -447,27 +447,27 @@ void smlua_push_pointer(lua_State* L, u16 lvt, void* p) { } } -void smlua_push_integer_field(int index, char* name, lua_Integer val) { +void smlua_push_integer_field(int index, const char* name, lua_Integer val) { lua_pushinteger(gLuaState, val); lua_setfield(gLuaState, index, name); } -void smlua_push_number_field(int index, char* name, lua_Number val) { +void smlua_push_number_field(int index, const char* name, lua_Number val) { lua_pushnumber(gLuaState, val); lua_setfield(gLuaState, index, name); } -void smlua_push_string_field(int index, char* name, const char* val) { +void smlua_push_string_field(int index, const char* name, const char* val) { lua_pushstring(gLuaState, val); lua_setfield(gLuaState, index, name); } -void smlua_push_nil_field(int index, char* name) { +void smlua_push_nil_field(int index, const char* name) { lua_pushnil(gLuaState); lua_setfield(gLuaState, index, name); } -void smlua_push_table_field(int index, char* name) { +void smlua_push_table_field(int index, const char* name) { lua_newtable(gLuaState); lua_setfield(gLuaState, index, name); } @@ -498,7 +498,7 @@ void smlua_push_lnt(struct LSTNetworkType* lnt) { /////////////////////////////////////////////////////////////////////////////////////////// -lua_Integer smlua_get_integer_field(int index, char* name) { +lua_Integer smlua_get_integer_field(int index, const char* name) { if (lua_type(gLuaState, index) != LUA_TTABLE) { LOG_LUA_LINE("smlua_get_integer_field received improper type '%d'", lua_type(gLuaState, index)); gSmLuaConvertSuccess = false; @@ -510,7 +510,7 @@ lua_Integer smlua_get_integer_field(int index, char* name) { return val; } -lua_Number smlua_get_number_field(int index, char* name) { +lua_Number smlua_get_number_field(int index, const char* name) { if (lua_type(gLuaState, index) != LUA_TTABLE) { LOG_LUA_LINE("smlua_get_number_field received improper type '%d'", lua_type(gLuaState, index)); gSmLuaConvertSuccess = false; @@ -522,7 +522,7 @@ lua_Number smlua_get_number_field(int index, char* name) { return val; } -LuaFunction smlua_get_function_field(int index, char *name) { +LuaFunction smlua_get_function_field(int index, const char *name) { if (lua_type(gLuaState, index) != LUA_TTABLE) { LOG_LUA_LINE("smlua_get_function_field received improper type '%d'", lua_type(gLuaState, index)); gSmLuaConvertSuccess = false; @@ -645,7 +645,7 @@ LuaFunction smlua_get_any_function_mod_variable(const char *variable) { /////////////////////////////////////////////////////////////////////////////////////////// -char* smlua_lnt_to_str(struct LSTNetworkType* lnt) { +const char* smlua_lnt_to_str(struct LSTNetworkType* lnt) { static char sLntStr[32] = ""; switch (lnt->type) { case LST_NETWORK_TYPE_INTEGER: diff --git a/src/pc/lua/smlua_utils.h b/src/pc/lua/smlua_utils.h index 105d456dc..e8cfefee5 100644 --- a/src/pc/lua/smlua_utils.h +++ b/src/pc/lua/smlua_utils.h @@ -30,19 +30,19 @@ bool packet_read_lnt(struct Packet* p, struct LSTNetworkType* lnt); void smlua_push_object(lua_State* L, u16 lot, void* p); void smlua_push_pointer(lua_State* L, u16 lvt, void* p); -void smlua_push_integer_field(int index, char* name, lua_Integer val); -void smlua_push_number_field(int index, char* name, lua_Number val); -void smlua_push_string_field(int index, char* name, const char* val); -void smlua_push_nil_field(int index, char* name); -void smlua_push_table_field(int index, char* name); +void smlua_push_integer_field(int index, const char* name, lua_Integer val); +void smlua_push_number_field(int index, const char* name, lua_Number val); +void smlua_push_string_field(int index, const char* name, const char* val); +void smlua_push_nil_field(int index, const char* name); +void smlua_push_table_field(int index, const char* name); void smlua_push_lnt(struct LSTNetworkType* lnt); -lua_Integer smlua_get_integer_field(int index, char* name); -lua_Number smlua_get_number_field(int index, char* name); -LuaFunction smlua_get_function_field(int index, char *name); +lua_Integer smlua_get_integer_field(int index, const char* name); +lua_Number smlua_get_number_field(int index, const char* name); +LuaFunction smlua_get_function_field(int index, const char *name); -char* smlua_lnt_to_str(struct LSTNetworkType* lnt); +const char* smlua_lnt_to_str(struct LSTNetworkType* lnt); s64 smlua_get_integer_mod_variable(u16 modIndex, const char* variable); s64 smlua_get_any_integer_mod_variable(const char* variable); diff --git a/src/pc/lua/utils/smlua_level_utils.c b/src/pc/lua/utils/smlua_level_utils.c index 11988e342..4d1771c4c 100644 --- a/src/pc/lua/utils/smlua_level_utils.c +++ b/src/pc/lua/utils/smlua_level_utils.c @@ -42,7 +42,7 @@ struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum) { return NULL; } -struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName) { +struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName) { struct CustomLevelInfo* node = sCustomLevelHead; while (node != NULL) { if (!strcmp(node->shortName, shortName)) { diff --git a/src/pc/lua/utils/smlua_level_utils.h b/src/pc/lua/utils/smlua_level_utils.h index 31ce7f6ad..e7a24fa19 100644 --- a/src/pc/lua/utils/smlua_level_utils.h +++ b/src/pc/lua/utils/smlua_level_utils.h @@ -20,7 +20,7 @@ struct CustomLevelInfo { void smlua_level_util_reset(void); struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum); -struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName); +struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName); s16 level_register(const char* scriptEntryName, s16 courseNum, const char* fullName, const char* shortName, u32 acousticReach, u32 echoLevel1, u32 echoLevel2, u32 echoLevel3); bool level_is_vanilla_level(s16 levelNum); bool warp_to_warpnode(s32 aLevel, s32 aArea, s32 aAct, s32 aWarpId); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index de40e3f90..770d2a969 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -594,7 +594,7 @@ void set_override_envfx(s32 envfx) { /// -char* get_os_name(void) { +const char* get_os_name(void) { #if defined(_WIN32) || defined(_WIN64) return "Windows"; #elif __APPLE__ || __MACH__ diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index eb3f82912..9d475d42b 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -128,6 +128,6 @@ u32 get_time(void); u16 get_envfx(void); void set_override_envfx(s32 envfx); -char* get_os_name(void); +const char* get_os_name(void); #endif diff --git a/src/pc/lua/utils/smlua_text_utils.c b/src/pc/lua/utils/smlua_text_utils.c index 03868025a..b8f8407ca 100644 --- a/src/pc/lua/utils/smlua_text_utils.c +++ b/src/pc/lua/utils/smlua_text_utils.c @@ -261,6 +261,6 @@ void smlua_text_utils_extra_text_replace(s16 index, const char* text) { sReplacedActName[index] = true; } -char* smlua_text_utils_get_language(void) { +const char* smlua_text_utils_get_language(void) { return configLanguage; } \ No newline at end of file diff --git a/src/pc/lua/utils/smlua_text_utils.h b/src/pc/lua/utils/smlua_text_utils.h index 08f7beb7e..52d9d6928 100644 --- a/src/pc/lua/utils/smlua_text_utils.h +++ b/src/pc/lua/utils/smlua_text_utils.h @@ -10,6 +10,6 @@ void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName); void smlua_text_utils_castle_secret_stars_replace(const char* name); void smlua_text_utils_extra_text_replace(s16 index, const char* text); -char* smlua_text_utils_get_language(void); +const char* smlua_text_utils_get_language(void); #endif diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index 3daafb0cf..fe7ef865c 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -172,7 +172,7 @@ static void coopnet_populate_description(void) { char* buffer = sCoopNetDescription; int bufferLength = 256; // get version - char* version = get_version(); + const char* version = get_version(); int versionLength = strlen(version); snprintf(buffer, bufferLength, "%s", version); buffer += versionLength; diff --git a/src/pc/network/network_player.c b/src/pc/network/network_player.c index db74aa9ae..760a00619 100644 --- a/src/pc/network/network_player.c +++ b/src/pc/network/network_player.c @@ -216,7 +216,7 @@ void network_player_update(void) { } extern bool gCurrentlyJoining; -u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, const struct PlayerPalette* palette, char *name) { +u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, const struct PlayerPalette* palette, const char *name) { // translate globalIndex to localIndex u8 localIndex = globalIndex; if (gNetworkType == NT_SERVER) { diff --git a/src/pc/network/network_player.h b/src/pc/network/network_player.h index 111a8ed5f..92589f1ce 100644 --- a/src/pc/network/network_player.h +++ b/src/pc/network/network_player.h @@ -82,7 +82,7 @@ void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerParts void network_player_update(void); -u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, const struct PlayerPalette* playerPalette, char* name); +u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, const struct PlayerPalette* playerPalette, const char* name); u8 network_player_disconnected(u8 globalIndex); void construct_player_popup(struct NetworkPlayer* np, char* msg, const char* level); diff --git a/src/pc/network/network_utils.c b/src/pc/network/network_utils.c index 18b6b1ff5..a1e0dcda6 100644 --- a/src/pc/network/network_utils.c +++ b/src/pc/network/network_utils.c @@ -43,7 +43,7 @@ u8* network_get_player_text_color(u8 localIndex) { return sTextRgb; } -char* network_get_player_text_color_string(u8 localIndex) { +const char* network_get_player_text_color_string(u8 localIndex) { if (localIndex >= MAX_PLAYERS) { localIndex = 0; } u8* rgb = network_get_player_text_color(localIndex); static char sColorString[10] = { 0 }; diff --git a/src/pc/network/network_utils.h b/src/pc/network/network_utils.h index de7de04de..767308490 100644 --- a/src/pc/network/network_utils.h +++ b/src/pc/network/network_utils.h @@ -11,6 +11,6 @@ bool network_is_server(void); bool network_is_moderator(void); u8* network_get_player_text_color(u8 localIndex); -char* network_get_player_text_color_string(u8 localIndex); +const char* network_get_player_text_color_string(u8 localIndex); #endif \ No newline at end of file diff --git a/src/pc/network/version.c b/src/pc/network/version.c index 9b683b95a..627649091 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -5,7 +5,7 @@ static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; static char sLocalVersionString[MAX_LOCAL_VERSION_LENGTH] = { 0 }; -char* get_version(void) { +const char* get_version(void) { #if defined(VERSION_US) if (MINOR_VERSION_NUMBER > 0) { snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER); @@ -22,7 +22,7 @@ char* get_version(void) { return sVersionString; } -char* get_version_local(void) { +const char* get_version_local(void) { if (PATCH_VERSION_NUMBER <= 0) { return get_version(); } @@ -36,7 +36,7 @@ char* get_version_local(void) { return sLocalVersionString; } -char* get_game_name(void) { +const char* get_game_name(void) { #ifdef DEVELOPMENT return "sm64ex-coop-dev"; #elif !defined(VERSION_US) diff --git a/src/pc/network/version.h b/src/pc/network/version.h index 5e908ca3f..651b1e140 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -18,8 +18,8 @@ #define MAX_VERSION_LENGTH 32 #define MAX_LOCAL_VERSION_LENGTH 36 -char* get_version(void); -char* get_version_local(void); -char* get_game_name(void); +const char* get_version(void); +const char* get_version_local(void); +const char* get_game_name(void); #endif diff --git a/src/pc/os/os_win.c b/src/pc/os/os_win.c index cd7556300..37f65cdbe 100644 --- a/src/pc/os/os_win.c +++ b/src/pc/os/os_win.c @@ -5,13 +5,13 @@ #include "os_win.h" #include "pc/platform.h" -OS_DIR* os_opendir(char* path) { +OS_DIR* os_opendir(const char* path) { wchar_t wpath[SYS_MAX_PATH] = { 0 }; MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, SYS_MAX_PATH); return _wopendir(wpath); } -char* os_get_dir_name(os_dirent* dir) { +const char* os_get_dir_name(os_dirent* dir) { static char path[SYS_MAX_PATH] = { 0 }; snprintf(path, SYS_MAX_PATH, "%ls", dir->d_name); return path; diff --git a/src/pc/os/os_win.h b/src/pc/os/os_win.h index c3254b82b..a09558d76 100644 --- a/src/pc/os/os_win.h +++ b/src/pc/os/os_win.h @@ -9,5 +9,5 @@ #define os_closedir(_x) _wclosedir(_x) #define os_readdir(_x) _wreaddir(_x) -OS_DIR* os_opendir(char* path); -char* os_get_dir_name(os_dirent* dir); +OS_DIR* os_opendir(const char* path); +const char* os_get_dir_name(os_dirent* dir); diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 9cc9c0f73..da57d2277 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -349,7 +349,7 @@ void main_func(void) { #error No rendering API! #endif - char* version = get_version_local(); + const char* version = get_version_local(); char window_title[96] = { 0 }; #ifdef GIT_HASH snprintf(window_title, 96, "sm64ex-coop: %s [%s]", version, GIT_HASH); diff --git a/src/pc/utils/string_linked_list.c b/src/pc/utils/string_linked_list.c index b81dcf590..4f11f81c0 100644 --- a/src/pc/utils/string_linked_list.c +++ b/src/pc/utils/string_linked_list.c @@ -3,7 +3,7 @@ #include #include "string_linked_list.h" -void string_linked_list_append(struct StringLinkedList* node, char* string) { +void string_linked_list_append(struct StringLinkedList* node, const char* string) { int length = strlen(string); while (1) { if (node->string == NULL) { @@ -20,7 +20,7 @@ void string_linked_list_append(struct StringLinkedList* node, char* string) { } } -bool string_linked_list_contains(struct StringLinkedList* node, char* string) { +bool string_linked_list_contains(struct StringLinkedList* node, const char* string) { if (string == NULL) { return false; } diff --git a/src/pc/utils/string_linked_list.h b/src/pc/utils/string_linked_list.h index 30f3f4869..b72ca1376 100644 --- a/src/pc/utils/string_linked_list.h +++ b/src/pc/utils/string_linked_list.h @@ -6,8 +6,8 @@ struct StringLinkedList { struct StringLinkedList* next; }; -void string_linked_list_append(struct StringLinkedList* node, char* string); -bool string_linked_list_contains(struct StringLinkedList* node, char* string); +void string_linked_list_append(struct StringLinkedList* node, const char* string); +bool string_linked_list_contains(struct StringLinkedList* node, const char* string); bool string_linked_list_mismatch(struct StringLinkedList* a, struct StringLinkedList* b); int string_linked_list_count(struct StringLinkedList* node); void string_linked_list_free(struct StringLinkedList* node);