mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
drag and drop away!
This commit is contained in:
parent
9568a1dae3
commit
1d53c90a5f
6 changed files with 21 additions and 9 deletions
|
@ -64,7 +64,7 @@ void CVar_SetFloat(const char* name, float value) {
|
||||||
cvar->value.valueFloat = value;
|
cvar->value.valueFloat = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVar_SetString(const char* name, const char* value) {
|
extern "C" void CVar_SetString(const char* name, const char* value) {
|
||||||
auto& cvar = cvars[name];
|
auto& cvar = cvars[name];
|
||||||
if (!cvar) {
|
if (!cvar) {
|
||||||
cvar = std::make_unique<CVar>();
|
cvar = std::make_unique<CVar>();
|
||||||
|
|
|
@ -27,6 +27,7 @@ s32 CVar_GetS32(const char* name, s32 defaultValue);
|
||||||
float CVar_GetFloat(const char* name, float defaultValue);
|
float CVar_GetFloat(const char* name, float defaultValue);
|
||||||
const char* CVar_GetString(const char* name, const char* defaultValue);
|
const char* CVar_GetString(const char* name, const char* defaultValue);
|
||||||
void CVar_SetS32(const char* name, s32 value);
|
void CVar_SetS32(const char* name, s32 value);
|
||||||
|
void CVar_SetString(const char* name, const char* value);
|
||||||
|
|
||||||
void CVar_RegisterS32(const char* name, s32 defaultValue);
|
void CVar_RegisterS32(const char* name, s32 defaultValue);
|
||||||
void CVar_RegisterFloat(const char* name, float defaultValue);
|
void CVar_RegisterFloat(const char* name, float defaultValue);
|
||||||
|
@ -44,6 +45,5 @@ void CVar_RegisterString(const char* name, const char* defaultValue);
|
||||||
|
|
||||||
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
|
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
|
||||||
void CVar_SetFloat(const char* name, float value);
|
void CVar_SetFloat(const char* name, float value);
|
||||||
void CVar_SetString(const char* name, const char* value);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "gfx_screen_config.h"
|
#include "gfx_screen_config.h"
|
||||||
#include "gfx_pc.h"
|
#include "gfx_pc.h"
|
||||||
#include "../../SohImGuiImpl.h"
|
#include "../../SohImGuiImpl.h"
|
||||||
|
#include "../../Cvar.h"
|
||||||
|
|
||||||
#define DECLARE_GFX_DXGI_FUNCTIONS
|
#define DECLARE_GFX_DXGI_FUNCTIONS
|
||||||
#include "gfx_dxgi.h"
|
#include "gfx_dxgi.h"
|
||||||
|
@ -271,7 +272,8 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par
|
||||||
case WM_DROPFILES:
|
case WM_DROPFILES:
|
||||||
char fileName[256];
|
char fileName[256];
|
||||||
DragQueryFileA((HDROP)w_param, 0, fileName, 256);
|
DragQueryFileA((HDROP)w_param, 0, fileName, 256);
|
||||||
LoadItemLocations(fileName);
|
CVar_SetString("gDroppedFile", fileName);
|
||||||
|
CVar_SetS32("gDroppedNewSpoilerFile", 1);
|
||||||
break;
|
break;
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
if ((w_param == VK_RETURN) && ((l_param & 1 << 30) == 0)) {
|
if ((w_param == VK_RETURN) && ((l_param & 1 << 30) == 0)) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../SohImGuiImpl.h"
|
#include "../../SohImGuiImpl.h"
|
||||||
|
#include "../../Cvar.h"
|
||||||
|
|
||||||
#include "gfx_window_manager_api.h"
|
#include "gfx_window_manager_api.h"
|
||||||
#include "gfx_screen_config.h"
|
#include "gfx_screen_config.h"
|
||||||
|
@ -228,8 +229,6 @@ static void gfx_sdl_onkeyup(int scancode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
|
@ -253,9 +252,8 @@ static void gfx_sdl_handle_events(void) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_DROPFILE:
|
case SDL_DROPFILE:
|
||||||
#ifndef __linux__
|
CVar_SetString("gDroppedFile", event.drop.file);
|
||||||
LoadItemLocations(event.drop.file);
|
CVar_SetS32("gDroppedNewSpoilerFile", 1);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
SDL_Quit(); // bandaid fix for linux window closing issue
|
SDL_Quit(); // bandaid fix for linux window closing issue
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <Cvar.h>
|
#include <Cvar.h>
|
||||||
#include <textures/icon_item_static/icon_item_static.h>
|
#include <textures/icon_item_static/icon_item_static.h>
|
||||||
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
||||||
|
#include <GameSettings.h>
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
@ -779,6 +780,8 @@ void Randomizer::ParseItemLocations(const char* spoilerFileName) {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
CVar_SetS32("gRandomizer", 1);
|
CVar_SetS32("gRandomizer", 1);
|
||||||
|
CVar_SetS32("gDroppedNewSpoilerFile", 0);
|
||||||
|
Game::SaveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,13 @@ void FileChoose_InitModeUpdate(GameState* thisx) {
|
||||||
this->configMode = CM_FADE_IN_START;
|
this->configMode = CM_FADE_IN_START;
|
||||||
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
|
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
|
||||||
osSyncPrintf("Sram Start─Load 》》》》》 ");
|
osSyncPrintf("Sram Start─Load 》》》》》 ");
|
||||||
CVar_SetS32("gRandomizer", 0);
|
|
||||||
|
if (strcmp(CVar_GetString("gDroppedFile", ""), "") != 0 && CVar_GetS32("gRandomizer", 0) != 0) {
|
||||||
|
LoadItemLocations(CVar_GetString("gDroppedFile", ""));
|
||||||
|
} else {
|
||||||
|
CVar_SetS32("gRandomizer", 0);
|
||||||
|
}
|
||||||
|
|
||||||
Sram_VerifyAndLoadAllSaves(this, &this->sramCtx);
|
Sram_VerifyAndLoadAllSaves(this, &this->sramCtx);
|
||||||
osSyncPrintf("終了!!!\n");
|
osSyncPrintf("終了!!!\n");
|
||||||
}
|
}
|
||||||
|
@ -233,6 +239,9 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||||
SramContext* sramCtx = &this->sramCtx;
|
SramContext* sramCtx = &this->sramCtx;
|
||||||
Input* input = &this->state.input[0];
|
Input* input = &this->state.input[0];
|
||||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||||
|
if (strcmp(CVar_GetString("gDroppedFile", ""), "") != 0 && CVar_GetS32("gDroppedNewSpoilerFile", 0) != 0) {
|
||||||
|
LoadItemLocations(CVar_GetString("gDroppedFile", ""));
|
||||||
|
}
|
||||||
|
|
||||||
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||||
if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) {
|
if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue