Added CLI functionality with --skip-intro option.

This commit is contained in:
IvanDSM 2020-05-11 02:42:22 -03:00
parent 50bb799718
commit 61e7e8d032
4 changed files with 35 additions and 1 deletions

View File

@ -28,6 +28,8 @@
#include "course_table.h"
#include "thread6.h"
#include "pc/cliopts.h"
#define PLAY_MODE_NORMAL 0
#define PLAY_MODE_PAUSED 2
#define PLAY_MODE_CHANGE_AREA 3
@ -1197,7 +1199,7 @@ s32 init_level(void) {
if (gMarioState->action != ACT_UNINITIALIZED) {
if (save_file_exists(gCurrSaveFileNum - 1)) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else {
} else if (gCLIOpts.SkipIntro == 0) {
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
val4 = 1;
}

20
src/pc/cliopts.c Normal file
View File

@ -0,0 +1,20 @@
#include "cliopts.h"
struct PCCLIOptions gCLIOpts;
void parse_cli_opts(int argc, char* argv[])
{
// Initialize options with false values.
gCLIOpts.SkipIntro = 0;
// Scan arguments for options
if (argc > 1)
{
int i;
for (i = 1; i < argc; i++)
{
if (strcmp(argv[i], "--skip-intro") == 0) // Skip Peach Intro
gCLIOpts.SkipIntro = 1;
}
}
}

10
src/pc/cliopts.h Normal file
View File

@ -0,0 +1,10 @@
#include "sm64.h"
struct PCCLIOptions
{
u8 SkipIntro;
};
extern struct PCCLIOptions gCLIOpts;
void parse_cli_opts(int argc, char* argv[]);

View File

@ -18,6 +18,7 @@
#include "audio/audio_sdl.h"
#include "audio/audio_null.h"
#include "cliopts.h"
#include "configfile.h"
OSMesg D_80339BEC;
@ -155,6 +156,7 @@ void main_func(void) {
}
int main(int argc, char *argv[]) {
parse_cli_opts(argc, argv);
main_func();
return 0;
}