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) };
SohImGui::Update(event_impl);
switch (message) {
case WM_SIZE:
dxgi.current_width = (uint32_t)(l_param & 0xffff);
dxgi.current_height = (uint32_t)(l_param >> 16);
break;
case WM_DESTROY:
exit(0);
case WM_PAINT:
if (dxgi.in_paint) {
dxgi.recursive_paint_detected = true;
return DefWindowProcW(h_wnd, message, w_param, l_param);
} else {
if (dxgi.run_one_game_iter != nullptr) {
dxgi.in_paint = true;
dxgi.run_one_game_iter();
dxgi.in_paint = false;
if (dxgi.recursive_paint_detected) {
dxgi.recursive_paint_detected = false;
InvalidateRect(h_wnd, nullptr, false);
UpdateWindow(h_wnd);
}
case WM_SIZE:
dxgi.current_width = (uint32_t)(l_param & 0xffff);
dxgi.current_height = (uint32_t)(l_param >> 16);
break;
case WM_DESTROY:
exit(0);
case WM_PAINT:
if (dxgi.in_paint) {
dxgi.recursive_paint_detected = true;
return DefWindowProcW(h_wnd, message, w_param, l_param);
}
else {
if (dxgi.run_one_game_iter != nullptr) {
dxgi.in_paint = true;
dxgi.run_one_game_iter();
dxgi.in_paint = false;
if (dxgi.recursive_paint_detected) {
dxgi.recursive_paint_detected = false;
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 {
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) {

View file

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

View file

@ -91,12 +91,12 @@ namespace SohImGui {
ImVec4 navi_prop_o_col;
const char* RainbowColorCvarList[] = {
//This is the list of possible CVars that has rainbow effect.
"gTunic_Kokiri_","gTunic_Goron_","gTunic_Zora_",
"gCCHeartsPrim","gDDCCHeartsPrim",
"gCCABtnPrim","gCCBBtnPrim","gCCCBtnPrim","gCCStartBtnPrim",
"gCCMagicBorderPrim","gCCMagicPrim","gCCMagicUsePrim",
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim"
//This is the list of possible CVars that has rainbow effect.
"gTunic_Kokiri_","gTunic_Goron_","gTunic_Zora_",
"gCCHeartsPrim","gDDCCHeartsPrim",
"gCCABtnPrim","gCCBBtnPrim","gCCCBtnPrim","gCCStartBtnPrim",
"gCCMagicBorderPrim","gCCMagicPrim","gCCMagicUsePrim",
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim"
};
const char* filters[3] = {
@ -259,7 +259,8 @@ namespace SohImGui {
}
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 Cvar_Red = cvarName;
Cvar_Red += "R";
@ -270,8 +271,8 @@ namespace SohImGui {
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string RBM_HUE = cvarName;
RBM_HUE+="Hue";
f32 Canon = 10.f*s;
RBM_HUE += "Hue";
f32 Canon = 10.f * s;
ImVec4 NewColor;
const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate;
f32 hue = CVar_GetFloat(RBM_HUE.c_str(), 0.0f);
@ -283,20 +284,20 @@ namespace SohImGui {
u8 i = current_hue / 60 + 1;
u8 a = (-current_hue / 60.0f + i) * 255;
u8 b = (current_hue / 60.0f + (1 - i)) * 255;
switch (i) {
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 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; 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 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; 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 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; 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 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
}
if(CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
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_Blue.c_str(), ClampFloatToInt(NewColor.z,0,255));
if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
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_Blue.c_str(), ClampFloatToInt(NewColor.z, 0, 255));
}
}
}

View file

@ -8,8 +8,6 @@
#include "soh/frame_interpolation.h"
#include "soh/frame_interpolation.h"
static s16 sUnused = 106;
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) {
OPEN_DISPS(this->state.gfxCtx, "gfx.c", 12);
@ -211,14 +207,11 @@ void DrawSeedHashSprites(FileChooseContext* this) {
// Draw Seed Icons
u16 xStart = 64;
for (u8 i = 0; i < 5; i++) {
// gSaveContext.seedIcons[i];
// hacky check to make sure we leaded the icons
if(gSaveContext.seedIcons[i].height) {
if (gSaveContext.seedIcons[i].height) {
SpriteLoad(this, &gSaveContext.seedIcons[i]);
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++);

View file

@ -448,18 +448,6 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
}
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);