Merge pull request #102 from sm64pc/skipintro
Add command line parsing and --skip-intro option
This commit is contained in:
commit
f39d9ad096
|
@ -14,7 +14,7 @@ Run `./extract-assets.py --clean && make clean` or `make distclean` to remove RO
|
||||||
* Analog camera control and mouse look. (Activate with `make BETTERCAMERA=1`.)
|
* Analog camera control and mouse look. (Activate with `make BETTERCAMERA=1`.)
|
||||||
* An option to disable drawing distances. (Activate with `make NODRAWINGDISTANCE=1`.)
|
* An option to disable drawing distances. (Activate with `make NODRAWINGDISTANCE=1`.)
|
||||||
* In-game control binding, currently available on the `testing` branch.
|
* In-game control binding, currently available on the `testing` branch.
|
||||||
* Skip introductory Peach & Lakitu cutscenes with a `--skip-intro` CLI option, currently available on `testing` and `skip-intro` branches.
|
* Skip introductory Peach & Lakitu cutscenes with the `--skip-intro` CLI option
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
For building instructions, please refer to the [wiki](https://github.com/sm64pc/sm64pc/wiki).
|
For building instructions, please refer to the [wiki](https://github.com/sm64pc/sm64pc/wiki).
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "../pc/configfile.h"
|
#include "../pc/configfile.h"
|
||||||
#define CONFIG_FILE "sm64config.txt"
|
#define CONFIG_FILE "sm64config.txt"
|
||||||
|
|
||||||
|
#include "pc/cliopts.h"
|
||||||
|
|
||||||
#define PLAY_MODE_NORMAL 0
|
#define PLAY_MODE_NORMAL 0
|
||||||
#define PLAY_MODE_PAUSED 2
|
#define PLAY_MODE_PAUSED 2
|
||||||
#define PLAY_MODE_CHANGE_AREA 3
|
#define PLAY_MODE_CHANGE_AREA 3
|
||||||
|
@ -176,7 +178,8 @@ s8 D_8032C9E0 = 0;
|
||||||
u8 unused3[4];
|
u8 unused3[4];
|
||||||
u8 unused4[2];
|
u8 unused4[2];
|
||||||
|
|
||||||
|
// For configfile intro skipping
|
||||||
|
extern unsigned int configSkipIntro;
|
||||||
|
|
||||||
|
|
||||||
void basic_update(s16 *arg);
|
void basic_update(s16 *arg);
|
||||||
|
@ -1214,7 +1217,7 @@ s32 init_level(void) {
|
||||||
if (gMarioState->action != ACT_UNINITIALIZED) {
|
if (gMarioState->action != ACT_UNINITIALIZED) {
|
||||||
if (save_file_exists(gCurrSaveFileNum - 1)) {
|
if (save_file_exists(gCurrSaveFileNum - 1)) {
|
||||||
set_mario_action(gMarioState, ACT_IDLE, 0);
|
set_mario_action(gMarioState, ACT_IDLE, 0);
|
||||||
} else {
|
} else if (gCLIOpts.SkipIntro == 0 && configSkipIntro == 0) {
|
||||||
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
|
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
|
||||||
val4 = 1;
|
val4 = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include "cliopts.h"
|
||||||
|
#include <strings.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "sm64.h"
|
||||||
|
|
||||||
|
struct PCCLIOptions
|
||||||
|
{
|
||||||
|
u8 SkipIntro;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct PCCLIOptions gCLIOpts;
|
||||||
|
|
||||||
|
void parse_cli_opts(int argc, char* argv[]);
|
|
@ -69,6 +69,7 @@ bool configCameraInvertY = false;
|
||||||
bool configEnableCamera = false;
|
bool configEnableCamera = false;
|
||||||
bool configCameraMouse = false;
|
bool configCameraMouse = false;
|
||||||
#endif
|
#endif
|
||||||
|
unsigned int configSkipIntro = 0;
|
||||||
|
|
||||||
static const struct ConfigOption options[] = {
|
static const struct ConfigOption options[] = {
|
||||||
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configFullscreen},
|
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configFullscreen},
|
||||||
|
@ -107,6 +108,7 @@ static const struct ConfigOption options[] = {
|
||||||
{.name = "bettercam_aggression", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraAggr},
|
{.name = "bettercam_aggression", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraAggr},
|
||||||
{.name = "bettercam_pan_level", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraPan},
|
{.name = "bettercam_pan_level", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraPan},
|
||||||
#endif
|
#endif
|
||||||
|
{.name = "skip_intro", .type = CONFIG_TYPE_UINT, .uintValue = &configSkipIntro},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "audio/audio_sdl.h"
|
#include "audio/audio_sdl.h"
|
||||||
#include "audio/audio_null.h"
|
#include "audio/audio_null.h"
|
||||||
|
|
||||||
|
#include "cliopts.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
|
||||||
OSMesg D_80339BEC;
|
OSMesg D_80339BEC;
|
||||||
|
@ -155,6 +156,7 @@ void main_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
parse_cli_opts(argc, argv);
|
||||||
main_func();
|
main_func();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue