various merge fixes

This commit is contained in:
MelonSpeedruns 2022-05-29 15:19:31 -04:00
commit c16f153485
5 changed files with 44 additions and 66 deletions

View file

@ -233,26 +233,26 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par
event_impl.win32 = { h_wnd, static_cast<int>(message), static_cast<int>(w_param), static_cast<int>(l_param) }; event_impl.win32 = { h_wnd, static_cast<int>(message), static_cast<int>(w_param), static_cast<int>(l_param) };
SohImGui::Update(event_impl); SohImGui::Update(event_impl);
switch (message) { switch (message) {
case WM_SIZE: case WM_SIZE:
dxgi.current_width = (uint32_t)(l_param & 0xffff); dxgi.current_width = (uint32_t)(l_param & 0xffff);
dxgi.current_height = (uint32_t)(l_param >> 16); dxgi.current_height = (uint32_t)(l_param >> 16);
break; break;
case WM_DESTROY: case WM_DESTROY:
exit(0); exit(0);
case WM_PAINT: case WM_PAINT:
if (dxgi.in_paint) { if (dxgi.in_paint) {
dxgi.recursive_paint_detected = true; dxgi.recursive_paint_detected = true;
return DefWindowProcW(h_wnd, message, w_param, l_param); return DefWindowProcW(h_wnd, message, w_param, l_param);
} else { }
if (dxgi.run_one_game_iter != nullptr) { else {
dxgi.in_paint = true; if (dxgi.run_one_game_iter != nullptr) {
dxgi.run_one_game_iter(); dxgi.in_paint = true;
dxgi.in_paint = false; dxgi.run_one_game_iter();
if (dxgi.recursive_paint_detected) { dxgi.in_paint = false;
dxgi.recursive_paint_detected = false; if (dxgi.recursive_paint_detected) {
InvalidateRect(h_wnd, nullptr, false); dxgi.recursive_paint_detected = false;
UpdateWindow(h_wnd); InvalidateRect(h_wnd, nullptr, false);
} UpdateWindow(h_wnd);
} }
} }
} }
@ -280,8 +280,9 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par
} }
else { else {
return DefWindowProcW(h_wnd, message, w_param, l_param); return DefWindowProcW(h_wnd, message, w_param, l_param);
}
return 0;
} }
return 0;
} }
void gfx_dxgi_init(const char* game_name, bool start_in_fullscreen) { void gfx_dxgi_init(const char* game_name, bool start_in_fullscreen) {

View file

@ -234,7 +234,6 @@ extern "C" void LoadItemLocations(const char* spoilerFileName);
static void gfx_sdl_handle_events(void) { static void gfx_sdl_handle_events(void) {
SDL_Event event; SDL_Event event;
char* dropped_filedir;
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SohImGui::EventImpl event_impl; SohImGui::EventImpl event_impl;
event_impl.sdl = { &event }; event_impl.sdl = { &event };
@ -256,12 +255,8 @@ static void gfx_sdl_handle_events(void) {
} }
break; break;
case SDL_DROPFILE: case SDL_DROPFILE:
{
#ifndef __linux__
LoadItemLocations(event.drop.file); LoadItemLocations(event.drop.file);
#endif
break; break;
}
case SDL_QUIT: case SDL_QUIT:
exit(0); exit(0);
} }

View file

@ -91,12 +91,12 @@ namespace SohImGui {
ImVec4 navi_prop_o_col; ImVec4 navi_prop_o_col;
const char* RainbowColorCvarList[] = { const char* RainbowColorCvarList[] = {
//This is the list of possible CVars that has rainbow effect. //This is the list of possible CVars that has rainbow effect.
"gTunic_Kokiri_","gTunic_Goron_","gTunic_Zora_", "gTunic_Kokiri_","gTunic_Goron_","gTunic_Zora_",
"gCCHeartsPrim","gDDCCHeartsPrim", "gCCHeartsPrim","gDDCCHeartsPrim",
"gCCABtnPrim","gCCBBtnPrim","gCCCBtnPrim","gCCStartBtnPrim", "gCCABtnPrim","gCCBBtnPrim","gCCCBtnPrim","gCCStartBtnPrim",
"gCCMagicBorderPrim","gCCMagicPrim","gCCMagicUsePrim", "gCCMagicBorderPrim","gCCMagicPrim","gCCMagicUsePrim",
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim" "gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim"
}; };
const char* filters[3] = { const char* filters[3] = {
@ -259,7 +259,8 @@ namespace SohImGui {
} }
void LoadRainbowColor() { void LoadRainbowColor() {
for (uint16_t s=0; s <= sizeof(RainbowColorCvarList); s++) { u8 arrayLength = sizeof(RainbowColorCvarList) / sizeof(*RainbowColorCvarList);
for (u8 s = 0; s < arrayLength; s++) {
std::string cvarName = RainbowColorCvarList[s]; std::string cvarName = RainbowColorCvarList[s];
std::string Cvar_Red = cvarName; std::string Cvar_Red = cvarName;
Cvar_Red += "R"; Cvar_Red += "R";
@ -270,8 +271,8 @@ namespace SohImGui {
std::string Cvar_RBM = cvarName; std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM"; Cvar_RBM += "RBM";
std::string RBM_HUE = cvarName; std::string RBM_HUE = cvarName;
RBM_HUE+="Hue"; RBM_HUE += "Hue";
f32 Canon = 10.f*s; f32 Canon = 10.f * s;
ImVec4 NewColor; ImVec4 NewColor;
const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate; const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate;
f32 hue = CVar_GetFloat(RBM_HUE.c_str(), 0.0f); f32 hue = CVar_GetFloat(RBM_HUE.c_str(), 0.0f);
@ -285,18 +286,18 @@ namespace SohImGui {
u8 b = (current_hue / 60.0f + (1 - i)) * 255; u8 b = (current_hue / 60.0f + (1 - i)) * 255;
switch (i) { switch (i) {
case 1: NewColor.x = 255; NewColor.y = b; NewColor.z = 0; break; case 1: NewColor.x = 255; NewColor.y = b; NewColor.z = 0; break;
case 2: NewColor.x = a; NewColor.y = 255; NewColor.z = 0; break; case 2: NewColor.x = a; NewColor.y = 255; NewColor.z = 0; break;
case 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; break; case 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; break;
case 4: NewColor.x = 0; NewColor.y = a; NewColor.z = 255; break; case 4: NewColor.x = 0; NewColor.y = a; NewColor.z = 255; break;
case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break; case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break;
case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break; case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
} }
if(CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) { if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(NewColor.x,0,255)); CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(NewColor.x, 0, 255));
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(NewColor.y,0,255)); CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(NewColor.y, 0, 255));
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(NewColor.z,0,255)); CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(NewColor.z, 0, 255));
} }
} }
} }

View file

@ -8,8 +8,6 @@
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include "soh/frame_interpolation.h"
static s16 sUnused = 106; static s16 sUnused = 106;
static s16 sScreenFillAlpha = 255; static s16 sScreenFillAlpha = 255;
@ -169,8 +167,6 @@ void FileChoose_FinishFadeIn(GameState* thisx) {
} }
} }
Sprite sprDPad = { gHookshotIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b };
void SpriteLoad(FileChooseContext* this, Sprite* sprite) { void SpriteLoad(FileChooseContext* this, Sprite* sprite) {
OPEN_DISPS(this->state.gfxCtx, "gfx.c", 12); OPEN_DISPS(this->state.gfxCtx, "gfx.c", 12);
@ -211,14 +207,11 @@ void DrawSeedHashSprites(FileChooseContext* this) {
// Draw Seed Icons // Draw Seed Icons
u16 xStart = 64; u16 xStart = 64;
for (u8 i = 0; i < 5; i++) { for (u8 i = 0; i < 5; i++) {
// gSaveContext.seedIcons[i];
// hacky check to make sure we leaded the icons // hacky check to make sure we leaded the icons
if(gSaveContext.seedIcons[i].height) { if (gSaveContext.seedIcons[i].height) {
SpriteLoad(this, &gSaveContext.seedIcons[i]); SpriteLoad(this, &gSaveContext.seedIcons[i]);
SpriteDraw(this, &gSaveContext.seedIcons[i], xStart + (40 * i), 10, 24, 24); SpriteDraw(this, &gSaveContext.seedIcons[i], xStart + (40 * i), 10, 24, 24);
} }
// SpriteLoad(this, &sprDPad);
// SpriteDraw(this, &sprDPad, xStart + (40 * i), 10, 24, 24);
} }
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);

View file

@ -449,18 +449,6 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
dayTime = ((void)0, gSaveContext.dayTime); dayTime = ((void)0, gSaveContext.dayTime);
// hacky function for testing
// while drag and drop is broken on linux
// enter "rando" as file name
if(this->fileNames[1][0] == '5' &&
this->fileNames[1][1] == '$' &&
this->fileNames[1][2] == '1' &&
this->fileNames[1][3] == '\'' &&
this->fileNames[1][4] == '2')
{
ParseItemLocations("spoiler.json");
}
Sram_InitSave(this, &this->sramCtx); Sram_InitSave(this, &this->sramCtx);
// todo: fill link's pocket here // todo: fill link's pocket here