mirror of https://github.com/sm64pc/sm64pc.git
Added memory cleanup, sounds on the settings menu and some QOL changes
This commit is contained in:
parent
8eb536cf32
commit
9a5afacdfa
|
@ -1563,19 +1563,19 @@ void print_main_menu_strings(void) {
|
|||
|
||||
txt = get_key_string("TEXT_SCORE");
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2;
|
||||
moon_draw_text(70 - x, 39, txt, 1.0);
|
||||
moon_draw_text(70 - x, 52, txt, 1.0);
|
||||
|
||||
txt = get_key_string("TEXT_COPY");
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2;
|
||||
moon_draw_text(129.5f - x, 39, txt, 1.0);
|
||||
moon_draw_text(129.5f - x, 52, txt, 1.0);
|
||||
|
||||
txt = get_key_string("TEXT_ERASE");
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2;
|
||||
moon_draw_text(ERASE_X - x, 39, txt, 1.0);
|
||||
moon_draw_text(ERASE_X - x, 52, txt, 1.0);
|
||||
|
||||
txt = textSoundModes[sSoundMode];
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2 + 0.5;
|
||||
moon_draw_text(SOUNDMODE_X1 - x, 39, txt, 1.0);
|
||||
moon_draw_text(SOUNDMODE_X1 - x, 52, txt, 1.0);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
// Print file names
|
||||
|
|
|
@ -296,13 +296,13 @@ void print_act_selector_strings(void) {
|
|||
if (sVisibleStars != 0) {
|
||||
selectedActName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + sSelectedActIndex]);
|
||||
actNameX = SCREEN_WIDTH / 2 - moon_get_text_width(selectedActName, 0.8f, 0) / 2;
|
||||
moon_draw_text(actNameX, 147, selectedActName, 0.8f);
|
||||
moon_draw_text(actNameX, 160, selectedActName, 0.8f);
|
||||
}
|
||||
|
||||
// Print the numbers above each star.
|
||||
for (i = 1; i <= sVisibleStars; i++) {
|
||||
starNumbers[0] = i;
|
||||
moon_draw_text(i * 35 - sVisibleStars * 17 + 139, 190, starNumbers, 0.8f);
|
||||
moon_draw_text(i * 35 - sVisibleStars * 17 + 139, 203, starNumbers, 0.8f);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
|
||||
|
|
|
@ -54,7 +54,6 @@ namespace Moon {
|
|||
if(std::count(allowedTextures.begin(), allowedTextures.end(), string(get_filename_ext(bit->icon.c_str())))){
|
||||
TextureFileEntry *entry = new TextureFileEntry();
|
||||
file.read(bit->icon, entry);
|
||||
cout << "Found icon " << bit->icon << std::endl;
|
||||
Moon::saveAddonTexture(bit, "mod-icons://"+bit->name, entry);
|
||||
}
|
||||
if(!string(get_filename_ext(bit->icon.c_str())).compare("json")){
|
||||
|
@ -143,5 +142,9 @@ namespace MoonInternal {
|
|||
MoonInternal::buildTextureCache(order);
|
||||
return;
|
||||
}
|
||||
if(state == "Exit"){
|
||||
Moon::addons.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -170,7 +170,10 @@ namespace MoonInternal {
|
|||
}
|
||||
// TODO: Implement garbage collector
|
||||
if(state == "Exit"){
|
||||
|
||||
textureMods.clear();
|
||||
for(auto &addon : Moon::addons){
|
||||
addon->textures.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,10 @@ void AnimatedModifier::onLoad(std::string texture, json data){
|
|||
}
|
||||
}
|
||||
|
||||
void AnimatedModifier::onRelease(){
|
||||
textures.clear();
|
||||
}
|
||||
|
||||
std::string AnimatedModifier::getKey(){
|
||||
return "animated";
|
||||
}
|
|
@ -8,7 +8,7 @@ class TextureModifier {
|
|||
public:
|
||||
virtual void onInit() = 0;
|
||||
virtual void onLoad(std::string texture, nlohmann::json data) = 0;
|
||||
// virtual void onRelease() = 0;
|
||||
virtual void onRelease() = 0;
|
||||
virtual std::string getKey() = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -89,9 +89,12 @@ namespace Moon {
|
|||
|
||||
wstring base;
|
||||
|
||||
int lId = 0;
|
||||
for (WValue& line : dialog[L"lines"].GetArray()){
|
||||
base += line.GetString();
|
||||
base += L"\n";
|
||||
if(lId < dialog[L"lines"].Size() - 1)
|
||||
base += L"\n";
|
||||
lId++;
|
||||
}
|
||||
|
||||
entry->str = getTranslatedText(narrow(base).c_str());
|
||||
|
|
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#include "game/game_init.h"
|
||||
#include "gfx_dimensions.h"
|
||||
#include "game/mario_misc.h"
|
||||
#include "audio/external.h"
|
||||
}
|
||||
|
||||
void MoonScreen::Init(){
|
||||
|
|
|
@ -31,7 +31,6 @@ void MoonInitUI() {
|
|||
}
|
||||
|
||||
void MoonDrawUI() {
|
||||
MoonUpdateStatus();
|
||||
screens[currentScreen]->Update();
|
||||
screens[currentScreen]->Draw();
|
||||
}
|
||||
|
@ -56,7 +55,7 @@ void MoonHandleToggle(){
|
|||
if(gPlayer1Controller->buttonPressed & toggle){
|
||||
currentScreen = 0;
|
||||
isOpen = !isOpen;
|
||||
if(isOpen) isRunning = false;
|
||||
MoonUpdateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ extern "C" {
|
|||
#include "sm64.h"
|
||||
#include "gfx_dimensions.h"
|
||||
#include "pc/configfile.h"
|
||||
#include "audio/external.h"
|
||||
}
|
||||
|
||||
vector<MoonCategory*> categories;
|
||||
|
@ -32,11 +33,13 @@ int categoryIndex = 0;
|
|||
void MoonOptMain::setCategory(int index){
|
||||
MoonCategory *cat = categories[index];
|
||||
this->widgets = cat->catOptions;
|
||||
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
|
||||
MoonScreen::Mount();
|
||||
}
|
||||
|
||||
void MoonOptMain::Init(){
|
||||
this->useMouseInstead = true;
|
||||
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
|
||||
}
|
||||
|
||||
void MoonOptMain::Mount(){
|
||||
|
@ -48,7 +51,6 @@ void MoonOptMain::Mount(){
|
|||
categories.push_back(new MVideoCategory());
|
||||
categories.push_back(new MAudioCategory());
|
||||
categories.push_back(new MCheatsCategory());
|
||||
// categories.push_back(new MTexturesCategory());
|
||||
this->setCategory(categoryIndex);
|
||||
MoonScreen::Mount();
|
||||
}
|
||||
|
@ -92,4 +94,9 @@ void MoonOptMain::Draw(){
|
|||
MoonDrawRectangle(25, 50, SCREEN_WIDTH - 50, GetScreenHeight() * 0.6, {0, 0, 0, 100}, true);
|
||||
|
||||
MoonScreen::Draw();
|
||||
}
|
||||
|
||||
void MoonOptMain::Dispose(){
|
||||
configfile_save(configfile_name());
|
||||
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
|
||||
}
|
|
@ -8,6 +8,7 @@ public:
|
|||
void Update();
|
||||
void Draw();
|
||||
void Mount();
|
||||
void Dispose();
|
||||
private:
|
||||
void setCategory(int index);
|
||||
};
|
||||
|
|
|
@ -138,7 +138,11 @@ void game_deinit(void) {
|
|||
controller_shutdown();
|
||||
audio_shutdown();
|
||||
gfx_shutdown();
|
||||
moon_setup("Exit");
|
||||
inited = false;
|
||||
#ifdef TARGET_SWITCH
|
||||
exitNX();
|
||||
#endif
|
||||
}
|
||||
|
||||
void game_exit(void) {
|
||||
|
@ -278,8 +282,5 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
parse_cli_opts(argc, argv);
|
||||
main_func(argv);
|
||||
#ifdef TARGET_SWITCH
|
||||
exitNX();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue