Set up Moon Edition for release

This commit is contained in:
Llennpie 2021-11-29 13:46:47 -05:00
parent dc24f25e76
commit e5a8640b25
97 changed files with 17915 additions and 131 deletions

View File

@ -727,6 +727,9 @@ ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GOD
DUMMY != mkdir -p $(ALL_DIRS)
# compressed segment generation
all:
if [ ! -d "$(ADDONS_PATH)saturn" ]; then cp -R $(ADDONS)/saturn $(ADDONS_PATH); fi
# PC Area
$(BUILD_DIR)/%.table: %.aiff
$(AIFF_EXTRACT_CODEBOOK) $< >$@

View File

@ -0,0 +1,24 @@
8107EC40 0000
8107EC42 BB00
8107EC38 0000
8107EC3A BB00
8107ECA0 7306
8107ECA2 0000
8107EC98 3903
8107EC9A 0000
8107EC88 FEC1
8107EC8A 7900
8107EC80 7F60
8107EC82 3C00
8107EC58 FFFF
8107EC5A FF00
8107EC50 7F7F
8107EC52 7F00
8107EC28 9CB0
8107EC2A BB00
8107EC68 390E
8107EC6A 0700
8107EC20 9CB0
8107EC22 BB00
8107EC70 721C
8107EC72 0E00

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
{
"bit": {
"name": "Saturn",
"authors": [
"Llennpie"
],
"description": "Main module for Saturn",
"version": 1.0,
"readOnly": true
}
}

View File

