Merge pull request #59 from Hyenadae/master

Add Pi Script + WIP Addition of in-game menu quit -- Good job! Superb contribution :- )
This commit is contained in:
Vinícius R. Miguel 2020-05-12 01:42:15 -03:00 committed by GitHub
commit 0ec63e46ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 485 additions and 27 deletions

View file

@ -10,11 +10,11 @@
#define NC_CAMC _("Camera Centre Aggression")
#define NC_CAMP _("Camera Pan Level")
#define NC_ENABLED _("Enabled")
#define NC_DISABLED _("Disabled")
#define NC_DISABLED _("Disabled")
#define NC_BUTTON _("[R]: Options")
#define NC_BUTTON2 _("[R]: Return")
#define NC_OPTION _("OPTIONS")
#define NC_HIGHLIGHT _("O")
#define NC_HIGHLIGHT _("O")
#define NC_ANALOGUE _("Analogue Camera")
#define NC_MOUSE _("Mouse Look")
@ -105,6 +105,7 @@
#define TEXT_COURSE _("コース")
#define TEXT_MYSCORE _("マイスコア")
#define TEXT_CONTINUE _("つづけて マリオする?")
#define TEXT_EXIT_GAME _("ゲームをしゅうりょうする?")
#define TEXT_EXIT_COURSE _("コースからでる?")
#define TEXT_CAMERA_ANGLE_R _("Rボタンのカメラきりかえ")
@ -122,6 +123,7 @@
// Save Options
#define TEXT_SAVE_AND_CONTINUE _("セーブしてつづける?")
#define TEXT_SAVE_AND_QUIT _("セーブしておわる?")
#define TEXT_SAVE_EXIT_GAME _("ゲームをやめる?")
#define TEXT_CONTINUE_WITHOUT_SAVING _("セーブしないでつづける?")
/**
@ -204,6 +206,7 @@
#define TEXT_MYSCORE _("MYSCORE")
#define TEXT_CONTINUE _("CONTINUE")
#define TEXT_EXIT_COURSE _("EXIT COURSE")
#define TEXT_EXIT_GAME _("EXIT GAME")
#ifndef VERSION_EU // "R" text is different in EU
#define TEXT_CAMERA_ANGLE_R _("SET CAMERA ANGLE WITH R")
#endif
@ -222,6 +225,7 @@
// Save Options
#define TEXT_SAVE_AND_CONTINUE _("SAVE & CONTINUE")
#define TEXT_SAVE_AND_QUIT _("SAVE & QUIT")
#define TEXT_SAVE_EXIT_GAME _("SAVE & EXIT GAME")
#define TEXT_CONTINUE_WITHOUT_SAVING _("CONTINUE, DON'T SAVE")
/**
@ -348,12 +352,14 @@
#define TEXT_MY_SCORE_FR _("MON SCORE")
#define TEXT_CONTINUE_FR _("CONTINUER")
#define TEXT_EXIT_COURSE_FR _("QUITTER NIVEAU")
#define TEXT_EXIT_GAME_FR _("QUITTER JEU")
#define TEXT_CAMERA_ANGLE_R_FR _("RÉGLAGE CAMÉRA AVEC [R]")
// German
#define TEXT_COURSE_DE _("KURS")
#define TEXT_MY_SCORE_DE _("LEISTUNG")
#define TEXT_CONTINUE_DE _("WEITER")
#define TEXT_EXIT_COURSE_DE _("KURS VERLASSEN")
#define TEXT_EXIT_GAME_DE _("SPIEL VERLASSEN")
#define TEXT_CAMERA_ANGLE_R_DE _("KAMERA MIT [R] VERSTELLEN")
// Camera Options
@ -376,10 +382,12 @@
// French
#define TEXT_SAVE_AND_CONTINUE_FR _("SAUVEGARDER & CONTINUER")
#define TEXT_SAVE_AND_QUIT_FR _("SAUVEGARDER & QUITTER")
#define TEXT_SAVE_EXIT_GAME_FR _("SAUVEGARDER & QUITTER JEU")
#define TEXT_CONTINUE_WITHOUT_SAVING_FR _("CONTINUER SANS SAUVEGARDER")
// German
#define TEXT_SAVE_AND_CONTINUE_DE _("SPEICHERN & WEITER")
#define TEXT_SAVE_AND_QUIT_DE _("SPEICHERN & ENDE")
#define TEXT_SAVE_EXIT_GAME_DE _("SPEICHERN & SPIEL VERLASSEN")
#define TEXT_CONTINUE_WITHOUT_SAVING_DE _("WEITER OHNE ZU SPEICHERN")
/**

395
pisetup.sh Executable file
View file

@ -0,0 +1,395 @@
#!/bin/bash
clear
echo "This script will assist with compiling Super Mario 64 on Raspbian 10"
echo "Note that accelerated OpenGL (vc4_drm) is required for maximum performance"
echo "Checking Raspberry Pi model..."
lowmem=0
pi=0
pimodel=$(uname -m 2>/dev/null || echo unknown)
pitype=$(tr -d '\0' < /sys/firmware/devicetree/base/model)
if [[ $pimodel =~ "armv6" ]]
then
echo ""
echo "Raspberry Pi Model 1/0(W) detected (LOWMEM)"
echo "Warning: Additional steps may be required to safely compile and maximize performance"
pi=1;
lowmem=1;
exp=1;
fi
if [[ $pimodel =~ "armv7" ]]
then
echo
echo "Raspberry Pi Model 2/3 detected (32bit)"
pi=2;
lowmem=0;
fi
if [[ $pimodel =~ "aarch64" && $pitype =~ "4" ]]
then
echo
echo "Raspberry Pi Model 4 detected"
echo "Audio errors reported"
echo "Fixing audio config, reboot after compilation completes to activate"
sudo sed -i 's/load-module module-udev-detect/load-module module-udev-detect tsched=0/' /etc/pulse/default.pa
#load-module module-udev-detect tsched=0
pi=4;
lowmem=0;
exp=1;
fi
if [[ $exp == 1 ]]
then
echo ""
echo "Notice: Due to detected Pi version, compilation and execution of Super Mario 64 (RPi) is experimental."
echo "Further steps may be required and software / driver compatibility is not guaranteed."
read -p "Continue setup & compilation (Y/N): " exp
if [[ $exp =~ "Y" ]]
then
echo ""
else
exit
fi
echo "Please report any problems encountered to https://github.com/sm64pc/sm64pc issue tracker."
echo ""
sleep 7
fi
#//////////////////////////////////////////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////////////////////////////////////////
clear
echo "Super Mario 64 RPi Initial Setup"
if [[ $pi != 4 ]]
then #Dumb idea, but quick hack. We CANNOT enable VC4 for Pi4.
inxinf=$(inxi -Gx)
echo "Checking for pre-enabled VC4 acceleration (inxi -Gx)"
if [[ $inxinf =~ "not found" ]]
then
echo "Error: inxi not installed. Installing..."
sudo apt-get update
sudo apt-get install inxi
inxi=$(inxi -Gx)
if [[ $inxinf =~ "not found" ]]
then
echo "Warning: Setup will not continue unless inxi is installed"
echo "Please ensure your Pi is in a state to download and install packages"
sleep 3
exit
fi
fi
if [[ $inxinf =~ "vc4_drm" ]]
then
echo "Success: VC4 OpenGL acceleration found!"
echo ""
sleep 4
else
echo ""
echo "OpenGL driver not found. opening Raspi-Config..."
echo "Please enable raspi-config -> ADV Opt -> OpenGL -> Enable FullKMS Renderer"
echo ""
sleep 5
sudo raspi-config
vc4add=$(cat /boot/config.txt | grep -e "dtoverlay=vc4-kms-v3d")
if [[ $vc4add =~ "vc4" ]]
then
echo "OGL driver now enabled on reboot"
fi
fi
if [[ $lowmem == 1 ]]
then
fixmem=$(cat /boot/cmdline.txt | grep cma=128M)
if [[ $fixmem =~ "cma=128M" ]]
then
echo ""
echo "Notice: Low-RAM RasPi model detected, BUT fixes already applied."
echo "Continuing setup."
else
echo ""
echo "Warning: VC4 enabled, but your Rasp Pi has 512MB or less RAM"
echo "To ensure VC4_DRM and game compilation is succesful, video memory will be reduced"
echo "gpu_mem=48M (config.txt) | cma=128M (cmdline.txt) will be written to /boot "
echo ""
read -p "Fix mem? (Y/N): " fixmem
if [[ $fixmem =~ "Y" ]]
then
sudo sh -c "echo 'gpu_mem=48' >> /boot/config.txt"
sudo sh -c "echo 'cma=128M' >> /boot/cmdline.txt"
sync
echo "Wrote configuration changes to SD card."
sleep 2
else
echo ""
echo "Warning: Compilation freezes & errors are likely to occur on your Pi"
echo ""
sleep 3
fi
fi
fi
if [[ $fixmem =~ "Y" || $vc4add =~ "vc4" ]]
then
clear
echo "System configuration has changed!"
read -p "Reboot to enable changes? (Y/N): " fixstart
if [[ $fixstart =~ "Y" ]]
then
echo ""
echo "Rebooting RasPi!"
sudo reboot
fi
fi
fi #This should never run on a Pi 4
#--------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
clear
echo "Beginning installation"
echo ""
echo "Step 1. Installing latest dependencies"
echo "Allow installation & checking of Super Mario 64 compile dependencies?"
read -p "Install? (Y/N): " instdep
if [[ $instdep =~ "Y" ]]
then
echo ""
sudo apt-get update
sudo apt install build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev
sync
else
echo ""
echo "Super Mario 64 dependencies not installed."
echo "Please manually install if Raspbian is modified from stock"
echo ""
sleep 3
fi
#--------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
clear
echo "Optional: Compile SDL2 with 'KMSDRM' for enhanced performance?"
echo "KMSDRM allows Super Mario 64 to be run without GUI/Desktop enabled on boot."
echo ""
echo "Warning: Compile could take up to an hour on older Raspberry Pi models"
read -p "Proceed? (Y/N): " sdlcomp
if [[ $sdlcomp =~ "Y" ]]
then
echo ""
echo "Installing dependencies for SDL2 compilation"
sudo sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
sudo apt build-dep libsdl2
sudo apt install libdrm-dev libgbm-dev
sync
echo ""
echo "Creating folder src in HOME directory for compile"
echo ""
mkdir $HOME/src
cd $HOME/src
mkdir $HOME/src/sdl2
cd $HOME/src/sdl2
sleep 2
echo "Downloading SDL2 from libsdl.org and unzipping to HOME/src/sdl2/SDL2"
wget https://www.libsdl.org/release/SDL2-2.0.10.tar.gz
sync
tar xzf ./SDL2*.gz
sync
cd ./SDL2*
echo "Configuring SDL2 library to enable KMSDRM (Xorg free rendering)"
./configure --enable-video-kmsdrm
echo "Compiling modified SDL2 and installing."
make
sudo make install
fi
#----------------------------------------------------------------------
#---------------------------------------------------------------------
sleep 2
clear
echo "Super Mario 64 RPi preparation & downloader"
echo ""
echo "Checking in current directory and"
echo "checking in "$HOME"/src/sm64pi/sm64pc/ for existing Super Mario 64 PC files"
echo ""
sm64dircur=$(ls ./Makefile)
sm64dir=$(ls $HOME/src/sm64pi/sm64pc/Makefile)
if [[ $sm64dircur =~ "Makefile" ]] #If current directory has a makefile
then
sm64dir=$sm64dircur
curdir=1; #If current directory has a Makefile or is git zip
fi
if [[ $sm64dir =~ "Makefile" ]];
then
echo "Existing Super Mario 64 PC port files found!"
echo "Redownload files (fresh compile)?"
read -p "Redownload? (Y/N): " sm64git
if [[ $sm64git =~ "N" ]] # Do NOT redownload, USE current directory for compile
then
sm64dir=1; # Don't redownload files , use current directory (has sm64 files)
curdir=1
fi
else #Do a fresh compile in HOME/src/sm64pi/sm64pc/
sm64dir=0;
curdir=0;
fi
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
if [[ $sm64git =~ "Y" || $sm64dir == 0 || $curdir == 0 ]] #If user wants to redownload or NOT git-zip execution
then
echo "Step 2. Super Mario 64 PC-Port will now be downloaded from github"
echo "Current folder will NOT be compiled."
read -p "Proceed? (Y/N): " gitins
if [[ $gitins =~ "Y" ]]
then
echo ""
echo "Creating directory "$HOME"/src/sm64pi"
mkdir $HOME/src/
cd $HOME/src/
mkdir $HOME/src/sm64pi
cd $HOME/src/sm64pi
echo ""
echo "Downloading latest Super Mario 64 PC-port code"
git clone https://github.com/sm64pc/sm64pc
cd $HOME/src/sm64pi/sm64pc/
echo "Download complete"
echo ""
sleep 2
fi #End of downloader
fi
sleep 2
#-------------------------------------------------------------------
#------------------------------------------------------------------
clear
echo "Super Mario 64 RPi compilation"
echo ""
echo "Step 3. Compiling Super Mario 64 for the Raspberry Pi"
echo ""
echo "Warning: Super Mario 64 assets are required in order to compile"
echo "Assets will be extracted from $HOME/src/sm64pi/sm64pc/baserom.(us/eu/jp).z64 "
if [[ $curdir == 1 ]]
then
sm64z64=$(find ./* | grep baserom) #See if current directory is prepped
else
sm64z64=$(find $HOME/src/sm64pi/sm64pc/* | grep baserom) #see if fresh compile directory is prepped
fi
if [[ $sm64z64 =~ "baserom" ]]
then
echo ""
echo "Super Mario 64 assets found in compilation directory"
echo "Continuing with compilation"
else
echo ""
echo "Please satisfy this requirement before continuing."
echo "Exiting Super Mario 64 RasPi setup and compilation script."
echo "Note: Re-run script once baserom(s) are inserted into"
if [[ $curdir == 1 ]]
then
echo $PWD
else
echo $HOME/src/sm64pi/sm64pc/
fi
sleep 5
exit
fi
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
sleep 3
clear
echo ""
if [[ $curdir != 1 ]] # If we're not compiling from a git zip / random directory
then
cd $HOME/src/sm64pi/sm64pc/
fi
echo "Beginning Super Mario 64 RasPi compilation!"
echo ""
echo "Warning: Compilation may take up to an hour on weaker hardware"
echo "At least 300MB of free storage AND RAM is recommended"
echo ""
make clean
sync
make TARGET_RPI=1
sync
#---------------------------------------------------------------------------
#--------------------------------------------------------------------------
if [[ $curdir == 1 ]]
then
sm64done=$(find ./build/*/* | grep .arm)
else
sm64done=$(find $HOME/src/sm64pi/sm64pc/build/*/* | grep .arm)
fi
echo ""
if [[ $sm64done =~ ".arm" ]]
then
echo "Super Mario 64 RasPi compilation successful!"
echo "You may find it in"
if [[ $curdir == 1 ]]
then
$sm64loc=$(ls ./build/*pc/*.arm)
else
$sm64loc=$(ls $HOME/src/sm64pi/sm64pc/build/*pc/*.arm)
fi
echo $sm64loc
echo ""
echo "Execute compiled Super Mario 64 RasPi?"
read -p "Run game (Y/N): " sm64run
if [[ $sm64run =~ "Y" ]]
then
cd
chmod +x $sm64loc
bash $sm64loc
sleep 1
fi
else
echo "Cannot find compiled sm64*.arm binary..."
echo "Please note of any errors during compilation process and report them to"
echo "https://github.com/sm64pc/sm64pc"
sleep 5
fi
exit

View file

@ -2387,6 +2387,13 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
{ TEXT_EXIT_COURSE_FR },
{ TEXT_EXIT_COURSE_DE }
};
u8 textExitGame[][22] ={
{ TEXT_EXIT_GAME },
{ TEXT_EXIT_GAME_FR },
{ TEXT_EXIT_GAME_DE }
};
u8 textCameraAngleR[][24] = {
{ TEXT_CAMERA_ANGLE_R },
{ TEXT_CAMERA_ANGLE_R_FR },
@ -2394,23 +2401,27 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
};
#define textContinue textContinue[gInGameLanguage]
#define textExitCourse textExitCourse[gInGameLanguage]
#define textExitGame textExitGame[gInGameLanguage]
#define textCameraAngleR textCameraAngleR[gInGameLanguage]
#else
u8 textContinue[] = { TEXT_CONTINUE };
u8 textExitCourse[] = { TEXT_EXIT_COURSE };
u8 textExitGame[] = { TEXT_EXIT_GAME };
u8 textCameraAngleR[] = { TEXT_CAMERA_ANGLE_R };
#endif
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 4); // Index max raised to 4 from 3
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
print_generic_string(x + 10, y - 2, textContinue);
print_generic_string(x + 10, y - 17, textExitCourse);
print_generic_string(x + 10, y - 33, textExitGame);
if (index[0] != 3) {
print_generic_string(x + 10, y - 33, textCameraAngleR);
if (index[0] != 4) {
print_generic_string(x + 10, y - 48, textCameraAngleR);
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0);
@ -2420,8 +2431,8 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
if (index[0] == 3) {
render_pause_camera_options(x - 42, y - 42, &gDialogCameraAngleIndex, 110);
if (index[0] == 4) {
render_pause_camera_options(x - 42, y - 57, &gDialogCameraAngleIndex, 110);
}
}
@ -2662,7 +2673,7 @@ s16 render_pause_courses_and_castle(void) {
gDialogBoxState = DIALOG_STATE_OPENING;
gMenuMode = -1;
if (gDialogLineNum == 2) {
if (gDialogLineNum == 2 || gDialogLineNum == 3) {
num = gDialogLineNum;
} else {
num = 1;
@ -2949,11 +2960,13 @@ void render_course_complete_lvl_info_and_hud_str(void) {
#if defined(VERSION_JP) || defined(VERSION_SH)
#define TXT_SAVECONT_Y 2
#define TXT_SAVEQUIT_Y 18
#define TXT_CONTNOSAVE_Y 38
#define TXT_SAVE_EXIT_GAME_Y 38
#define TXT_CONTNOSAVE_Y 54
#else
#define TXT_SAVECONT_Y 0
#define TXT_SAVEQUIT_Y 20
#define TXT_CONTNOSAVE_Y 40
#define TXT_SAVE_EXIT_GAME_Y 40
#define TXT_CONTNOSAVE_Y 60
#endif
#ifdef VERSION_EU
@ -2975,28 +2988,39 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e)
{ TEXT_SAVE_AND_QUIT_FR },
{ TEXT_SAVE_AND_QUIT_DE }
};
u8 textSaveExitGame[][26] = { // New function to exit game
{ TEXT_SAVE_EXIT_GAME },
{ TEXT_SAVE_EXIT_GAME_FR },
{ TEXT_SAVE_EXIT_GAME_DE }
};
u8 textContinueWithoutSaveArr[][27] = {
{ TEXT_CONTINUE_WITHOUT_SAVING },
{ TEXT_CONTINUE_WITHOUT_SAVING_FR },
{ TEXT_CONTINUE_WITHOUT_SAVING_DE }
};
#define textSaveAndContinue textSaveAndContinueArr[gInGameLanguage]
#define textSaveAndQuit textSaveAndQuitArr[gInGameLanguage]
#define textSaveExitGame textSaveExitGame[gInGameLanguage]
#define textContinueWithoutSave textContinueWithoutSaveArr[gInGameLanguage]
s16 xOffset = get_str_x_pos_from_center(160, textContinueWithoutSaveArr[gInGameLanguage], 12.0f);
#else
u8 textSaveAndContinue[] = { TEXT_SAVE_AND_CONTINUE };
u8 textSaveAndQuit[] = { TEXT_SAVE_AND_QUIT };
u8 textSaveExitGame[] = { TEXT_SAVE_EXIT_GAME };
u8 textContinueWithoutSave[] = { TEXT_CONTINUE_WITHOUT_SAVING };
#endif
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 4); // Increased to '4' to handle Exit Game
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
print_generic_string(TXT_SAVEOPTIONS_X, y + TXT_SAVECONT_Y, textSaveAndContinue);
print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVEQUIT_Y, textSaveAndQuit);
print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVE_EXIT_GAME_Y, textSaveExitGame);
print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_CONTNOSAVE_Y, textContinueWithoutSave);
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);

View file

@ -1,4 +1,5 @@
#include <ultra64.h>
#include <stdbool.h>
#include "sm64.h"
#include "seq_ids.h"
@ -27,6 +28,9 @@
#include "level_table.h"
#include "course_table.h"
#include "thread6.h"
#include "../../include/libc/stdlib.h"
#include "../pc/configfile.h"
#define CONFIG_FILE "sm64config.txt"
#define PLAY_MODE_NORMAL 0
#define PLAY_MODE_PAUSED 2
@ -1013,23 +1017,36 @@ s32 play_mode_normal(void) {
s32 play_mode_paused(void) {
if (gPauseScreenMode == 0) {
set_menu_mode(RENDER_PAUSE_SCREEN);
} else if (gPauseScreenMode == 1) {
} else if (gPauseScreenMode == 1) {
raise_background_noise(1);
gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN;
set_play_mode(PLAY_MODE_NORMAL);
} else {
// Exit level
if (gDebugLevelSelect) {
fade_into_special_warp(-9, 1);
} else {
initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);
fade_into_special_warp(0, 0);
gSavedCourseNum = COURSE_NONE;
}
gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN;
}
// Exit level
else if (gPauseScreenMode == 2) {
if (gDebugLevelSelect) {
fade_into_special_warp(-9, 1);
}
else {
initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);
fade_into_special_warp(0, 0);
gSavedCourseNum = COURSE_NONE;
}
} // end of gPauseScreenMode == 2 for "EXIT COURSE" option
if (gPauseScreenMode == 3) { // We should only be getting "int 3" to here
initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);
fade_into_special_warp(0, 0);
//configfile_save(CONFIG_FILE);
exit(0); // Appears to automatically save config on exit!
}
gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN;
// }
return 0;
}

View file

@ -1,4 +1,5 @@
#include <ultra64.h>
#include <stdbool.h>
#include "prevent_bss_reordering.h"
#include "sm64.h"
#include "gfx_dimensions.h"
@ -27,9 +28,12 @@
#include "level_table.h"
#include "dialog_ids.h"
#include "thread6.h"
#include "../../include/libc/stdlib.h"
#include "../pc/configfile.h"
#define CONFIG_FILE "sm64config.txt"
// TODO: put this elsewhere
enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, SAVE_OPT_SAVE_AND_QUIT, SAVE_OPT_CONTINUE_DONT_SAVE };
enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, SAVE_OPT_SAVE_AND_QUIT, SAVE_OPT_SAVE_EXIT_GAME, SAVE_OPT_CONTINUE_DONT_SAVE };
static struct Object *sIntroWarpPipeObj;
static struct Object *sEndPeachObj;
@ -254,16 +258,26 @@ void handle_save_menu(struct MarioState *m) {
// mario_finished_animation(m) ? (not my file, not my problem)
if (is_anim_past_end(m) && gSaveOptSelectIndex != 0) {
// save and continue / save and quit
if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_CONTINUE || gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT) {
if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_CONTINUE || gSaveOptSelectIndex == SAVE_OPT_SAVE_EXIT_GAME || gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT) {
save_file_do_save(gCurrSaveFileNum - 1);
if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT) {
fade_into_special_warp(-2, 0); // reset game
}
if (gSaveOptSelectIndex == SAVE_OPT_SAVE_EXIT_GAME) {
//configfile_save(CONFIG_FILE); //Redundant, save_file implies save_config? Save config file before fully exiting
//initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);
fade_into_special_warp(0, 0);
//fade_into_special_warp(-2, 0); // do the reset game thing
exit(0); // exit after saving game
}
}
// not quitting
if (gSaveOptSelectIndex != SAVE_OPT_SAVE_AND_QUIT) {
if (gSaveOptSelectIndex != SAVE_OPT_SAVE_EXIT_GAME) {
disable_time_stop();
m->faceAngle[1] += 0x8000;
// figure out what dialog to show, if we should