diff --git a/ld/libfiles.ntsc-final.inc b/ld/libfiles.ntsc-final.inc index fa10f15b4..c261423b7 100644 --- a/ld/libfiles.ntsc-final.inc +++ b/ld/libfiles.ntsc-final.inc @@ -38,7 +38,6 @@ build/ROMID/lib/memp.o (section); \ build/ROMID/lib/mema.o (section); \ build/ROMID/lib/rng.o (section); \ - build/ROMID/lib/args.o (section); \ build/ROMID/lib/str.o (section); \ build/ROMID/lib/ultra/libc/sprintf.o (section); \ build/ROMID/lib/pimgr.o (section); \ diff --git a/src/game/gfxmemory.c b/src/game/gfxmemory.c index 034e7cc46..e3a66be23 100644 --- a/src/game/gfxmemory.c +++ b/src/game/gfxmemory.c @@ -3,7 +3,6 @@ #include "game/gfxmemory.h" #include "game/stubs/game_175f50.h" #include "bss.h" -#include "lib/args.h" #include "lib/rzip.h" #include "lib/dma.h" #include "lib/memp.h" @@ -58,54 +57,35 @@ u32 g_VtxSizesByPlayerCount[] = { s32 g_GfxNumSwapsPerBuffer[2] = {0, 1}; u32 g_GfxNumSwaps = 0x00000002; -/** - * Allocate graphics memory from the heap. Presumably called on stage load. - * - * Comments in this function are strings that appear in an XBLA debug build. - * They were likely in the N64 version but ifdeffed out. - */ +extern s32 g_StageNum; +extern struct stageallocation g_StageAllocations8Mb[]; + void gfxReset(void) { - s32 stack; + s32 index = 0; + s32 gfx; - if (argFindByPrefix(1, "-mgfx")) { - // Argument specified master_dl_size\n - s32 gfx; - s32 gfxtra = 0; - - gfx = strtol(argFindByPrefix(1, "-mgfx"), NULL, 0) * 1024; - - if (argFindByPrefix(1, "-mgfxtra")) { - // ******** Extra specified but are we in the correct game mode I wonder???\n - if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) { - // ******** Extra Display List Memeory Required\n - // ******** Shall steal from video buffer\n - // ******** If you try and run hi-res then\n - // ******** you're gonna shafted up the arse\n - // ******** so don't blame me\n - gfxtra = strtol(argFindByPrefix(1, "-mgfxtra"), NULL, 0) * 1024; - } else { - // ******** No we're not so there\n - } + while (g_StageAllocations8Mb[index].stagenum) { + if (g_StageNum == g_StageAllocations8Mb[index].stagenum) { + break; } - // ******** Original Amount required = %dK ber buffer\n - // ******** Extra Amount required = %dK ber buffer\n - // ******** Total of %dK (Double Buffered)\n - g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] = gfx + gfxtra; + index++; } - if (argFindByPrefix(1, "-mvtx")) { - // Argument specified mtxvtx_size\n - g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] = strtol(argFindByPrefix(1, "-mvtx"), NULL, 0) * 1024; + gfx = g_StageAllocations8Mb[index].gfx; + + if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) { + gfx += g_StageAllocations8Mb[index].gfxtra; } - // %d Players : Allocating %d bytes for master dl's\n + g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] = gfx * 1024; + g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] = g_StageAllocations8Mb[index].mvtx * 1024; + g_GfxBuffers[0] = mempAlloc(g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] * 2, MEMPOOL_STAGE); g_GfxBuffers[1] = g_GfxBuffers[0] + g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1]; g_GfxBuffers[2] = g_GfxBuffers[1] + g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1]; - // Allocating %d bytes for mtxvtx space\n g_VtxBuffers[0] = mempAlloc(g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] * 2, MEMPOOL_STAGE); g_VtxBuffers[1] = g_VtxBuffers[0] + g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1]; g_VtxBuffers[2] = g_VtxBuffers[1] + g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1]; diff --git a/src/game/lv.c b/src/game/lv.c index 2a1ef8e56..253bb78cc 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -81,7 +81,6 @@ #include "game/wallhit.h" #include "game/weather.h" #include "lib/anim.h" -#include "lib/args.h" #include "lib/collision.h" #include "lib/joy.h" #include "lib/lib_06440.h" diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index a064ecb02..6c42bcb41 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -20,7 +20,6 @@ #include "game/mplayer/mplayer.h" #include "game/pak.h" #include "bss.h" -#include "lib/args.h" #include "lib/vi.h" #include "lib/main.h" #include "lib/rng.h" @@ -478,12 +477,7 @@ void mpInit(void) func0f1881d4(i); } - if (argFindByPrefix(1, "-mpwpnset")) { - char *value = argFindByPrefix(1, "-mpwpnset"); - mpSetWeaponSet(*value - 0x30); - } else { - mpSetWeaponSet(0); - } + mpSetWeaponSet(0); g_Vars.mplayerisrunning = false; g_Vars.normmplayerisrunning = false; diff --git a/src/game/pak.c b/src/game/pak.c index 4f656a605..997f206ee 100644 --- a/src/game/pak.c +++ b/src/game/pak.c @@ -9,7 +9,6 @@ #include "game/pak.h" #include "game/utils.h" #include "bss.h" -#include "lib/args.h" #include "lib/joy.h" #include "lib/lib_06440.h" #include "lib/main.h" @@ -507,7 +506,7 @@ static PakErr2 pakReadHeaderAtOffset(s8 device, u32 offset, struct pakfileheader return PAK_ERR2_INCOMPLETE; } - if ((argFindByPrefix(1, "-forceversion") ? 1 : 0) != headerptr->version) { + if (headerptr->version != 0) { return PAK_ERR2_VERSION; } @@ -2218,10 +2217,7 @@ static s32 pakWriteFileAtOffset(s8 device, u32 offset, u32 filetype, u8 *newdata headerptr->fileid = fileid ? fileid : ++g_Paks[device].maxfileid; headerptr->deviceserial = g_Paks[device].serial; headerptr->filelen = filelen; - - version = argFindByPrefix(1, "-forceversion") ? 1 : 0; - - headerptr->version = version; + headerptr->version = 0; headerptr->bodylen = bodylen; headerptr->generation = generation; headerptr->filetype = filetype; @@ -2827,10 +2823,6 @@ static void pakProbeEeprom(void) if (type == EEPROM_TYPE_16K) { g_PakHasEeprom = true; - - if (argFindByPrefix(1, "-scrub")) { - pakCreateFilesystem(SAVEDEVICE_GAMEPAK); - } } else { g_PakHasEeprom = false; } diff --git a/src/game/setup.c b/src/game/setup.c index 4e3146a1d..fcd20d4be 100644 --- a/src/game/setup.c +++ b/src/game/setup.c @@ -25,7 +25,6 @@ #include "game/pad.h" #include "game/propobj.h" #include "bss.h" -#include "lib/args.h" #include "lib/dma.h" #include "lib/memp.h" #include "lib/model.h" @@ -1386,8 +1385,8 @@ void setupLoadFiles(s32 stagenum) void setupCreateProps(s32 stagenum) { - s32 withchrs = !argFindByPrefix(1, "-nochr") && !argFindByPrefix(1, "-noprop"); - s32 withobjs = !argFindByPrefix(1, "-noobj") && !argFindByPrefix(1, "-noprop"); + s32 withchrs = true; + s32 withobjs = true; s32 withhovercars; s32 escstepx; s32 escstepy; diff --git a/src/include/lib/args.h b/src/include/lib/args.h deleted file mode 100644 index 8602bde2f..000000000 --- a/src/include/lib/args.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _IN_LIB_ARGS_H -#define _IN_LIB_ARGS_H -#include -#include "data.h" -#include "types.h" - -void argSetString(char *string); -s32 argsParseDebugArgs(void); -char *argFindByPrefix(s32 occurrence, char *string); -void argGetLevel(s32 *stagenum); - -#endif diff --git a/src/include/lib/str.h b/src/include/lib/str.h index 5acd717c4..64fbe8ae6 100644 --- a/src/include/lib/str.h +++ b/src/include/lib/str.h @@ -9,10 +9,5 @@ char *strncpy(char *dst, const char *src, s32 len); char *strcat(char *dst, const char *src); s32 strcmp(const char *s1, const char *s2); s32 strncmp(const char *s1, const char *s2, s32 len); -char toupper(char c); -s32 isdigit(char c); -s32 isalpha(char c); -s32 isspace(char c); -s32 strtol(const char *src, const char **endptr, s32 base); #endif diff --git a/src/include/types.h b/src/include/types.h index 9e19dad8d..6031ac2bc 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5542,8 +5542,11 @@ struct bytelist { }; struct stageallocation { - s32 stagenum; - char *string; + u8 stagenum; + u8 gfx; + u8 gfxtra; + u8 mvtx; + u16 ma; }; struct contsample { diff --git a/src/lib/args.c b/src/lib/args.c deleted file mode 100644 index 1637b9060..000000000 --- a/src/lib/args.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include "constants.h" -#include "bss.h" -#include "lib/args.h" -#include "lib/str.h" -#include "string.h" -#include "data.h" -#include "types.h" - -u32 g_ArgBuffer[30]; - -s32 argc = 1; - -char *argv[17] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, -}; - -/** - * Split the given string into words and populate the argv array. - */ -static char *argParseString(char *str) -{ - argv[0] = ""; - argc = 1; - - while (*str != '\0') { - while (*str == ' ') { - *str = '\0'; - str++; - } - - argv[argc] = str; - argc++; - - while (*str > ' ') { - *str++; - } - } - - return str; -} - -void argSetString(char *string) -{ - strcpy((char *) g_ArgBuffer, string); - argParseString((char *) g_ArgBuffer); -} - -/** - * Find a program argument based on its prefix and occurrence of that prefix, - * and return a pointer to whatever comes after the prefix. - * - * Typically called with arguments such as 1, "-hard". In this example, if the - * argument "-hard2" exists then it would return a pointer to "2". - */ -char *argFindByPrefix(s32 occurrence, char *str) -{ - s32 len = strlen(str); - s32 i; - - for (i = 1; i < argc; i++) { - if (strncmp(str, argv[i], len) == 0) { - occurrence--; - - if (occurrence == 0) { - return &argv[i][len]; - } - } - } - - return NULL; -} - -void argGetLevel(s32 *stagenum) -{ - char *ptr = argFindByPrefix(1, "-level_"); - - if (ptr) { - *stagenum = ptr[0] * 10 + ptr[1] - 528; - } -} diff --git a/src/lib/artifacts.c b/src/lib/artifacts.c index 10e63a31b..081b19572 100644 --- a/src/lib/artifacts.c +++ b/src/lib/artifacts.c @@ -4,7 +4,6 @@ #include "constants.h" #include "game/menugfx.h" #include "bss.h" -#include "lib/args.h" #include "lib/audiomgr.h" #include "lib/reset.h" #include "lib/rzip.h" diff --git a/src/lib/boot.c b/src/lib/boot.c index ffbebf9e4..ecb8f66c7 100644 --- a/src/lib/boot.c +++ b/src/lib/boot.c @@ -6,7 +6,6 @@ #include "constants.h" #include "game/menugfx.h" #include "bss.h" -#include "lib/args.h" #include "lib/rzip.h" #include "lib/main.h" #include "lib/snd.h" diff --git a/src/lib/main.c b/src/lib/main.c index 4c1803c3c..b60f62636 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -44,7 +44,6 @@ #include "game/utils.h" #include "bss.h" #include "lib/audiomgr.h" -#include "lib/args.h" #include "lib/boot.h" #include "lib/vm.h" #include "lib/rzip.h" @@ -68,78 +67,54 @@ extern u8 g_LvShowStats; extern u8 g_LvStatsPage; -bool var8005d9b0 = false; s32 g_StageNum = STAGE_TITLE; u32 g_MainMemaHeapSize = 1024 * 300; -s32 var8005d9c4 = 0; u32 g_MainNumGfxTasks = 0; bool g_MainIsEndscreen = false; s32 g_DoBootPakMenu = 0; struct stageallocation g_StageAllocations8Mb[] = { - { STAGE_CITRAINING, "-ml0 -me0 -mgfx120 -mvtx98 -ma100" }, - { STAGE_DEFECTION, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_INVESTIGATION, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_EXTRACTION, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_CHICAGO, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_G5BUILDING, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_VILLA, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_INFILTRATION, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma500" }, - { STAGE_RESCUE, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma500" }, - { STAGE_ESCAPE, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma500" }, - { STAGE_AIRBASE, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_AIRFORCEONE, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_CRASHSITE, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_PELAGIC, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_DEEPSEA, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma200" }, - { STAGE_DEFENSE, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma100" }, - { STAGE_ATTACKSHIP, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma200" }, - { STAGE_SKEDARRUINS, "-ml0 -me0 -mgfx110 -mgfxtra80 -mvtx100 -ma200" }, - { STAGE_MP_SKEDAR, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_RAVINE, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_PIPES, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_G5BUILDING, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_SEWERS, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_WAREHOUSE, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_BASE, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_COMPLEX, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_TEMPLE, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_FELICITY, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_AREA52, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_GRID, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_CARPARK, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_RUINS, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_FORTRESS, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_MP_VILLA, "-ml0 -me0 -mgfx200 -mvtx200 -ma100" }, - { STAGE_TEST_RUN, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP2, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP6, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP7, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP8, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP14, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP16, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP17, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP18, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP19, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_MP20, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_ASH, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_28, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_MBR, "-ml0 -me0 -mgfx120 -mvtx100 -ma100" }, - { STAGE_TEST_SILO, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_24, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_MAIANSOS, "-ml0 -me0 -mgfx120 -mvtx100 -ma500" }, - { STAGE_RETAKING, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_TEST_DEST, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_2B, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_WAR, "-ml0 -me0 -mgfx120 -mvtx98 -ma100" }, - { STAGE_TEST_UFF, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_TEST_OLD, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_DUEL, "-ml0 -me0 -mgfx120 -mvtx100 -ma100" }, - { STAGE_TEST_LAM, "-ml0 -me0 -mgfx120 -mvtx98 -ma400" }, - { STAGE_TEST_ARCH, "-ml0 -me0 -mgfx200 -mvtx200 -ma400" }, - { STAGE_TEST_LEN, "-ml0 -me0 -mgfx120 -mvtx98 -ma300" }, - { STAGE_TITLE, "-ml0 -me0 -mgfx80 -mvtx20 -ma001" }, - { 0, "-ml0 -me0 -mgfx120 -mvtx98 -ma300" }, + // gfx gfxtra mvtx ma + { STAGE_CITRAINING, 120, 0, 98, 100 }, + { STAGE_DEFECTION, 110, 80, 100, 100 }, + { STAGE_INVESTIGATION, 110, 80, 100, 100 }, + { STAGE_EXTRACTION, 110, 80, 100, 100 }, + { STAGE_CHICAGO, 110, 80, 100, 100 }, + { STAGE_G5BUILDING, 110, 80, 100, 100 }, + { STAGE_VILLA, 110, 80, 100, 100 }, + { STAGE_INFILTRATION, 110, 80, 100, 500 }, + { STAGE_RESCUE, 110, 80, 100, 500 }, + { STAGE_ESCAPE, 110, 80, 100, 500 }, + { STAGE_AIRBASE, 110, 80, 100, 100 }, + { STAGE_AIRFORCEONE, 110, 80, 100, 100 }, + { STAGE_CRASHSITE, 110, 80, 100, 100 }, + { STAGE_PELAGIC, 110, 80, 100, 100 }, + { STAGE_DEEPSEA, 110, 80, 100, 200 }, + { STAGE_DEFENSE, 110, 80, 100, 100 }, + { STAGE_ATTACKSHIP, 110, 80, 100, 200 }, + { STAGE_SKEDARRUINS, 110, 80, 100, 200 }, + { STAGE_MBR, 120, 0, 100, 100 }, + { STAGE_MAIANSOS, 120, 0, 100, 500 }, + { STAGE_WAR, 120, 0, 98, 100 }, + { STAGE_DUEL, 120, 0, 100, 100 }, + { STAGE_MP_SKEDAR, 200, 0, 200, 100 }, + { STAGE_MP_RAVINE, 200, 0, 200, 100 }, + { STAGE_MP_PIPES, 200, 0, 200, 100 }, + { STAGE_MP_G5BUILDING, 200, 0, 200, 100 }, + { STAGE_MP_SEWERS, 200, 0, 200, 100 }, + { STAGE_MP_WAREHOUSE, 200, 0, 200, 100 }, + { STAGE_MP_BASE, 200, 0, 200, 100 }, + { STAGE_MP_COMPLEX, 200, 0, 200, 100 }, + { STAGE_MP_TEMPLE, 200, 0, 200, 100 }, + { STAGE_MP_FELICITY, 200, 0, 200, 100 }, + { STAGE_MP_AREA52, 200, 0, 200, 100 }, + { STAGE_MP_GRID, 200, 0, 200, 100 }, + { STAGE_MP_CARPARK, 200, 0, 200, 100 }, + { STAGE_MP_RUINS, 200, 0, 200, 100 }, + { STAGE_MP_FORTRESS, 200, 0, 200, 100 }, + { STAGE_MP_VILLA, 200, 0, 200, 100 }, + { STAGE_TITLE, 80, 0, 20, 1 }, + { 0, 120, 0, 98, 300 }, }; Gfx var8005dcc8[] = { @@ -192,7 +167,6 @@ static void mainInit(void) amgrInit(); varsInit(); viConfigureForLogos(); - var8005d9b0 = 1; joyInit(); osCreateMesgQueue(&queue, &msg, 1); @@ -211,10 +185,6 @@ static void mainInit(void) if (1); } - if (argFindByPrefix(1, "-level_") == NULL) { - var8005d9b0 = true; - } - // If holding start on any controller, open boot pak menu if (joyGetButtons(0, START_BUTTON) == 0 && joyGetButtons(1, START_BUTTON) == 0 @@ -342,10 +312,6 @@ static void mainInit(void) func0f1a78b0(); filesInit(); - if (var8005d9b0) { - argSetString(" -ml0 -me0 -mgfx100 -mvtx50 -mt700 -ma400"); - } - start = (u8 *) PHYS_TO_K0(osVirtualToPhysical(&_setupdishasmSegmentEnd)); end = g_VmMarker; mempSetHeap(start, end - start); @@ -400,9 +366,6 @@ static void mainLoop(void) func0f175f98(); - var8005d9c4 = 0; - argGetLevel(&g_StageNum); - if (g_DoBootPakMenu) { g_Vars.unk0004e4 = 0xfd; g_StageNum = STAGE_BOOTPAKMENU; @@ -413,10 +376,6 @@ static void mainLoop(void) if (g_StageNum < STAGE_TITLE) { func0f01b148(0); - - if (argFindByPrefix(1, "-hard")) { - lvSetDifficulty(argFindByPrefix(1, "-hard")[0] - '0'); - } } } @@ -427,50 +386,21 @@ static void mainLoop(void) g_MainNumGfxTasks = 0; msg = NULL; g_MainIsEndscreen = false; + index = 0; - if (var8005d9b0 && var8005d9c4 == 0) { - index = -1; - - if (g_StageNum < STAGE_TITLE && g_NumPlayers >= 2) { - index = 0; - - while (g_StageAllocations8Mb[index].stagenum) { - if (g_StageNum + 400 == g_StageAllocations8Mb[index].stagenum) { - break; - } - - index++; - } - - if (g_StageAllocations8Mb[index].stagenum == 0) { - index = -1; - } + while (g_StageAllocations8Mb[index].stagenum) { + if (g_StageNum == g_StageAllocations8Mb[index].stagenum) { + break; } - if (index < 0) { - index = 0; - - while (g_StageAllocations8Mb[index].stagenum) { - if (g_StageNum == g_StageAllocations8Mb[index].stagenum) { - break; - } - - index++; - } - } - - argSetString(g_StageAllocations8Mb[index].string); + index++; } - var8005d9c4 = 0; - mempResetPool(MEMPOOL_7); mempResetPool(MEMPOOL_STAGE); filesStop(4); - if (argFindByPrefix(1, "-ma")) { - g_MainMemaHeapSize = strtol(argFindByPrefix(1, "-ma"), NULL, 0) * 1024; - } + g_MainMemaHeapSize = g_StageAllocations8Mb[index].ma * 1024; memaReset(mempAlloc(g_MainMemaHeapSize, MEMPOOL_STAGE), g_MainMemaHeapSize); langReset(g_StageNum); @@ -479,11 +409,7 @@ static void mainLoop(void) if (g_StageNum >= STAGE_TITLE) { numplayers = 0; } else { - if (argFindByPrefix(1, "-play")) { - numplayers = strtol(argFindByPrefix(1, "-play"), NULL, 0); - } else { - numplayers = 1; - } + numplayers = 1; if (g_NumPlayers >= 2) { numplayers = g_NumPlayers; @@ -494,29 +420,16 @@ static void mainLoop(void) g_Vars.bondplayernum = 0; g_Vars.coopplayernum = -1; g_Vars.antiplayernum = -1; - } else if (argFindByPrefix(1, "-coop")) { - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = 1; - g_Vars.antiplayernum = -1; - } else if (argFindByPrefix(1, "-anti")) { - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = 1; } playermgrAllocatePlayers(numplayers); - if (argFindByPrefix(1, "-mpbots")) { - g_Vars.lvmpbotlevel = 1; - } - if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { g_MpSetup.chrslots = 0x03; mpReset(); } else if (g_Vars.perfectbuddynum) { mpReset(); - } else if (g_Vars.mplayerisrunning == false - && (numplayers >= 2 || g_Vars.lvmpbotlevel || argFindByPrefix(1, "-play"))) { + } else if (g_Vars.mplayerisrunning == false && (numplayers >= 2 || g_Vars.lvmpbotlevel)) { g_MpSetup.chrslots = 1; if (numplayers >= 2) { diff --git a/src/lib/sched.c b/src/lib/sched.c index 65826aec2..39aa604f7 100644 --- a/src/lib/sched.c +++ b/src/lib/sched.c @@ -4,7 +4,6 @@ #include "constants.h" #include "game/menugfx.h" #include "bss.h" -#include "lib/args.h" #include "lib/audiomgr.h" #include "lib/reset.h" #include "lib/rzip.h" diff --git a/src/lib/snd.c b/src/lib/snd.c index 6c0c1b9a0..459ab4ec3 100644 --- a/src/lib/snd.c +++ b/src/lib/snd.c @@ -6,7 +6,6 @@ #include "game/music.h" #include "bss.h" #include "lib/rzip.h" -#include "lib/args.h" #include "lib/audiomgr.h" #include "lib/dma.h" #include "lib/snd.h" @@ -1281,10 +1280,6 @@ void sndInit(void) g_SndMp3Enabled = true; g_SndMaxFxBusses = 2; - if (argFindByPrefix(1, "-nomp3")) { - g_SndMp3Enabled = false; - } - if (!g_SndDisabled) { // Allocate memory for the audio heap, // clear it and give it to the audio library diff --git a/src/lib/str.c b/src/lib/str.c index 3445e983e..4675eb216 100644 --- a/src/lib/str.c +++ b/src/lib/str.c @@ -109,124 +109,3 @@ s32 strncmp(const char *s1, const char *s2, s32 len) return strncmp(s1 + 1, s2 + 1, len); } - -static char toupper(char c) -{ - if (c >= 'a' && c <= 'z') { - return c - 0x20; - } - - return c; -} - -static s32 isdigit(char c) -{ - return c >= '0' && c <= '9'; -} - -static s32 isalpha(char c) -{ - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); -} - -static s32 isspace(char c) -{ - return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v'; -} - -s32 strtol(const char *src, const char **endptr, s32 base) -{ - bool negative; - u32 cutoff; - u32 cutlim; - u32 value; - const char *ptr; - char c; - const char *save; - bool overflow; - - if (base < 0 || base == 1 || base > 36) { - base = 10; - } - - ptr = src; - - while (isspace(*ptr)) { - ptr++; - } - - if (*ptr != '\0') { - if (*ptr == '-') { - negative = true; - ptr++; - } else if (*ptr == '+') { - negative = false; - ptr++; - } else { - negative = false; - } - - if (base == 16 && ptr[0] == '0' && toupper(ptr[1]) == 'X') { - ptr += 2; - } - - if (base == 0) { - if (*ptr == '0') { - if (toupper(ptr[1]) == 'X') { - ptr += 2; - base = 16; - } else { - base = 8; - } - } else { - base = 10; - } - } - - save = ptr; - - cutoff = U32_MAX / base; - cutlim = U32_MAX % base; - overflow = false; - value = 0; - - for (c = *ptr; c != '\0'; c = *++ptr) { - if (isdigit(c)) { - c -= '0'; - } else if (isalpha(c)) { - c = toupper(c) - 'A' + 10; - } else { - break; - } - - if (c >= base) { - break; - } - - if (value > cutoff || (value == cutoff && (u32)c > cutlim)) { - overflow = true; - } else { - value *= base; - value += (u32)c; - } - } - - if (ptr != save) { - if (endptr != NULL) { - *endptr = ptr; - } - - if (overflow) { - return -1; - } - - return negative ? -value : value; - } - } - - if (endptr != NULL) { - *endptr = src; - } - - return 0; -}