@ -69,9 +69,9 @@ namespace MoonInternal {
if(saveCache.find(fileIndex) == saveCache.end()){
#ifndef TARGET_SWITCH
string cwd = MoonInternal::getEnvironmentVar("MOON_UPATH");
string path = cwd.substr(0, cwd.find_last_of("/\\")) + "/moon64/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
string path = cwd.substr(0, cwd.find_last_of("/\\")) + "/SaturnME/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
#else
string path = "sdmc:/moon64/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
string path = "sdmc:/SaturnME/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
#endif
saveCache[fileIndex] = new MoonCFG(path, false);
#ifdef GAME_DEBUG
@ -205,9 +205,9 @@ namespace MoonInternal {
void eraseSaveFile( int fileIndex ){
#ifndef TARGET_SWITCH
string cwd = MoonInternal::getEnvironmentVar("MOON_UPATH");
string path = cwd.substr(0, cwd.find_last_of("/\\")) + "/moon64/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
string path = cwd.substr(0, cwd.find_last_of("/\\")) + "/SaturnME/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
#else
string path = "sdmc:/moon64/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
string path = "sdmc:/SaturnME/Moon64-Save-"+to_string(fileIndex + 1)+".dat";
#endif
if(fs::exists(path))
fs::remove(path);
@ -218,7 +218,7 @@ namespace MoonInternal {
// Scan old save format
#ifndef TARGET_SWITCH
string cwd = MoonInternal::getEnvironmentVar("MOON_UPATH");
string path = cwd.substr(0, cwd.find_last_of("/\\")) + "/moon64/";
string path = cwd.substr(0, cwd.find_last_of("/\\")) + "/SaturnME/";
#else
string path = "sdmc:/";
#endif

View File

@ -127,4 +127,27 @@ void MoonFS::read(string file, EntryFileData *entry){
string MoonFS::getPath(){
return this->path;
}
void write_binary(string file, char *data, int size){
std::ofstream out(file, std::ios::out | std::ios::binary);
if(!out) return;
out.write(data, size);
out.close();
}
void MoonFS::extract(string dir){
if(this->type) return;
for(auto &path : this->entries()){
string file = FSUtils::joinPath(dir, path);
EntryFileData *entry;
this->read(path, entry = new EntryFileData());
if(!entry->size && !fs::exists(file)){
fs::create_directories(file);
} else {
if(!fs::exists(file)) write_binary(file, entry->data, entry->size);
}
}
}

View File

@ -25,6 +25,7 @@ public:
std::wstring readWide(std::string file);
void read(std::string file, EntryFileData *entry);
std::string getPath();
void extract(std::string path);
void close();
protected:
std::string path;

View File

@ -176,6 +176,15 @@ namespace MoonInternal {
int selected_eye_item = 0;
int selected_emblem_item = 1;
int current_emblem_item = 1;
int selected_stache_item = 0;
int current_stache_item = 0;
int selected_button_item = 0;
int current_button_item = 0;
int selected_sideburn_item = 0;
int current_sideburn_item = 0;
int selected_sky_item = 0;
int current_sky_item = 0;
@ -273,6 +282,10 @@ namespace MoonInternal {
#ifdef TARGET_SWITCH
MoonNX::handleVirtualKeyboard("Init");
#endif
static char cc_gameshark[1024 * 16] = "";
apply_cc_from_editor();
strcpy(cc_gameshark, global_color_to_cc().c_str());
}});
Moon::registerHookListener({.hookName = WINDOW_API_HANDLE_EVENTS, .callback = [](HookCall call){
@ -340,12 +353,12 @@ namespace MoonInternal {
ImGui::Separator();
if (ImGui::BeginMenu("Tools")) {
ImGui::MenuItem("Toggle View (F1)", NULL, &show_menu_bar);
ImGui::MenuItem("Jabo Mode", NULL, &configImGui.n64Mode);
ImGui::MenuItem("Night Mode", NULL, &enable_night_skybox);
ImGui::MenuItem("Jabo Mode", NULL, &configImGui.jaboMode);
//ImGui::MenuItem("Night Mode", NULL, &enable_night_skybox);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("View")) {
ImGui::MenuItem("Stats", NULL, &configImGui.moon64);
ImGui::MenuItem("Stats", NULL, &configImGui.s_stats);
ImGui::MenuItem("Machinima", NULL, &configImGui.s_machinima);
ImGui::MenuItem("Quick Toggles", NULL, &configImGui.s_toggles);
ImGui::MenuItem("Appearance", NULL, &configImGui.s_appearance);
@ -390,11 +403,11 @@ namespace MoonInternal {
}
}
configWindow.internal_w = (configImGui.n64Mode && !show_menu_bar) ? SM64_WIDTH : size.x;
configWindow.internal_h = (configImGui.n64Mode && !show_menu_bar) ? SM64_HEIGHT : size.y;
configWindow.internal_w = (configImGui.jaboMode && !show_menu_bar) ? SM64_WIDTH : size.x;
configWindow.internal_h = (configImGui.jaboMode && !show_menu_bar) ? SM64_HEIGHT : size.y;
/*
if(configImGui.n64Mode) {
if(configImGui.jaboMode) {
configWindow.multiplier = (float)n64Mul;
int sw = size.y * SM64_WIDTH / SM64_HEIGHT;
pos = ImVec2(size.x / 2 - sw / 2, 0);
@ -406,7 +419,7 @@ namespace MoonInternal {
ImGui::ImageRotated((ImTextureID) fbuf, pos, size, 180.0f);
ImGui::End();
if (configImGui.moon64 && show_menu_bar){
if (configImGui.s_stats && show_menu_bar){
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::Begin("Stats", NULL, ImGuiWindowFlags_None);
@ -421,37 +434,37 @@ namespace MoonInternal {
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::Begin("Quick Toggles", NULL, ImGuiWindowFlags_None);
ImGui::Dummy(ImVec2(0, 5));
ImGui::Checkbox("HUD", &configHUD);
ImGui::Checkbox("Head Rotations", &enable_head_rotations);
if (ImGui::CollapsingHeader("Mario")) {
ImGui::Checkbox("Head Rotations", &enable_head_rotations);
ImGui::Checkbox("M Cap Logo", &enable_cap_logo);
ImGui::Checkbox("M Overall Buttons", &enable_overall_buttons);
const char* capStates[] = { "Cap On", "Cap Off", "Wing Cap" }; // unused "wing cap off" not included
ImGui::Combo("Cap", &current_cap_state, capStates, IM_ARRAYSIZE(capStates));
const char* handStates[] = { "Fists", "Open", "Peace", "With Cap", "With Wing Cap", "Right Open" };
ImGui::Combo("Hands", &current_hand_state, handStates, IM_ARRAYSIZE(handStates));
ImGui::Checkbox("Dust Particles", &enable_dust_particles);
ImGui::Dummy(ImVec2(0, 5));
}
const char* capStates[] = { "Cap On", "Cap Off", "Wing Cap" }; // unused "wing cap off" not included
ImGui::Combo("Cap", &current_cap_state, capStates, IM_ARRAYSIZE(capStates));
const char* handStates[] = { "Fists", "Open", "Peace", "With Cap", "With Wing Cap", "Right Open" };
ImGui::Combo("Hands", &current_hand_state, handStates, IM_ARRAYSIZE(handStates));
ImGui::Dummy(ImVec2(0, 5));
ImGui::Checkbox("Dust Particles", &enable_dust_particles);
ImGui::Checkbox("Shadows", &enable_shadows);
ImGui::Dummy(ImVec2(0, 5));
/*
const char* skyStates[] = { "Default", "Night", "Green", "Blue", "Pink"};
ImGui::Combo("Skybox", &selected_sky_item, skyStates, IM_ARRAYSIZE(skyStates));
if (selected_sky_item != current_sky_item) {
current_sky_item = selected_sky_item;
if (selected_sky_item == 0) custom_sky_name = "default";
if (selected_sky_item == 1) custom_sky_name = "skyboxes/night";
if (selected_sky_item == 2) custom_sky_name = "skyboxes/green";
if (selected_sky_item == 3) custom_sky_name = "skyboxes/blue";
if (selected_sky_item == 4) custom_sky_name = "skyboxes/pink";
if (selected_sky_item == 1) custom_sky_name = "saturn/skyboxes/night";
if (selected_sky_item == 2) custom_sky_name = "saturn/skyboxes/green";
if (selected_sky_item == 3) custom_sky_name = "saturn/skyboxes/blue";
if (selected_sky_item == 4) custom_sky_name = "saturn/skyboxes/pink";
saturn_sky_swap();
}
//ImGui::Checkbox("Night Mode", &enable_night_skybox);
ImGui::Dummy(ImVec2(0, 5));
*/
ImGui::End();
ImGui::PopStyleColor();
@ -470,51 +483,6 @@ namespace MoonInternal {
ImGui::Dummy(ImVec2(0, 10));
ImGui::Text("Eye State");
const char* eyeStates[] = { "Default", "Open", "Half", "Closed", "Custom...", "Dead" };
ImGui::Combo("Eyes", &selected_eye_item, eyeStates, IM_ARRAYSIZE(eyeStates));
if (selected_eye_item == 0) current_eye_state = 0;
if (selected_eye_item == 1) current_eye_state = 1;
if (selected_eye_item == 2) current_eye_state = 2;
if (selected_eye_item == 3) current_eye_state = 3;
if (selected_eye_item == 5) current_eye_state = 8; // dead
if (selected_eye_item == 4) {
/*
SATURN: Moon Edition uses the unused "Left" eye state for custom textures.
If you are a model author, you must manually add the switch option to your model.
You can do this in Fast64 by navigating to 000-switch.001's bone and adding a material override under Switch Option 3.
Switch Option 7 is the "Dead" eye state.
*/
current_eye_state = 4;
static int current_eye_id = 0;
string eye_name = eye_array[current_eye_id];
if (ImGui::BeginCombo(".png", eye_name.c_str()))
{
for (int o = 0; o < eye_array.size(); o++)
{
const bool is_eye_selected = (current_eye_id == o);
eye_name = eye_array[o];
if (ImGui::Selectable(eye_name.c_str(), is_eye_selected)) {
current_eye_id = o;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_eye_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Set Eyes")) {
custom_eye_name = "eyes/" + eye_array[current_eye_id];
saturn_eye_swap();
}
}
ImGui::Dummy(ImVec2(0, 10));
ImGui::Text("Select Color Code");
static int current_cc_id = 0;
string cc_name = MoonInternal::cc_array[current_cc_id].substr(0, MoonInternal::cc_array[current_cc_id].size() - 3);
@ -560,6 +528,235 @@ namespace MoonInternal {
strcpy(cc_gameshark, global_color_to_cc().c_str());
}
ImGui::Dummy(ImVec2(0, 10));
ImGui::Text("Eye State");
const char* eyeStates[] = { "Default", "Custom...", "Open", "Half", "Closed", "Dead" };
ImGui::Combo("Eyes", &selected_eye_item, eyeStates, IM_ARRAYSIZE(eyeStates));
if (selected_eye_item == 0) current_eye_state = 0;
if (selected_eye_item == 1 && eye_array.size() > 0) {
/*
SATURN: Moon Edition uses the unused "Left" eye state for custom textures.
If you are a model author, you must manually add the switch option to your model.
You can do this in Fast64 by navigating to 000-switch.001's bone and adding a material override under Switch Option 3.
Switch Option 7 is the "Dead" eye state.
*/
current_eye_state = 4;
static int current_eye_id = 0;
string eye_name = eye_array[current_eye_id];
if (ImGui::BeginCombo(".png ###eye", eye_name.c_str()))
{
for (int o = 0; o < eye_array.size(); o++)
{
const bool is_eye_selected = (current_eye_id == o);
eye_name = eye_array[o];
if (ImGui::Selectable(eye_name.c_str(), is_eye_selected)) {
current_eye_id = o;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_eye_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Set Eyes")) {
custom_eye_name = "saturn/eyes/" + eye_array[current_eye_id];
saturn_eye_swap();
}
}
if (selected_eye_item == 2) current_eye_state = 1;
if (selected_eye_item == 3) current_eye_state = 2;
if (selected_eye_item == 4) current_eye_state = 3;
if (selected_eye_item == 5) current_eye_state = 8; // dead eyes
ImGui::Dummy(ImVec2(0, 5));
if (ImGui::CollapsingHeader("Mario")) {
const char* emblemStates[] = { "Default", "None", "Custom..." };
ImGui::Combo("Emblem", &selected_emblem_item, emblemStates, IM_ARRAYSIZE(emblemStates));
if (selected_emblem_item == 0 && current_emblem_item != 0) {
current_emblem_item = 0;
custom_emblem_name = "default";
saturn_emblem_swap();
} else if (selected_emblem_item == 1 && current_emblem_item != 1) {
current_emblem_item = 1;
custom_emblem_name = "saturn/blank";
saturn_emblem_swap();
}
else if (selected_emblem_item == 2 && emblem_array.size() > 0) {
static int current_emblem_id = 0;
// Only do this once
if (current_emblem_item != 2) {
current_emblem_item = 2;
custom_emblem_name = "emblems/" + emblem_array[current_emblem_id];
saturn_emblem_swap();
}
string emblem_name = emblem_array[current_emblem_id];
if (ImGui::BeginCombo(".png ###emblem", emblem_name.c_str()))
{
for (int o = 0; o < emblem_array.size(); o++)
{
const bool is_emblem_selected = (current_emblem_id == o);
emblem_name = emblem_array[o];
if (ImGui::Selectable(emblem_name.c_str(), is_emblem_selected)) {
current_emblem_id = o;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_emblem_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Set Emblem")) {
custom_emblem_name = "emblems/" + emblem_array[current_emblem_id];
saturn_emblem_swap();
}
ImGui::Dummy(ImVec2(0, 5));
}
const char* stacheStates[] = { "Default", "None", "Custom..." };
ImGui::Combo("Stache", &selected_stache_item, stacheStates, IM_ARRAYSIZE(stacheStates));
if (selected_stache_item == 0 && current_stache_item != 0) {
current_stache_item = 0;
custom_stache_name = "default";
saturn_stache_swap();
} else if (selected_stache_item == 1 && current_stache_item != 1) {
current_stache_item = 1;
custom_stache_name = "saturn/blank";
saturn_stache_swap();
}
else if (selected_stache_item == 2 && stache_array.size() > 0) {
static int current_stache_id = 0;
// Only do this once
if (current_stache_item != 2) {
current_stache_item = 2;
custom_stache_name = "staches/" + stache_array[current_stache_id];
saturn_stache_swap();
}
string stache_name = stache_array[current_stache_id];
if (ImGui::BeginCombo(".png ###stache", stache_name.c_str()))
{
for (int o = 0; o < stache_array.size(); o++)
{
const bool is_stache_selected = (current_stache_id == o);
stache_name = stache_array[o];
if (ImGui::Selectable(stache_name.c_str(), is_stache_selected)) {
current_stache_id = o;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_stache_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Set Stache")) {
custom_stache_name = "staches/" + stache_array[current_stache_id];
saturn_stache_swap();
}
ImGui::Dummy(ImVec2(0, 5));
}
const char* buttonStates[] = { "Default", "None", "Custom..." };
ImGui::Combo("Buttons", &selected_button_item, buttonStates, IM_ARRAYSIZE(buttonStates));
if (selected_button_item == 0 && current_button_item != 0) {
current_button_item = 0;
custom_button_name = "default";
saturn_button_swap();
} else if (selected_button_item == 1 && current_button_item != 1) {
current_button_item = 1;
custom_button_name = "saturn/blank";
saturn_button_swap();
}
else if (selected_button_item == 2 && button_array.size() > 0) {
static int current_button_id = 0;
// Only do this once
if (current_button_item != 2) {
current_button_item = 2;
custom_button_name = "buttons/" + button_array[current_button_id];
saturn_button_swap();
}
string button_name = button_array[current_button_id];
if (ImGui::BeginCombo(".png ###button", button_name.c_str()))
{
for (int o = 0; o < button_array.size(); o++)
{
const bool is_button_selected = (current_button_id == o);
button_name = button_array[o];
if (ImGui::Selectable(button_name.c_str(), is_button_selected)) {
current_button_id = o;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_button_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Set Buttons")) {
custom_button_name = "buttons/" + button_array[current_button_id];
saturn_button_swap();
}
ImGui::Dummy(ImVec2(0, 5));
}
const char* sideburnStates[] = { "Default", "None", "Custom..." };
ImGui::Combo("Sideburns", &selected_sideburn_item, sideburnStates, IM_ARRAYSIZE(sideburnStates));
if (selected_sideburn_item == 0 && current_sideburn_item != 0) {
current_sideburn_item = 0;
custom_sideburn_name = "default";
saturn_sideburn_swap();
} else if (selected_sideburn_item == 1 && current_sideburn_item != 1) {
current_sideburn_item = 1;
custom_sideburn_name = "saturn/blank";
saturn_sideburn_swap();
}
else if (selected_sideburn_item == 2 && sideburn_array.size() > 0) {
static int current_sideburn_id = 0;
// Only do this once
if (current_sideburn_item != 2) {
current_sideburn_item = 2;
custom_sideburn_name = "sideburns/" + sideburn_array[current_sideburn_id];
saturn_sideburn_swap();
}
string sideburn_name = sideburn_array[current_sideburn_id];
if (ImGui::BeginCombo(".png ###sideburn", sideburn_name.c_str()))
{
for (int o = 0; o < sideburn_array.size(); o++)
{
const bool is_sideburn_selected = (current_sideburn_id == o);
sideburn_name = sideburn_array[o];
if (ImGui::Selectable(sideburn_name.c_str(), is_sideburn_selected)) {
current_sideburn_id = o;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_sideburn_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Set Sideburns")) {
custom_sideburn_name = "sideburns/" + sideburn_array[current_sideburn_id];
saturn_sideburn_swap();
}
ImGui::Dummy(ImVec2(0, 5));
}
}
ImGui::End();
ImGui::PopStyleColor();
}
@ -676,7 +873,7 @@ namespace MoonInternal {
ImGui::Checkbox("VSync", &configWindow.vsync);
ImGui::Text("Internal Multiplier");
ImGui::SliderFloat("###internal_multiplier", &configWindow.multiplier, 1.0f, 4.0f);
ImGui::Checkbox("Jabo Mode", &configImGui.n64Mode);
ImGui::Checkbox("Jabo Mode", &configImGui.jaboMode);
ImGui::SameLine(); HelpMarker(
"Mimics Project64's widescreen stretching");
ImGui::Text("Graphics Quality");

View File

@ -5382,6 +5382,7 @@ class zip_file
for(auto &member : members)
{
extract(member, path);
printf(member.c_str());
}
}

View File

@ -10,8 +10,7 @@
#include <iomanip>
#include "moon/fs/moonfs.h"
#include "moon/libs/nlohmann/json.hpp"
using json = nlohmann::json;
using namespace std;
#include <filesystem>
#include "moon/config/mooncfg.h"
#include "moon/config/saves/saves.h"
#include "moon/mod-engine/audio/mod-audio.h"
@ -28,6 +27,10 @@ extern "C" {
#include "pc/configfile.h"
}
using namespace std;
using json = nlohmann::json;
namespace fs = std::filesystem;
namespace Moon {
vector<BitModule*> addons;
@ -158,7 +161,14 @@ namespace Moon {
}
namespace MoonInternal {
void scanAddonsDirectory() {
void processCompressedAddon(string path, string outdir){
MoonFS file(path);
file.open();
file.extract(outdir);
}
void scanAddonsDirectory() {
string cwd = MoonInternal::getEnvironmentVar("MOON_CWD");
string addonsDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/";
@ -168,7 +178,15 @@ namespace MoonInternal {
while ((de = readdir(dir)) != NULL) {
if (de->d_name[0] != '.') {
string file = addonsDir + de->d_name;
Moon::loadAddon(file);
string ext = file.substr(file.find_last_of(".") + 1);
if(ext == "bit" || ext == "zip"){
string path = file.substr(0, file.find_last_of("."));
processCompressedAddon(file, path);
Moon::loadAddon(path);
fs::remove(file);
} else {
Moon::loadAddon(file);
}
}
}
closedir(dir);

View File

@ -36,15 +36,11 @@ bool enable_dust_particles;
bool show_menu_bar;
float camera_speed = 0.8f;
bool enable_cap_logo;
bool enable_overall_buttons;
bool enable_night_skybox;
bool enable_yoshi;
// Second Check
bool has_changed_cap_logo;
bool has_changed_overall_buttons;
bool has_changed_night_skybox;
bool has_changed_yoshi;
@ -70,8 +66,6 @@ namespace MoonInternal {
camera_frozen = false;
enable_shadows = true;
enable_cap_logo = true;
enable_overall_buttons = true;
enable_yoshi = false;
MoonInternal::load_cc_directory();
@ -79,10 +73,15 @@ namespace MoonInternal {
// custom textures
current_eye_state = 0;
saturn_load_eye_array();
custom_eye_name = "eyes/" + eye_array[0];
custom_eye_name = "saturn/eyes/" + eye_array[0];
saturn_eye_swap();
saturn_toggle_m_cap();
saturn_toggle_m_buttons();
saturn_load_emblem_array();
custom_emblem_name = "saturn/blank";
saturn_emblem_swap();
saturn_load_stache_array();
saturn_load_button_array();
saturn_load_sideburn_array();
}});
Moon::registerHookListener({.hookName = WINDOW_API_HANDLE_EVENTS, .callback = [&](HookCall call){
@ -140,23 +139,6 @@ namespace MoonInternal {
}
*/
// Custom Textures
if (enable_cap_logo && !has_changed_cap_logo) {
saturn_toggle_m_cap();
has_changed_cap_logo = true;
}
if (!enable_overall_buttons && has_changed_overall_buttons) {
saturn_toggle_m_buttons();
has_changed_overall_buttons = false;
}
/*
if (enable_night_skybox && !has_changed_night_skybox) {
saturn_toggle_night_skybox();
has_changed_night_skybox = true;
}
*/
// Yoshi
enableYoshi = (enable_yoshi) ? 1 : 0;

View File

@ -15,8 +15,6 @@ extern bool camera_frozen;
extern bool show_menu_bar;
extern float camera_speed;
extern bool enable_cap_logo;
extern bool enable_overall_buttons;
extern bool enable_night_skybox;
extern bool enable_yoshi;

View File

@ -138,8 +138,6 @@ namespace MoonInternal {
defaultColorHairGDark = 3;
defaultColorHairBLight = 0;
defaultColorHairBDark = 0;
enable_cap_logo = true;
}
void load_cc_data(string content) {
@ -246,8 +244,6 @@ namespace MoonInternal {
if (address == "07EC9A") {
defaultColorHairBDark = value1;
}
enable_cap_logo = false;
}
}

View File

@ -20,10 +20,22 @@ extern "C" {
}
string custom_eye_name;
string custom_emblem_name;
string custom_stache_name;
string custom_button_name;
string custom_sideburn_name;
string custom_sky_name;
std::vector<string> eye_array;
string eyeDir;
std::vector<string> emblem_array;
string emblemDir;
std::vector<string> stache_array;
string stacheDir;
std::vector<string> button_array;
string buttonDir;
std::vector<string> sideburn_array;
string sideburnDir;
// Textures
@ -35,16 +47,15 @@ void saturn_eye_swap() {
(*hookTexture) = const_cast<char*>(custom_eye_name.c_str());
}});
}
void saturn_load_eye_array() {
eye_array.clear();
string cwd = MoonInternal::getEnvironmentVar("MOON_CWD");
#ifdef __MINGW32__
// Windows moment
eyeDir = cwd.substr(0, cwd.find_last_of("/\\")) + "\\addons\\saturn\\assets\\graphics\\eyes\\";
eyeDir = cwd.substr(0, cwd.find_last_of("/\\")) + "\\addons\\saturn\\assets\\graphics\\saturn\\eyes\\";
#else
eyeDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/saturn/assets/graphics/eyes/";
eyeDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/saturn/assets/graphics/saturn/eyes/";
#endif
for (const auto & entry : fs::directory_iterator(eyeDir)) {
@ -54,33 +65,129 @@ void saturn_load_eye_array() {
}
}
void saturn_toggle_m_cap() {
void saturn_emblem_swap() {
Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) {
char* *hookTexture = reinterpret_cast<char**>(call.baseArgs["texture"]);
string texName = string(*hookTexture);
if(texName == "actors/mario/mario_logo.rgba16") {
if (enable_cap_logo) {
(*hookTexture) = const_cast<char*>("actors/mario/mario_logo.rgba16");
if (custom_emblem_name != "default") {
(*hookTexture) = const_cast<char*>(custom_emblem_name.c_str());
} else {
(*hookTexture) = const_cast<char*>("blank");
(*hookTexture) = const_cast<char*>("actors/mario/mario_logo.rgba16");
}
}
}});
}
void saturn_load_emblem_array() {
emblem_array.clear();
void saturn_toggle_m_buttons() {
string cwd = MoonInternal::getEnvironmentVar("MOON_CWD");
#ifdef __MINGW32__
// Windows moment
emblemDir = cwd.substr(0, cwd.find_last_of("/\\")) + "\\addons\\saturn\\assets\\graphics\\saturn\\emblems\\";
#else
emblemDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/saturn/assets/graphics/saturn/emblems/";
#endif
for (const auto & entry : fs::directory_iterator(emblemDir)) {
size_t last_index = entry.path().filename().u8string().find_last_of(".");
string stripped_name = entry.path().filename().u8string().substr(0, last_index);
emblem_array.push_back(stripped_name);
}
}
void saturn_stache_swap() {
Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) {
char* *hookTexture = reinterpret_cast<char**>(call.baseArgs["texture"]);
string texName = string(*hookTexture);
if(texName == "actors/mario/mario_mustache.rgba16") {
if (custom_stache_name != "default") {
(*hookTexture) = const_cast<char*>(custom_stache_name.c_str());
} else {
(*hookTexture) = const_cast<char*>("actors/mario/mario_mustache.rgba16");
}
}
}});
}
void saturn_load_stache_array() {
stache_array.clear();
string cwd = MoonInternal::getEnvironmentVar("MOON_CWD");
#ifdef __MINGW32__
// Windows moment
stacheDir = cwd.substr(0, cwd.find_last_of("/\\")) + "\\addons\\saturn\\assets\\graphics\\saturn\\staches\\";
#else
stacheDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/saturn/assets/graphics/saturn/staches/";
#endif
for (const auto & entry : fs::directory_iterator(stacheDir)) {
size_t last_index = entry.path().filename().u8string().find_last_of(".");
string stripped_name = entry.path().filename().u8string().substr(0, last_index);
stache_array.push_back(stripped_name);
}
}
void saturn_button_swap() {
Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) {
char* *hookTexture = reinterpret_cast<char**>(call.baseArgs["texture"]);
string texName = string(*hookTexture);
if(texName == "actors/mario/mario_overalls_button.rgba16") {
if (enable_overall_buttons) {
(*hookTexture) = const_cast<char*>("actors/mario/mario_overalls_button.rgba16");
if (custom_button_name != "default") {
(*hookTexture) = const_cast<char*>(custom_button_name.c_str());
} else {
(*hookTexture) = const_cast<char*>("blank");
(*hookTexture) = const_cast<char*>("actors/mario/mario_overalls_button.rgba16");
}
}
}});
}
void saturn_load_button_array() {
button_array.clear();
string cwd = MoonInternal::getEnvironmentVar("MOON_CWD");
#ifdef __MINGW32__
// Windows moment
buttonDir = cwd.substr(0, cwd.find_last_of("/\\")) + "\\addons\\saturn\\assets\\graphics\\saturn\\buttons\\";
#else
buttonDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/saturn/assets/graphics/saturn/buttons/";
#endif
for (const auto & entry : fs::directory_iterator(buttonDir)) {
size_t last_index = entry.path().filename().u8string().find_last_of(".");
string stripped_name = entry.path().filename().u8string().substr(0, last_index);
button_array.push_back(stripped_name);
}
}
void saturn_sideburn_swap() {
Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) {
char* *hookTexture = reinterpret_cast<char**>(call.baseArgs["texture"]);
string texName = string(*hookTexture);
if(texName == "actors/mario/mario_sideburn.rgba16") {
if (custom_sideburn_name != "default") {
(*hookTexture) = const_cast<char*>(custom_sideburn_name.c_str());
} else {
(*hookTexture) = const_cast<char*>("actors/mario/mario_sideburn.rgba16");
}
}
}});
}
void saturn_load_sideburn_array() {
sideburn_array.clear();
string cwd = MoonInternal::getEnvironmentVar("MOON_CWD");
#ifdef __MINGW32__
// Windows moment
sideburnDir = cwd.substr(0, cwd.find_last_of("/\\")) + "\\addons\\saturn\\assets\\graphics\\saturn\\sideburns\\";
#else
sideburnDir = cwd.substr(0, cwd.find_last_of("/\\")) + "/addons/saturn/assets/graphics/saturn/sideburns/";
#endif
for (const auto & entry : fs::directory_iterator(sideburnDir)) {
size_t last_index = entry.path().filename().u8string().find_last_of(".");
string stripped_name = entry.path().filename().u8string().substr(0, last_index);
sideburn_array.push_back(stripped_name);
}
}
void saturn_sky_swap() {
Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) {

View File

@ -5,12 +5,28 @@
#include <vector>
extern std::string custom_eye_name;
extern std::string custom_emblem_name;
extern std::string custom_stache_name;
extern std::string custom_button_name;
extern std::string custom_sideburn_name;
extern std::string custom_sky_name;
extern std::vector<std::string> eye_array;
extern std::vector<std::string> emblem_array;
extern std::vector<std::string> stache_array;
extern std::vector<std::string> button_array;
extern std::vector<std::string> sideburn_array;
void saturn_eye_swap(void);
void saturn_load_eye_array(void);
void saturn_emblem_swap(void);
void saturn_load_emblem_array(void);
void saturn_stache_swap(void);
void saturn_load_stache_array(void);
void saturn_button_swap(void);
void saturn_load_button_array(void);
void saturn_sideburn_swap(void);
void saturn_load_sideburn_array(void);
void saturn_toggle_m_cap(void);
void saturn_toggle_m_buttons(void);
void saturn_sky_swap(void);

View File

@ -56,13 +56,13 @@ ConfigWindow configWindow = {
};
ImGuiConfig configImGui = {
.moon64 = false,
.s_stats = false,
.texture_debug = false,
.s_toggles = false,
.s_machinima = false,
.s_appearance = false,
.s_options = false,
.n64Mode = false
.jaboMode = false
};
unsigned int configLanguage = 0;
@ -181,13 +181,13 @@ static const struct ConfigOption options[] = {
#endif
{.name = "lodMode", .type = CONFIG_TYPE_UINT, .uintValue = &configLODMode},
{.name = "moon64_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.moon64},
{.name = "s_stats_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_stats},
{.name = "texture_debug_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.texture_debug},
{.name = "s_toggles_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_toggles},
{.name = "s_machinima", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_machinima},
{.name = "s_appearance_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_appearance},
{.name = "s_options_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_options},
{.name = "n64Mode", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.n64Mode}
{.name = "jaboMode", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.jaboMode}
};
// Reads an entire line from a file (excluding the newline character) and returns an allocated string

View File

@ -22,13 +22,13 @@ typedef struct {
} ConfigWindow;
typedef struct {
bool moon64;
bool s_stats;
bool s_toggles;
bool s_machinima;
bool s_appearance;
bool s_options;
bool texture_debug;
bool n64Mode;
bool jaboMode;
} ImGuiConfig;
extern ConfigWindow configWindow;

View File

@ -118,7 +118,7 @@ const char *sys_user_path(void) {
static char path[SYS_MAX_PATH] = { 0 };
// get the new pref path from SDL
char *sdlpath = SDL_GetPrefPath("", "moon64");
char *sdlpath = SDL_GetPrefPath("", "SaturnME");
if (sdlpath) {
const unsigned int len = strlen(sdlpath);
strncpy(path, sdlpath, sizeof(path));