mirror of
https://github.com/Llennpie/Saturn.git
synced 2025-01-22 07:32:02 -05:00
Add color code system, cleaned up UI, disabled HUD by default
This commit is contained in:
parent
2453fa3be4
commit
40750b4647
16 changed files with 569 additions and 61 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -79,3 +79,7 @@ sm64config.txt
|
|||
!/sound/**/*custom*/**/*.aiff
|
||||
!/assets/**/*custom*.bin
|
||||
!/assets/**/*custom*/**/*.bin
|
||||
|
||||
# Saturn
|
||||
!/actors/mario/mario_logo.rgba16.png
|
||||
!/actors/mario_cap/mario_cap_logo.rgba16.png
|
1
Makefile
1
Makefile
|
@ -570,7 +570,6 @@ endif
|
|||
# Saturn Enable filesystem library and C++17
|
||||
CXXFLAGS := -std=c++17
|
||||
LDFLAGS += -lstdc++fs
|
||||
LDFLAGS += -lstdc++
|
||||
|
||||
CC_CHECK += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||
|
|
|
@ -5,9 +5,12 @@
|
|||
|
||||
#### Features
|
||||
|
||||
- New camera system
|
||||
- Live model loading
|
||||
- Not only allows color codes, but also custom textures AND/OR Fast64 models
|
||||
- New machinima camera system
|
||||
- Color code system
|
||||
- Uses the common *GameShark* format
|
||||
- Live model loading (via DynOS)
|
||||
- Uses Fast64 models
|
||||
- Works with color codes
|
||||
- Changeable eye states/textures
|
||||
- Completely rebindable controls
|
||||
- All controls in the game, including those used for machinima, are 100% configurable
|
||||
|
|
BIN
actors/mario/mario_logo.rgba16.png
Normal file
BIN
actors/mario/mario_logo.rgba16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
BIN
actors/mario_cap/mario_cap_logo.rgba16.png
Normal file
BIN
actors/mario_cap/mario_cap_logo.rgba16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
24
dynos/colorcodes/SMG4.gs
Normal file
24
dynos/colorcodes/SMG4.gs
Normal 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
|
|
@ -36,12 +36,13 @@ def asset_needs_update(asset, version):
|
|||
|
||||
|
||||
def remove_file(fname):
|
||||
os.remove(fname)
|
||||
print("deleting", fname)
|
||||
try:
|
||||
os.removedirs(os.path.dirname(fname))
|
||||
except OSError:
|
||||
pass
|
||||
if fname != "actors/mario/mario_logo.rgba16.png" and fname != "actors/mario_cap/mario_cap_logo.rgba16.png":
|
||||
os.remove(fname)
|
||||
print("deleting", fname)
|
||||
try:
|
||||
os.removedirs(os.path.dirname(fname))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def clean_assets(local_asset_file):
|
||||
|
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 260 KiB |
|
@ -89,7 +89,7 @@ bool configCameraAnalog = true;
|
|||
bool configCameraMouse = false;
|
||||
#endif
|
||||
bool configSkipIntro = 0;
|
||||
bool configHUD = true;
|
||||
bool configHUD = false;
|
||||
#ifdef DISCORDRPC
|
||||
bool configDiscordRPC = true;
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "../configfile.h"
|
||||
#include "../fs/fs.h"
|
||||
|
||||
#include "saturn/saturn_colors.h"
|
||||
|
||||
#define SUPPORT_CHECK(x) assert(x)
|
||||
|
||||
// SCALE_M_N: upscale/downscale M-bit integer to N-bit
|
||||
|
@ -777,6 +779,48 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti
|
|||
int r = rsp.current_lights[rsp.current_num_lights - 1].col[0];
|
||||
int g = rsp.current_lights[rsp.current_num_lights - 1].col[1];
|
||||
int b = rsp.current_lights[rsp.current_num_lights - 1].col[2];
|
||||
|
||||
// here at saturn we love mors and sm64plus
|
||||
|
||||
// Detect if these are one of Mario's colors
|
||||
bool mario_hat = (r == 0x7f && g == 0x00 && b == 0x00);
|
||||
bool mario_overalls = (r == 0x00 && g == 0x00 && b == 0x7f);
|
||||
bool mario_gloves = (r == 0x00 && g == 0x7f && b == 0x00);
|
||||
bool mario_shoes = (r == 0x39 && g == 0x0e && b == 0x07);
|
||||
bool mario_skin = (r == 0x7f && g == 0x60 && b == 0x3c);
|
||||
bool mario_hair = (r == 0x39 && g == 0x03 && b == 0x00);
|
||||
|
||||
// Override them lazily
|
||||
if (mario_hat) {
|
||||
r = defaultColorHatRDark;
|
||||
g = defaultColorHatGDark;
|
||||
b = defaultColorHatBDark;
|
||||
}
|
||||
if (mario_overalls) {
|
||||
r = defaultColorOverallsRDark;
|
||||
g = defaultColorOverallsGDark;
|
||||
b = defaultColorOverallsBDark;
|
||||
}
|
||||
if (mario_gloves) {
|
||||
r = defaultColorGlovesRDark;
|
||||
g = defaultColorGlovesGDark;
|
||||
b = defaultColorGlovesBDark;
|
||||
}
|
||||
if (mario_shoes) {
|
||||
r = defaultColorShoesRDark;
|
||||
g = defaultColorShoesGDark;
|
||||
b = defaultColorShoesBDark;
|
||||
}
|
||||
if (mario_skin) {
|
||||
r = defaultColorSkinRDark;
|
||||
g = defaultColorSkinGDark;
|
||||
b = defaultColorSkinBDark;
|
||||
}
|
||||
if (mario_hair) {
|
||||
r = defaultColorHairRDark;
|
||||
g = defaultColorHairGDark;
|
||||
b = defaultColorHairBDark;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rsp.current_num_lights - 1; i++) {
|
||||
float intensity = 0;
|
||||
|
@ -785,9 +829,47 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti
|
|||
intensity += vn->n[2] * rsp.current_lights_coeffs[i][2];
|
||||
intensity /= 127.0f;
|
||||
if (intensity > 0.0f) {
|
||||
r += intensity * rsp.current_lights[i].col[0];
|
||||
g += intensity * rsp.current_lights[i].col[1];
|
||||
b += intensity * rsp.current_lights[i].col[2];
|
||||
// Light colors
|
||||
int lightr = rsp.current_lights[i].col[0];
|
||||
int lightg = rsp.current_lights[i].col[1];
|
||||
int lightb = rsp.current_lights[i].col[2];
|
||||
|
||||
// Override these too
|
||||
if (mario_hat) {
|
||||
r += intensity * defaultColorHatRLight;
|
||||
g += intensity * defaultColorHatGLight;
|
||||
b += intensity * defaultColorHatBLight;
|
||||
}
|
||||
else if (mario_overalls) {
|
||||
r += intensity * defaultColorOverallsRLight;
|
||||
g += intensity * defaultColorOverallsGLight;
|
||||
b += intensity * defaultColorOverallsBLight;
|
||||
}
|
||||
else if (mario_gloves) {
|
||||
r += intensity * defaultColorGlovesRLight;
|
||||
g += intensity * defaultColorGlovesGLight;
|
||||
b += intensity * defaultColorGlovesBLight;
|
||||
}
|
||||
else if (mario_shoes) {
|
||||
r += intensity * defaultColorShoesRLight;
|
||||
g += intensity * defaultColorShoesGLight;
|
||||
b += intensity * defaultColorShoesBLight;
|
||||
}
|
||||
else if (mario_skin) {
|
||||
r += intensity * defaultColorSkinRLight;
|
||||
g += intensity * defaultColorSkinGLight;
|
||||
b += intensity * defaultColorSkinBLight;
|
||||
}
|
||||
else if (mario_hair) {
|
||||
r += intensity * defaultColorHairRLight;
|
||||
g += intensity * defaultColorHairGLight;
|
||||
b += intensity * defaultColorHairBLight;
|
||||
}
|
||||
else {
|
||||
r += intensity * lightr;
|
||||
g += intensity * lightg;
|
||||
b += intensity * lightb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "saturn/imgui/saturn_imgui_dynos.h"
|
||||
#include "saturn/imgui/saturn_imgui_machinima.h"
|
||||
#include "saturn/libs/imgui/imgui.h"
|
||||
#include "saturn/libs/imgui/imgui_internal.h"
|
||||
#include "saturn/libs/imgui/imgui_impl_sdl.h"
|
||||
#include "saturn/libs/imgui/imgui_impl_opengl3.h"
|
||||
#include "saturn/saturn.h"
|
||||
#include "saturn/saturn_animations.h"
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
@ -60,8 +60,6 @@ bool showWindowStats = false;
|
|||
bool showWindowMachinima = false;
|
||||
bool showWindowDynOS = false;
|
||||
|
||||
int anim_index = 113;
|
||||
|
||||
// Bundled Components
|
||||
|
||||
void imgui_bundled_tooltip(const char* text) {
|
||||
|
@ -121,6 +119,7 @@ void saturn_imgui_init(SDL_Window * sdl_window, SDL_GLContext ctx) {
|
|||
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||
|
||||
sdynos_imgui_init();
|
||||
smachinima_imgui_init();
|
||||
}
|
||||
|
||||
void saturn_imgui_handle_events(SDL_Event * event) {
|
||||
|
@ -192,42 +191,9 @@ void saturn_imgui_update() {
|
|||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
||||
ImGui::Begin("Machinima", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
|
||||
ImGui::SetWindowPos(ImVec2(10, 30));
|
||||
ImGui::SetWindowSize(ImVec2(250, 300));
|
||||
ImGui::Checkbox("Machinima Camera", &camera_frozen);
|
||||
imgui_bundled_tooltip("Toggles the machinima camera.");
|
||||
ImGui::SetWindowSize(ImVec2(250, 325));
|
||||
|
||||
if (camera_frozen == true) {
|
||||
ImGui::SliderFloat("Speed", &camVelSpeed, 0.0f, 2.0f);
|
||||
imgui_bundled_tooltip("Controls the speed of the machinima camera. Default is 1.");
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 5));
|
||||
ImGui::Text("Animations");
|
||||
ImGui::Dummy(ImVec2(0, 5));
|
||||
ImGui::Combo("", &anim_index, saturn_animations, IM_ARRAYSIZE(saturn_animations));
|
||||
selected_animation = (MarioAnimID)anim_index;
|
||||
if (ImGui::Button("Play")) {
|
||||
saturn_play_animation(selected_animation);
|
||||
}
|
||||
|
||||
imgui_bundled_space(20, "Quick Toggles");
|
||||
|
||||
if (ImGui::BeginTable("quick_toggles", 1))
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Checkbox("HUD", &configHUD);
|
||||
imgui_bundled_tooltip("Controls the in-game HUD visibility.");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Checkbox("Head Rotations", &enable_head_rotations);
|
||||
imgui_bundled_tooltip("Whether or not Mario's head rotates in his idle animation.");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Checkbox("Shadows", &enable_shadows);
|
||||
imgui_bundled_tooltip("Displays Mario's shadow.");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Checkbox("Dust Particles", &enable_dust_particles);
|
||||
imgui_bundled_tooltip("Displays dust particles when Mario moves.");
|
||||
ImGui::EndTable();
|
||||
}
|
||||
smachinima_imgui_update();
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor();
|
||||
|
@ -237,7 +203,7 @@ void saturn_imgui_update() {
|
|||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
||||
ImGui::Begin("DynOS", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
|
||||
ImGui::SetWindowPos(ImVec2(10, 30));
|
||||
ImGui::SetWindowSize(ImVec2(250, 250));
|
||||
ImGui::SetWindowSize(ImVec2(250, 300));
|
||||
|
||||
sdynos_imgui_update();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "saturn/libs/imgui/imgui_impl_sdl.h"
|
||||
#include "saturn/libs/imgui/imgui_impl_opengl3.h"
|
||||
#include "saturn/saturn.h"
|
||||
#include "saturn/saturn_colors.h"
|
||||
#include "saturn_imgui.h"
|
||||
#include "data/dynos.cpp.h"
|
||||
#include <SDL2/SDL.h>
|
||||
|
@ -27,19 +28,41 @@ using namespace std;
|
|||
|
||||
|
||||
void sdynos_imgui_init() {
|
||||
|
||||
load_cc_directory();
|
||||
}
|
||||
|
||||
void sdynos_imgui_update() {
|
||||
const char* eyes[] = { "Blinking", "Open", "Half", "Closed", "Left", "Right", "Up", "Down", "Dead" };
|
||||
ImGui::Combo("Eye State", &scrollEyeState, eyes, IM_ARRAYSIZE(eyes));
|
||||
const char* hands[] = { "Fists", "Open", "Peace", "With Cap", "With Wing Cap", "Right Open" };
|
||||
ImGui::Combo("Hand State", &scrollHandState, hands, IM_ARRAYSIZE(hands));
|
||||
const char* caps[] = { "Cap On", "Cap Off", "Wing Cap" }; // unused "wing cap off" not included
|
||||
ImGui::Combo("Cap State", &scrollCapState, caps, IM_ARRAYSIZE(caps));
|
||||
|
||||
if (cc_array.size() > 0) {
|
||||
ImGui::Text("Select Color Code");
|
||||
static int current_cc_id = 0;
|
||||
string cc_name = cc_array[current_cc_id].substr(0, cc_array[current_cc_id].size() - 3);
|
||||
if (ImGui::BeginCombo(".gs", cc_name.c_str()))
|
||||
{
|
||||
for (int n = 0; n < cc_array.size(); n++)
|
||||
{
|
||||
const bool is_selected = (current_cc_id == n);
|
||||
cc_name = cc_array[n].substr(0, cc_array[n].size() - 3);
|
||||
if (ImGui::Selectable(cc_name.c_str(), is_selected)) {
|
||||
current_cc_id = n;
|
||||
}
|
||||
|
||||
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||
if (is_selected)
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine(); imgui_bundled_help_marker("These are GameShark color codes, which overwrite Mario's lights. Place in dynos/colorcodes.");
|
||||
if (ImGui::Button("Load CC")) {
|
||||
load_cc_file((char*)cc_array[current_cc_id].c_str());
|
||||
}
|
||||
} else {
|
||||
ImGui::Text("Could not load color code directory...");
|
||||
}
|
||||
|
||||
imgui_bundled_space(20, "Model Packs","These are DynOS model packs, used for live model loading.\nPlace packs in dynos/packs.");
|
||||
if (ImGui::BeginListBox("", ImVec2(200, 100))) {
|
||||
if (ImGui::BeginListBox("", ImVec2(200, 150))) {
|
||||
for (int i = 0; i < sDynosPacks.Count(); i++) {
|
||||
u64 _DirSep1 = sDynosPacks[i]->mPath.find_last_of('\\');
|
||||
u64 _DirSep2 = sDynosPacks[i]->mPath.find_last_of('/');
|
||||
|
|
71
src/saturn/imgui/saturn_imgui_machinima.cpp
Normal file
71
src/saturn/imgui/saturn_imgui_machinima.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
#include "saturn_imgui_machinima.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "saturn/libs/imgui/imgui.h"
|
||||
#include "saturn/libs/imgui/imgui_internal.h"
|
||||
#include "saturn/libs/imgui/imgui_impl_sdl.h"
|
||||
#include "saturn/libs/imgui/imgui_impl_opengl3.h"
|
||||
#include "saturn/saturn.h"
|
||||
#include "saturn/saturn_animations.h"
|
||||
#include "saturn_imgui.h"
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
extern "C" {
|
||||
#include "pc/gfx/gfx_pc.h"
|
||||
#include "pc/configfile.h"
|
||||
#include "game/mario.h"
|
||||
#include "game/camera.h"
|
||||
#include "game/level_update.h"
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
|
||||
int anim_index = 113;
|
||||
|
||||
|
||||
|
||||
void smachinima_imgui_init() {
|
||||
|
||||
}
|
||||
|
||||
void smachinima_imgui_update() {
|
||||
ImGui::Checkbox("Machinima Camera", &camera_frozen);
|
||||
imgui_bundled_tooltip("Toggles the machinima camera.");
|
||||
|
||||
if (camera_frozen == true) {
|
||||
ImGui::SliderFloat("Speed", &camVelSpeed, 0.0f, 2.0f);
|
||||
imgui_bundled_tooltip("Controls the speed of the machinima camera. Default is 1.");
|
||||
}
|
||||
ImGui::Dummy(ImVec2(0, 5));
|
||||
|
||||
const char* eyes[] = { "Blinking", "Open", "Half", "Closed", "Left", "Right", "Up", "Down", "Dead" };
|
||||
ImGui::Combo("Eyes", &scrollEyeState, eyes, IM_ARRAYSIZE(eyes));
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 5));
|
||||
ImGui::Text("Animations");
|
||||
ImGui::Dummy(ImVec2(0, 5));
|
||||
ImGui::Combo("", &anim_index, saturn_animations, IM_ARRAYSIZE(saturn_animations));
|
||||
selected_animation = (MarioAnimID)anim_index;
|
||||
if (ImGui::Button("Play")) {
|
||||
saturn_play_animation(selected_animation);
|
||||
}
|
||||
|
||||
imgui_bundled_space(20, "Quick Toggles", NULL);
|
||||
|
||||
ImGui::Checkbox("HUD", &configHUD);
|
||||
imgui_bundled_tooltip("Controls the in-game HUD visibility.");
|
||||
if (ImGui::CollapsingHeader("Mario")) {
|
||||
ImGui::Checkbox("Head Rotations", &enable_head_rotations);
|
||||
imgui_bundled_tooltip("Whether or not Mario's head rotates in his idle animation.");
|
||||
const char* hands[] = { "Fists", "Open", "Peace", "With Cap", "With Wing Cap", "Right Open" };
|
||||
ImGui::Combo("Hand State", &scrollHandState, hands, IM_ARRAYSIZE(hands));
|
||||
const char* caps[] = { "Cap On", "Cap Off", "Wing Cap" }; // unused "wing cap off" not included
|
||||
ImGui::Combo("Cap State", &scrollCapState, caps, IM_ARRAYSIZE(caps));
|
||||
}
|
||||
ImGui::Checkbox("Shadows", &enable_shadows);
|
||||
imgui_bundled_tooltip("Displays Mario's shadow.");
|
||||
ImGui::Checkbox("Dust Particles", &enable_dust_particles);
|
||||
imgui_bundled_tooltip("Displays dust particles when Mario moves.");
|
||||
}
|
15
src/saturn/imgui/saturn_imgui_machinima.h
Normal file
15
src/saturn/imgui/saturn_imgui_machinima.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#ifndef SaturnImGuiMachinima
|
||||
#define SaturnImGuiMachinima
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void smachinima_imgui_init(void);
|
||||
void smachinima_imgui_update(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
257
src/saturn/saturn_colors.cpp
Normal file
257
src/saturn/saturn_colors.cpp
Normal file
|
@ -0,0 +1,257 @@
|
|||
#include "saturn/saturn_colors.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include "saturn/saturn.h"
|
||||
#include "saturn/imgui/saturn_imgui.h"
|
||||
|
||||
extern "C" {
|
||||
#include "game/camera.h"
|
||||
#include "game/level_update.h"
|
||||
#include "sm64.h"
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
#include <dirent.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
namespace fs = std::filesystem;
|
||||
#include "pc/fs/fs.h"
|
||||
|
||||
unsigned int defaultColorHatRLight = 255;
|
||||
unsigned int defaultColorHatRDark = 127;
|
||||
unsigned int defaultColorHatGLight = 0;
|
||||
unsigned int defaultColorHatGDark = 0;
|
||||
unsigned int defaultColorHatBLight = 0;
|
||||
unsigned int defaultColorHatBDark = 0;
|
||||
|
||||
unsigned int defaultColorOverallsRLight = 0;
|
||||
unsigned int defaultColorOverallsRDark = 0;
|
||||
unsigned int defaultColorOverallsGLight = 0;
|
||||
unsigned int defaultColorOverallsGDark = 0;
|
||||
unsigned int defaultColorOverallsBLight = 255;
|
||||
unsigned int defaultColorOverallsBDark = 127;
|
||||
|
||||
unsigned int defaultColorGlovesRLight = 255;
|
||||
unsigned int defaultColorGlovesRDark = 127;
|
||||
unsigned int defaultColorGlovesGLight = 255;
|
||||
unsigned int defaultColorGlovesGDark = 127;
|
||||
unsigned int defaultColorGlovesBLight = 255;
|
||||
unsigned int defaultColorGlovesBDark = 127;
|
||||
|
||||
unsigned int defaultColorShoesRLight = 114;
|
||||
unsigned int defaultColorShoesRDark = 57;
|
||||
unsigned int defaultColorShoesGLight = 28;
|
||||
unsigned int defaultColorShoesGDark = 14;
|
||||
unsigned int defaultColorShoesBLight = 14;
|
||||
unsigned int defaultColorShoesBDark = 7;
|
||||
|
||||
unsigned int defaultColorSkinRLight = 254;
|
||||
unsigned int defaultColorSkinRDark = 127;
|
||||
unsigned int defaultColorSkinGLight = 193;
|
||||
unsigned int defaultColorSkinGDark = 96;
|
||||
unsigned int defaultColorSkinBLight = 121;
|
||||
unsigned int defaultColorSkinBDark = 60;
|
||||
|
||||
unsigned int defaultColorHairRLight = 115;
|
||||
unsigned int defaultColorHairRDark = 57;
|
||||
unsigned int defaultColorHairGLight = 6;
|
||||
unsigned int defaultColorHairGDark = 3;
|
||||
unsigned int defaultColorHairBLight = 0;
|
||||
unsigned int defaultColorHairBDark = 0;
|
||||
|
||||
// Color Codes
|
||||
|
||||
std::vector<string> cc_array;
|
||||
string colorCodeDir;
|
||||
|
||||
void load_cc_directory() {
|
||||
cc_array.clear();
|
||||
cc_array.push_back("Mario.gs");
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// windows moment
|
||||
colorCodeDir = "dynos\\colorcodes\\";
|
||||
#else
|
||||
colorCodeDir = "dynos/colorcodes/";
|
||||
#endif
|
||||
|
||||
for (const auto & entry : fs::directory_iterator(colorCodeDir))
|
||||
cc_array.push_back(entry.path().filename().u8string());
|
||||
}
|
||||
|
||||
void reset_cc_colors() {
|
||||
defaultColorHatRLight = 255;
|
||||
defaultColorHatRDark = 127;
|
||||
defaultColorHatGLight = 0;
|
||||
defaultColorHatGDark = 0;
|
||||
defaultColorHatBLight = 0;
|
||||
defaultColorHatBDark = 0;
|
||||
|
||||
defaultColorOverallsRLight = 0;
|
||||
defaultColorOverallsRDark = 0;
|
||||
defaultColorOverallsGLight = 0;
|
||||
defaultColorOverallsGDark = 0;
|
||||
defaultColorOverallsBLight = 255;
|
||||
defaultColorOverallsBDark = 127;
|
||||
|
||||
defaultColorGlovesRLight = 255;
|
||||
defaultColorGlovesRDark = 127;
|
||||
defaultColorGlovesGLight = 255;
|
||||
defaultColorGlovesGDark = 127;
|
||||
defaultColorGlovesBLight = 255;
|
||||
defaultColorGlovesBDark = 127;
|
||||
|
||||
defaultColorShoesRLight = 114;
|
||||
defaultColorShoesRDark = 57;
|
||||
defaultColorShoesGLight = 28;
|
||||
defaultColorShoesGDark = 14;
|
||||
defaultColorShoesBLight = 14;
|
||||
defaultColorShoesBDark = 7;
|
||||
|
||||
defaultColorSkinRLight = 254;
|
||||
defaultColorSkinRDark = 127;
|
||||
defaultColorSkinGLight = 193;
|
||||
defaultColorSkinGDark = 96;
|
||||
defaultColorSkinBLight = 121;
|
||||
defaultColorSkinBDark = 60;
|
||||
|
||||
defaultColorHairRLight = 115;
|
||||
defaultColorHairRDark = 57;
|
||||
defaultColorHairGLight = 6;
|
||||
defaultColorHairGDark = 3;
|
||||
defaultColorHairBLight = 0;
|
||||
defaultColorHairBDark = 0;
|
||||
}
|
||||
|
||||
void load_cc_file(char* cc_char_filename) {
|
||||
string cc_filename = cc_char_filename;
|
||||
if (cc_filename == "Mario.gs") {
|
||||
reset_cc_colors();
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream file(colorCodeDir + cc_filename, std::ios::in | std::ios::binary);
|
||||
|
||||
// If the color code was previously deleted, reload the list and cancel.
|
||||
if (!file.good()) {
|
||||
load_cc_directory();
|
||||
return;
|
||||
}
|
||||
|
||||
const std::size_t& size = std::filesystem::file_size(colorCodeDir + cc_filename);
|
||||
std::string content(size, '\0');
|
||||
file.read(content.data(), size);
|
||||
|
||||
file.close();
|
||||
|
||||
std::istringstream f(content);
|
||||
std::string line;
|
||||
|
||||
while (std::getline(f, line)) {
|
||||
std::string address = line.substr(2, 6);
|
||||
int value1 = std::stoi(line.substr(9, 2), 0, 16);
|
||||
int value2 = std::stoi(line.substr(11, 2), 0, 16);
|
||||
|
||||
// Hat
|
||||
if (address == "07EC40") {
|
||||
defaultColorHatRLight = value1;
|
||||
defaultColorHatGLight = value2;
|
||||
}
|
||||
if (address == "07EC42") {
|
||||
defaultColorHatBLight = value1;
|
||||
}
|
||||
if (address == "07EC38") {
|
||||
defaultColorHatRDark = value1;
|
||||
defaultColorHatGDark = value2;
|
||||
}
|
||||
if (address == "07EC3A") {
|
||||
defaultColorHatBDark = value1;
|
||||
}
|
||||
|
||||
// Overalls
|
||||
if (address == "07EC28") {
|
||||
defaultColorOverallsRLight = value1;
|
||||
defaultColorOverallsGLight = value2;
|
||||
}
|
||||
if (address == "07EC2A") {
|
||||
defaultColorOverallsBLight = value1;
|
||||
}
|
||||
if (address == "07EC20") {
|
||||
defaultColorOverallsRDark = value1;
|
||||
defaultColorOverallsGDark = value2;
|
||||
}
|
||||
if (address == "07EC22") {
|
||||
defaultColorOverallsBDark = value1;
|
||||
}
|
||||
|
||||
// Gloves
|
||||
if (address == "07EC58") {
|
||||
defaultColorGlovesRLight = value1;
|
||||
defaultColorGlovesGLight = value2;
|
||||
}
|
||||
if (address == "07EC5A") {
|
||||
defaultColorGlovesBLight = value1;
|
||||
}
|
||||
if (address == "07EC50") {
|
||||
defaultColorGlovesRDark = value1;
|
||||
defaultColorGlovesGDark = value2;
|
||||
}
|
||||
if (address == "07EC52") {
|
||||
defaultColorGlovesBDark = value1;
|
||||
}
|
||||
|
||||
// Shoes
|
||||
if (address == "07EC70") {
|
||||
defaultColorShoesRLight = value1;
|
||||
defaultColorShoesGLight = value2;
|
||||
}
|
||||
if (address == "07EC72") {
|
||||
defaultColorShoesBLight = value1;
|
||||
}
|
||||
if (address == "07EC68") {
|
||||
defaultColorShoesRDark = value1;
|
||||
defaultColorShoesGDark = value2;
|
||||
}
|
||||
if (address == "07EC6A") {
|
||||
defaultColorShoesBDark = value1;
|
||||
}
|
||||
|
||||
// Skin
|
||||
if (address == "07EC88") {
|
||||
defaultColorSkinRLight = value1;
|
||||
defaultColorSkinGLight = value2;
|
||||
}
|
||||
if (address == "07EC8A") {
|
||||
defaultColorSkinBLight = value1;
|
||||
}
|
||||
if (address == "07EC80") {
|
||||
defaultColorSkinRDark = value1;
|
||||
defaultColorSkinGDark = value2;
|
||||
}
|
||||
if (address == "07EC82") {
|
||||
defaultColorSkinBDark = value1;
|
||||
}
|
||||
|
||||
// Hair
|
||||
if (address == "07ECA0") {
|
||||
defaultColorHairRLight = value1;
|
||||
defaultColorHairGLight = value2;
|
||||
}
|
||||
if (address == "07ECA2") {
|
||||
defaultColorHairBLight = value1;
|
||||
}
|
||||
if (address == "07EC98") {
|
||||
defaultColorHairRDark = value1;
|
||||
defaultColorHairGDark = value2;
|
||||
}
|
||||
if (address == "07EC9A") {
|
||||
defaultColorHairBDark = value1;
|
||||
}
|
||||
}
|
||||
}
|
63
src/saturn/saturn_colors.h
Normal file
63
src/saturn/saturn_colors.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
#ifndef SaturnColors
|
||||
#define SaturnColors
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern unsigned int defaultColorHatRLight;
|
||||
extern unsigned int defaultColorHatRDark;
|
||||
extern unsigned int defaultColorHatGLight;
|
||||
extern unsigned int defaultColorHatGDark;
|
||||
extern unsigned int defaultColorHatBLight;
|
||||
extern unsigned int defaultColorHatBDark;
|
||||
|
||||
extern unsigned int defaultColorOverallsRLight;
|
||||
extern unsigned int defaultColorOverallsRDark;
|
||||
extern unsigned int defaultColorOverallsGLight;
|
||||
extern unsigned int defaultColorOverallsGDark;
|
||||
extern unsigned int defaultColorOverallsBLight;
|
||||
extern unsigned int defaultColorOverallsBDark;
|
||||
|
||||
extern unsigned int defaultColorGlovesRLight;
|
||||
extern unsigned int defaultColorGlovesRDark;
|
||||
extern unsigned int defaultColorGlovesGLight;
|
||||
extern unsigned int defaultColorGlovesGDark;
|
||||
extern unsigned int defaultColorGlovesBLight;
|
||||
extern unsigned int defaultColorGlovesBDark;
|
||||
|
||||
extern unsigned int defaultColorShoesRLight;
|
||||
extern unsigned int defaultColorShoesRDark;
|
||||
extern unsigned int defaultColorShoesGLight;
|
||||
extern unsigned int defaultColorShoesGDark;
|
||||
extern unsigned int defaultColorShoesBLight;
|
||||
extern unsigned int defaultColorShoesBDark;
|
||||
|
||||
extern unsigned int defaultColorSkinRLight;
|
||||
extern unsigned int defaultColorSkinRDark;
|
||||
extern unsigned int defaultColorSkinGLight;
|
||||
extern unsigned int defaultColorSkinGDark;
|
||||
extern unsigned int defaultColorSkinBLight;
|
||||
extern unsigned int defaultColorSkinBDark;
|
||||
|
||||
extern unsigned int defaultColorHairRLight;
|
||||
extern unsigned int defaultColorHairRDark;
|
||||
extern unsigned int defaultColorHairGLight;
|
||||
extern unsigned int defaultColorHairGDark;
|
||||
extern unsigned int defaultColorHairBLight;
|
||||
extern unsigned int defaultColorHairBDark;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
#include <vector>
|
||||
extern std::vector<std::string> cc_array;
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
void load_cc_directory();
|
||||
void reset_cc_colors();
|
||||
void load_cc_file(char*);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue