2022-03-21 21:52:44 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2022-05-11 13:18:24 -04:00
|
|
|
#if defined(ENABLE_OPENGL)
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
#define FOR_WINDOWS 1
|
|
|
|
#else
|
|
|
|
#define FOR_WINDOWS 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if FOR_WINDOWS
|
|
|
|
#include <GL/glew.h>
|
|
|
|
#include "SDL.h"
|
|
|
|
#define GL_GLEXT_PROTOTYPES 1
|
|
|
|
#include "SDL_opengl.h"
|
2022-06-22 14:59:21 -04:00
|
|
|
#elif __APPLE__
|
|
|
|
#include <SDL.h>
|
2022-03-21 21:52:44 -04:00
|
|
|
#else
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#define GL_GLEXT_PROTOTYPES 1
|
|
|
|
#include <SDL2/SDL_opengles2.h>
|
|
|
|
#endif
|
|
|
|
|
2022-06-27 20:39:13 -04:00
|
|
|
#include "../../ImGuiImpl.h"
|
testing out item replacement (#416)
* skip learning song of storms
* don't set flag when getting goron tunic as child
* Initiates prelude check when master sword unloads.
Not quite how N64 rando does it but so far it's the only way I've found to make it trigger without also triggering the time travel again.
* Stops Shadow Temple lore prompts from appearing in rando.
* Skips cutscene of royal tomb explosion in rando.
Explosion sound doesn't play correctly and I think the debris appears in the wrong place, but the functionality is here.
* Improves visual of exploding gravestone.
* Adds some comments explaining the rando differences
* Skip ruto text box in jabu blue warp
For rando
* skip intro cutscene in dodongo's cavern
* load spoiler files on boot, fix spoilerfile existing check when making new saves
* name entry dropped spoiler logic
* make sure to actually init the cvar
* no chime on load
* uncomment
* Skip ganondrof cutscene
Skip to scream part of the death animation, skipping the text boxes etc. For rando
* Update z_boss_ganondrof.c
* skip owl flight cutscenes in rando
* Fixes skipped text so it only applies to shadow temple.
Earlier fix inadvertently applied to some other text as well, changed logic so that only specified sceneNums and textIds can have this enabled, and text skipped by sceneNum can have the skip overriden by textId if needed. Currently there are no overrides so the textId section of the logic is commented out to avoid compilation errors.
* Adds a default to the switch case statements that leaves the randoSkipText variable unchanged, just in case.
* TEST: Text for item
* Adding ganon flavor text
* ADD: AMMO Count
* format ganon text/hint text
* Autoskip the tower cutscene if settings call for tower collapse.
* ganon hint text logic
* Improved prelude after time travel fix
* swapped the sizes between ganon hint text and ganon text, as they were set to the wrong things.
* this is all i did
* not the cleanest code ever but it's working
* ADD: GS Count
* ADD: Wallter (crash for now)
* TWEAK: Wallet check
* FIX: Use DrawItem instread of DrawUpgrade... b-baka!
* Fixes some vanilla bugs introduced by rando code.
* Added cutscene skip for zelda escaping
Using the debug cutscene skipping function. Also added a conditional so the bridge doesn't spawn closed when cutscene is ready to trigger
* ADD: X Spacing + Placeholders for song
* ADD: default case for items
* TWEAK: Spacing
* FIX: Light Arrow
* ADD: Ammo Option
* use groups instead
* ADD: More spacing logic
* songs and names
* TWEAK: Color on wallet
* colors
* Added flags cutscene before nabooru fight
* ADD: ChromaKey text
* First attempt skip cs after nabooru defeat
* Better implementation for specific rando cutscene skips
* use pulseaudio defaults
* spaces/tabs
* move color push/pop to stop crash
* make the colors work again
* the real bottle fix
* pulseaudio values tuned for n64 audio at 44.1khz
* update tlength
* remove one hardcoded samplerate
* Cleaned up and fixed zelda escape skip
The if statement is a freaking monster, but unless we want to skip more cutscenes in the same way later, this is the most compact way of doing it that I know of.
* Revert one line to match original
nothing functional
* another hint line that breaks autonewline logic
* don't autospawn epona if we don't have the song/ocarina
* Trying to use iron knuckle death effects
not working yet
* Streamlined OoT cutscene skip for future additions
Also cleaned up if statement in general
* Made if statement more readable
Also added clarity for what cutscene was skipped
* Fixed typo in comment
* Janky nabooru defeat cs skip
* altar text formatting (gonna need help shortening some of the french ones)
* more altar text formatting
* english altar text formatting complete
* make gtg blocking guard check for card not bridge
* FIX: Typo!
* FIX: Uppercases
* FIX: Typo
* TWEAK: Alter + some names
* TWEAK: More caps!
* ADD: Missing string
TWEAK more uppercases and namefixe
s
* Hide nabooru death by covering her in flames
* bandaid fix for death crash issue
* Twinrova defeat cs skip
Skips the animation and manually calls the function to show the "beam" around the sisters
* fix crash
* fix caps to match
* fix great fairy reward mashing/shielding issue
* TWEAK : Typo clé to Clé
* TWEAK: Some Altar hints
TWEAK: Some capitals
* TWEAK: Unmatching text + some cap again
* TWEAK: More tweaks
* fix build
* remove extra json.hpp, add hint
* Update randomizer_item_tracker.cpp
* TWEAK: Double Defense with RedParticles instead of white
* make sure we don't optimize out the check to ensure a spoilerfile exists
* vanilla ganon boss key hint formatting
* TWEAK: FR- better way of the hero text
* fix
* and again
* Initializes dungeonsDone items in gSaveContext to 0.
* Replaces sizeof calculation with a NUM_DUNGEONS constant.
* Fixes Saria's Gift on the LW Bridge from getting killed when holding shield.
* More airtight fix for Saria's Gift on the Bridge.
* Lifts one of the conditions in the if statement a little higher to prevent unnecessary lookups of getItemId.
* Invalidate text box icon before drawing
* Fixes the case where Saria's gift is an Ice Trap.
We still get the Ice Trap once, but never again. This does mean you can now hold R while walking in to avoid the ice trap, but everything else seems to work fine.
* Initial commit
Might need changing when we change the settings in the future
* Fixes Door of Time opening cutscene after warping with prelude.
* Initial waterfall skip
Very rudimentary way of doing things but it seems to work so :shrug:
* inital rework
* fixed default rotation for 2D sprites
* fix tab/space issues
* 3d drops rando merge fix again
* Allows Impa to appear in the Lullaby check post drawbridge escape.
* Changes Ganon's Trials Count setting to a checkbox
The checkbox is whether or not to skip all of them. Leaving the box unchecked will mean doing all of them. Eventually this will be switched back to a slider once we implement the logic for which trials start out completed.
* Sets all Ganon's Trials to incomplete in new saves.
Fixes https://github.com/briaguya-ai/rando-issue-tracker/issues/131
* fix castle guards when oot throw cutscene has already played in rando
* Properly removes the beams when trials are cleared.
* Removes Question Mark from Skip Ganon's Trials UI.
* Adds a todo comment about when to change back to slider.
* make deku seeds check for bullet bag
* Various tweaks
TWEAK: Altar Text
TWEAK: Hint names
TWEAK: Replace more problematic œ to oe
* upgrade ocarina on both child and adult equips
* FIX: Jabu Item
* update equipped hookshot/longshot when obtained as other age
* add hint
* don't give the bgs check without the claim check
* Skips Darunia Cutscene in Fire Temple
* Added a TODO note about not skipping the cutscene.
There is a setting we will want to have eventually that will require this cutscene to not be skipped since it is used during a glitch.
* remove todo
* restore fast ocarina option in imgui that was lost in merge
* Fixes grey screen issue + tooltip for 2 handed shield
* update to use dg instead of g for textures in item tracker
* TWEAK: Default color for cosmetic RAND button was not the corect one
* fix texture crash, remove unused item tracker code
* don't open mask shop until we get zelda's letter
* Update README.md
* Prevents "correct" chime under incorrect conditions.
* Fixes typo in conditional and adds "bonk" sound effect.
"Bonk" sound is NA_SE_SY_OCARINA_ERROR and it plays when conditions for the Door of Time have not been met after playing Song of Time. This is only possible in rando's "Intended" Door of Time option, in which the Ocarina of Time and all 3 spritual stones are required to open the door, instead of the vanilla requirements of just having the song of time.
* remove modify dpad equips toggle, replace with checks for dpad menu
* remove extra check
* add ability to hold c-up to assign to dpad when dpad menuing is enabled
* disable d-pad navigation on item menu when holding c-up to equip
* dpad+c-up stuff for equipment menu
* ADD: Checbox for songs colors
* TWEAK: RandoColors for normal songs
* kind of quick and dirty but it works
* TWEAK: Clarity of the tooltip
Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: aMannus <mannusmenting@gmail.com>
Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com>
Co-authored-by: Dog <5172592+Dog@users.noreply.github.com>
Co-authored-by: Vague Rant <vaguerant@users.noreply.github.com>
Co-authored-by: Baoulettes <perlouzerie@hotmail.fr>
Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com>
2022-07-11 20:11:07 -04:00
|
|
|
#include "../../Cvar.h"
|
2022-07-13 23:12:11 -04:00
|
|
|
#include "../../Hooks.h"
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
#include "gfx_window_manager_api.h"
|
|
|
|
#include "gfx_screen_config.h"
|
2022-05-11 13:18:24 -04:00
|
|
|
#ifdef _WIN32
|
2022-03-21 21:52:44 -04:00
|
|
|
#include <WTypesbase.h>
|
2022-05-11 13:18:24 -04:00
|
|
|
#endif
|
2022-03-21 21:52:44 -04:00
|
|
|
#include <time.h>
|
testing out item replacement (#416)
* skip learning song of storms
* don't set flag when getting goron tunic as child
* Initiates prelude check when master sword unloads.
Not quite how N64 rando does it but so far it's the only way I've found to make it trigger without also triggering the time travel again.
* Stops Shadow Temple lore prompts from appearing in rando.
* Skips cutscene of royal tomb explosion in rando.
Explosion sound doesn't play correctly and I think the debris appears in the wrong place, but the functionality is here.
* Improves visual of exploding gravestone.
* Adds some comments explaining the rando differences
* Skip ruto text box in jabu blue warp
For rando
* skip intro cutscene in dodongo's cavern
* load spoiler files on boot, fix spoilerfile existing check when making new saves
* name entry dropped spoiler logic
* make sure to actually init the cvar
* no chime on load
* uncomment
* Skip ganondrof cutscene
Skip to scream part of the death animation, skipping the text boxes etc. For rando
* Update z_boss_ganondrof.c
* skip owl flight cutscenes in rando
* Fixes skipped text so it only applies to shadow temple.
Earlier fix inadvertently applied to some other text as well, changed logic so that only specified sceneNums and textIds can have this enabled, and text skipped by sceneNum can have the skip overriden by textId if needed. Currently there are no overrides so the textId section of the logic is commented out to avoid compilation errors.
* Adds a default to the switch case statements that leaves the randoSkipText variable unchanged, just in case.
* TEST: Text for item
* Adding ganon flavor text
* ADD: AMMO Count
* format ganon text/hint text
* Autoskip the tower cutscene if settings call for tower collapse.
* ganon hint text logic
* Improved prelude after time travel fix
* swapped the sizes between ganon hint text and ganon text, as they were set to the wrong things.
* this is all i did
* not the cleanest code ever but it's working
* ADD: GS Count
* ADD: Wallter (crash for now)
* TWEAK: Wallet check
* FIX: Use DrawItem instread of DrawUpgrade... b-baka!
* Fixes some vanilla bugs introduced by rando code.
* Added cutscene skip for zelda escaping
Using the debug cutscene skipping function. Also added a conditional so the bridge doesn't spawn closed when cutscene is ready to trigger
* ADD: X Spacing + Placeholders for song
* ADD: default case for items
* TWEAK: Spacing
* FIX: Light Arrow
* ADD: Ammo Option
* use groups instead
* ADD: More spacing logic
* songs and names
* TWEAK: Color on wallet
* colors
* Added flags cutscene before nabooru fight
* ADD: ChromaKey text
* First attempt skip cs after nabooru defeat
* Better implementation for specific rando cutscene skips
* use pulseaudio defaults
* spaces/tabs
* move color push/pop to stop crash
* make the colors work again
* the real bottle fix
* pulseaudio values tuned for n64 audio at 44.1khz
* update tlength
* remove one hardcoded samplerate
* Cleaned up and fixed zelda escape skip
The if statement is a freaking monster, but unless we want to skip more cutscenes in the same way later, this is the most compact way of doing it that I know of.
* Revert one line to match original
nothing functional
* another hint line that breaks autonewline logic
* don't autospawn epona if we don't have the song/ocarina
* Trying to use iron knuckle death effects
not working yet
* Streamlined OoT cutscene skip for future additions
Also cleaned up if statement in general
* Made if statement more readable
Also added clarity for what cutscene was skipped
* Fixed typo in comment
* Janky nabooru defeat cs skip
* altar text formatting (gonna need help shortening some of the french ones)
* more altar text formatting
* english altar text formatting complete
* make gtg blocking guard check for card not bridge
* FIX: Typo!
* FIX: Uppercases
* FIX: Typo
* TWEAK: Alter + some names
* TWEAK: More caps!
* ADD: Missing string
TWEAK more uppercases and namefixe
s
* Hide nabooru death by covering her in flames
* bandaid fix for death crash issue
* Twinrova defeat cs skip
Skips the animation and manually calls the function to show the "beam" around the sisters
* fix crash
* fix caps to match
* fix great fairy reward mashing/shielding issue
* TWEAK : Typo clé to Clé
* TWEAK: Some Altar hints
TWEAK: Some capitals
* TWEAK: Unmatching text + some cap again
* TWEAK: More tweaks
* fix build
* remove extra json.hpp, add hint
* Update randomizer_item_tracker.cpp
* TWEAK: Double Defense with RedParticles instead of white
* make sure we don't optimize out the check to ensure a spoilerfile exists
* vanilla ganon boss key hint formatting
* TWEAK: FR- better way of the hero text
* fix
* and again
* Initializes dungeonsDone items in gSaveContext to 0.
* Replaces sizeof calculation with a NUM_DUNGEONS constant.
* Fixes Saria's Gift on the LW Bridge from getting killed when holding shield.
* More airtight fix for Saria's Gift on the Bridge.
* Lifts one of the conditions in the if statement a little higher to prevent unnecessary lookups of getItemId.
* Invalidate text box icon before drawing
* Fixes the case where Saria's gift is an Ice Trap.
We still get the Ice Trap once, but never again. This does mean you can now hold R while walking in to avoid the ice trap, but everything else seems to work fine.
* Initial commit
Might need changing when we change the settings in the future
* Fixes Door of Time opening cutscene after warping with prelude.
* Initial waterfall skip
Very rudimentary way of doing things but it seems to work so :shrug:
* inital rework
* fixed default rotation for 2D sprites
* fix tab/space issues
* 3d drops rando merge fix again
* Allows Impa to appear in the Lullaby check post drawbridge escape.
* Changes Ganon's Trials Count setting to a checkbox
The checkbox is whether or not to skip all of them. Leaving the box unchecked will mean doing all of them. Eventually this will be switched back to a slider once we implement the logic for which trials start out completed.
* Sets all Ganon's Trials to incomplete in new saves.
Fixes https://github.com/briaguya-ai/rando-issue-tracker/issues/131
* fix castle guards when oot throw cutscene has already played in rando
* Properly removes the beams when trials are cleared.
* Removes Question Mark from Skip Ganon's Trials UI.
* Adds a todo comment about when to change back to slider.
* make deku seeds check for bullet bag
* Various tweaks
TWEAK: Altar Text
TWEAK: Hint names
TWEAK: Replace more problematic œ to oe
* upgrade ocarina on both child and adult equips
* FIX: Jabu Item
* update equipped hookshot/longshot when obtained as other age
* add hint
* don't give the bgs check without the claim check
* Skips Darunia Cutscene in Fire Temple
* Added a TODO note about not skipping the cutscene.
There is a setting we will want to have eventually that will require this cutscene to not be skipped since it is used during a glitch.
* remove todo
* restore fast ocarina option in imgui that was lost in merge
* Fixes grey screen issue + tooltip for 2 handed shield
* update to use dg instead of g for textures in item tracker
* TWEAK: Default color for cosmetic RAND button was not the corect one
* fix texture crash, remove unused item tracker code
* don't open mask shop until we get zelda's letter
* Update README.md
* Prevents "correct" chime under incorrect conditions.
* Fixes typo in conditional and adds "bonk" sound effect.
"Bonk" sound is NA_SE_SY_OCARINA_ERROR and it plays when conditions for the Door of Time have not been met after playing Song of Time. This is only possible in rando's "Intended" Door of Time option, in which the Ocarina of Time and all 3 spritual stones are required to open the door, instead of the vanilla requirements of just having the song of time.
* remove modify dpad equips toggle, replace with checks for dpad menu
* remove extra check
* add ability to hold c-up to assign to dpad when dpad menuing is enabled
* disable d-pad navigation on item menu when holding c-up to equip
* dpad+c-up stuff for equipment menu
* ADD: Checbox for songs colors
* TWEAK: RandoColors for normal songs
* kind of quick and dirty but it works
* TWEAK: Clarity of the tooltip
Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: aMannus <mannusmenting@gmail.com>
Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com>
Co-authored-by: Dog <5172592+Dog@users.noreply.github.com>
Co-authored-by: Vague Rant <vaguerant@users.noreply.github.com>
Co-authored-by: Baoulettes <perlouzerie@hotmail.fr>
Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com>
2022-07-11 20:11:07 -04:00
|
|
|
#include "../../GameSettings.h"
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
#define GFX_API_NAME "SDL2 - OpenGL"
|
|
|
|
|
|
|
|
static SDL_Window *wnd;
|
|
|
|
static SDL_GLContext ctx;
|
|
|
|
static int inverted_scancode_table[512];
|
|
|
|
static int vsync_enabled = 0;
|
2022-06-16 21:08:47 -04:00
|
|
|
static int window_width = DESIRED_SCREEN_WIDTH;
|
|
|
|
static int window_height = DESIRED_SCREEN_HEIGHT;
|
2022-03-21 21:52:44 -04:00
|
|
|
static bool fullscreen_state;
|
|
|
|
static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen);
|
|
|
|
static bool (*on_key_down_callback)(int scancode);
|
|
|
|
static bool (*on_key_up_callback)(int scancode);
|
|
|
|
static void (*on_all_keys_up_callback)(void);
|
|
|
|
|
|
|
|
const SDL_Scancode windows_scancode_table[] =
|
2022-05-11 13:18:24 -04:00
|
|
|
{
|
2022-03-21 21:52:44 -04:00
|
|
|
/* 0 1 2 3 4 5 6 7 */
|
|
|
|
/* 8 9 A B C D E F */
|
|
|
|
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */
|
|
|
|
SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */
|
|
|
|
SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */
|
|
|
|
SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,/* 3 */
|
|
|
|
SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, /* 4 */
|
|
|
|
SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, /* 4 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */
|
|
|
|
SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 5 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, SDL_SCANCODE_F16, /* 6 */
|
|
|
|
SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 6 */
|
|
|
|
|
|
|
|
SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */
|
|
|
|
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */
|
|
|
|
};
|
|
|
|
|
|
|
|
const SDL_Scancode scancode_rmapping_extended[][2] = {
|
|
|
|
{SDL_SCANCODE_KP_ENTER, SDL_SCANCODE_RETURN},
|
|
|
|
{SDL_SCANCODE_RALT, SDL_SCANCODE_LALT},
|
|
|
|
{SDL_SCANCODE_RCTRL, SDL_SCANCODE_LCTRL},
|
|
|
|
{SDL_SCANCODE_KP_DIVIDE, SDL_SCANCODE_SLASH},
|
|
|
|
//{SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_CAPSLOCK}
|
|
|
|
};
|
|
|
|
|
|
|
|
const SDL_Scancode scancode_rmapping_nonextended[][2] = {
|
|
|
|
{SDL_SCANCODE_KP_7, SDL_SCANCODE_HOME},
|
|
|
|
{SDL_SCANCODE_KP_8, SDL_SCANCODE_UP},
|
|
|
|
{SDL_SCANCODE_KP_9, SDL_SCANCODE_PAGEUP},
|
|
|
|
{SDL_SCANCODE_KP_4, SDL_SCANCODE_LEFT},
|
|
|
|
{SDL_SCANCODE_KP_6, SDL_SCANCODE_RIGHT},
|
|
|
|
{SDL_SCANCODE_KP_1, SDL_SCANCODE_END},
|
|
|
|
{SDL_SCANCODE_KP_2, SDL_SCANCODE_DOWN},
|
|
|
|
{SDL_SCANCODE_KP_3, SDL_SCANCODE_PAGEDOWN},
|
|
|
|
{SDL_SCANCODE_KP_0, SDL_SCANCODE_INSERT},
|
|
|
|
{SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_DELETE},
|
|
|
|
{SDL_SCANCODE_KP_MULTIPLY, SDL_SCANCODE_PRINTSCREEN}
|
|
|
|
};
|
|
|
|
|
|
|
|
static void set_fullscreen(bool on, bool call_callback) {
|
|
|
|
if (fullscreen_state == on) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fullscreen_state = on;
|
|
|
|
|
|
|
|
if (on) {
|
|
|
|
SDL_DisplayMode mode;
|
|
|
|
SDL_GetDesktopDisplayMode(0, &mode);
|
|
|
|
window_width = mode.w;
|
|
|
|
window_height = mode.h;
|
2022-07-13 23:12:11 -04:00
|
|
|
SDL_ShowCursor(false);
|
2022-03-21 21:52:44 -04:00
|
|
|
} else {
|
|
|
|
window_width = DESIRED_SCREEN_WIDTH;
|
|
|
|
window_height = DESIRED_SCREEN_HEIGHT;
|
|
|
|
}
|
|
|
|
SDL_SetWindowSize(wnd, window_width, window_height);
|
|
|
|
SDL_SetWindowFullscreen(wnd, on ? SDL_WINDOW_FULLSCREEN : 0);
|
|
|
|
SDL_SetCursor(SDL_DISABLE);
|
|
|
|
|
|
|
|
if (on_fullscreen_changed_callback != NULL && call_callback) {
|
|
|
|
on_fullscreen_changed_callback(on);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t previous_time;
|
2022-06-22 14:59:21 -04:00
|
|
|
#ifdef _WIN32
|
2022-03-21 21:52:44 -04:00
|
|
|
static HANDLE timer;
|
2022-05-11 13:18:24 -04:00
|
|
|
#endif
|
2022-03-21 21:52:44 -04:00
|
|
|
|
2022-05-29 12:16:23 -04:00
|
|
|
static int target_fps = 60;
|
2022-03-21 21:52:44 -04:00
|
|
|
|
2022-05-29 12:16:23 -04:00
|
|
|
#define FRAME_INTERVAL_US_NUMERATOR 1000000
|
|
|
|
#define FRAME_INTERVAL_US_DENOMINATOR (target_fps)
|
2022-03-21 21:52:44 -04:00
|
|
|
|
2022-07-05 20:02:47 -04:00
|
|
|
static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen, uint32_t width, uint32_t height) {
|
2022-03-21 21:52:44 -04:00
|
|
|
SDL_Init(SDL_INIT_VIDEO);
|
|
|
|
|
testing out item replacement (#416)
* skip learning song of storms
* don't set flag when getting goron tunic as child
* Initiates prelude check when master sword unloads.
Not quite how N64 rando does it but so far it's the only way I've found to make it trigger without also triggering the time travel again.
* Stops Shadow Temple lore prompts from appearing in rando.
* Skips cutscene of royal tomb explosion in rando.
Explosion sound doesn't play correctly and I think the debris appears in the wrong place, but the functionality is here.
* Improves visual of exploding gravestone.
* Adds some comments explaining the rando differences
* Skip ruto text box in jabu blue warp
For rando
* skip intro cutscene in dodongo's cavern
* load spoiler files on boot, fix spoilerfile existing check when making new saves
* name entry dropped spoiler logic
* make sure to actually init the cvar
* no chime on load
* uncomment
* Skip ganondrof cutscene
Skip to scream part of the death animation, skipping the text boxes etc. For rando
* Update z_boss_ganondrof.c
* skip owl flight cutscenes in rando
* Fixes skipped text so it only applies to shadow temple.
Earlier fix inadvertently applied to some other text as well, changed logic so that only specified sceneNums and textIds can have this enabled, and text skipped by sceneNum can have the skip overriden by textId if needed. Currently there are no overrides so the textId section of the logic is commented out to avoid compilation errors.
* Adds a default to the switch case statements that leaves the randoSkipText variable unchanged, just in case.
* TEST: Text for item
* Adding ganon flavor text
* ADD: AMMO Count
* format ganon text/hint text
* Autoskip the tower cutscene if settings call for tower collapse.
* ganon hint text logic
* Improved prelude after time travel fix
* swapped the sizes between ganon hint text and ganon text, as they were set to the wrong things.
* this is all i did
* not the cleanest code ever but it's working
* ADD: GS Count
* ADD: Wallter (crash for now)
* TWEAK: Wallet check
* FIX: Use DrawItem instread of DrawUpgrade... b-baka!
* Fixes some vanilla bugs introduced by rando code.
* Added cutscene skip for zelda escaping
Using the debug cutscene skipping function. Also added a conditional so the bridge doesn't spawn closed when cutscene is ready to trigger
* ADD: X Spacing + Placeholders for song
* ADD: default case for items
* TWEAK: Spacing
* FIX: Light Arrow
* ADD: Ammo Option
* use groups instead
* ADD: More spacing logic
* songs and names
* TWEAK: Color on wallet
* colors
* Added flags cutscene before nabooru fight
* ADD: ChromaKey text
* First attempt skip cs after nabooru defeat
* Better implementation for specific rando cutscene skips
* use pulseaudio defaults
* spaces/tabs
* move color push/pop to stop crash
* make the colors work again
* the real bottle fix
* pulseaudio values tuned for n64 audio at 44.1khz
* update tlength
* remove one hardcoded samplerate
* Cleaned up and fixed zelda escape skip
The if statement is a freaking monster, but unless we want to skip more cutscenes in the same way later, this is the most compact way of doing it that I know of.
* Revert one line to match original
nothing functional
* another hint line that breaks autonewline logic
* don't autospawn epona if we don't have the song/ocarina
* Trying to use iron knuckle death effects
not working yet
* Streamlined OoT cutscene skip for future additions
Also cleaned up if statement in general
* Made if statement more readable
Also added clarity for what cutscene was skipped
* Fixed typo in comment
* Janky nabooru defeat cs skip
* altar text formatting (gonna need help shortening some of the french ones)
* more altar text formatting
* english altar text formatting complete
* make gtg blocking guard check for card not bridge
* FIX: Typo!
* FIX: Uppercases
* FIX: Typo
* TWEAK: Alter + some names
* TWEAK: More caps!
* ADD: Missing string
TWEAK more uppercases and namefixe
s
* Hide nabooru death by covering her in flames
* bandaid fix for death crash issue
* Twinrova defeat cs skip
Skips the animation and manually calls the function to show the "beam" around the sisters
* fix crash
* fix caps to match
* fix great fairy reward mashing/shielding issue
* TWEAK : Typo clé to Clé
* TWEAK: Some Altar hints
TWEAK: Some capitals
* TWEAK: Unmatching text + some cap again
* TWEAK: More tweaks
* fix build
* remove extra json.hpp, add hint
* Update randomizer_item_tracker.cpp
* TWEAK: Double Defense with RedParticles instead of white
* make sure we don't optimize out the check to ensure a spoilerfile exists
* vanilla ganon boss key hint formatting
* TWEAK: FR- better way of the hero text
* fix
* and again
* Initializes dungeonsDone items in gSaveContext to 0.
* Replaces sizeof calculation with a NUM_DUNGEONS constant.
* Fixes Saria's Gift on the LW Bridge from getting killed when holding shield.
* More airtight fix for Saria's Gift on the Bridge.
* Lifts one of the conditions in the if statement a little higher to prevent unnecessary lookups of getItemId.
* Invalidate text box icon before drawing
* Fixes the case where Saria's gift is an Ice Trap.
We still get the Ice Trap once, but never again. This does mean you can now hold R while walking in to avoid the ice trap, but everything else seems to work fine.
* Initial commit
Might need changing when we change the settings in the future
* Fixes Door of Time opening cutscene after warping with prelude.
* Initial waterfall skip
Very rudimentary way of doing things but it seems to work so :shrug:
* inital rework
* fixed default rotation for 2D sprites
* fix tab/space issues
* 3d drops rando merge fix again
* Allows Impa to appear in the Lullaby check post drawbridge escape.
* Changes Ganon's Trials Count setting to a checkbox
The checkbox is whether or not to skip all of them. Leaving the box unchecked will mean doing all of them. Eventually this will be switched back to a slider once we implement the logic for which trials start out completed.
* Sets all Ganon's Trials to incomplete in new saves.
Fixes https://github.com/briaguya-ai/rando-issue-tracker/issues/131
* fix castle guards when oot throw cutscene has already played in rando
* Properly removes the beams when trials are cleared.
* Removes Question Mark from Skip Ganon's Trials UI.
* Adds a todo comment about when to change back to slider.
* make deku seeds check for bullet bag
* Various tweaks
TWEAK: Altar Text
TWEAK: Hint names
TWEAK: Replace more problematic œ to oe
* upgrade ocarina on both child and adult equips
* FIX: Jabu Item
* update equipped hookshot/longshot when obtained as other age
* add hint
* don't give the bgs check without the claim check
* Skips Darunia Cutscene in Fire Temple
* Added a TODO note about not skipping the cutscene.
There is a setting we will want to have eventually that will require this cutscene to not be skipped since it is used during a glitch.
* remove todo
* restore fast ocarina option in imgui that was lost in merge
* Fixes grey screen issue + tooltip for 2 handed shield
* update to use dg instead of g for textures in item tracker
* TWEAK: Default color for cosmetic RAND button was not the corect one
* fix texture crash, remove unused item tracker code
* don't open mask shop until we get zelda's letter
* Update README.md
* Prevents "correct" chime under incorrect conditions.
* Fixes typo in conditional and adds "bonk" sound effect.
"Bonk" sound is NA_SE_SY_OCARINA_ERROR and it plays when conditions for the Door of Time have not been met after playing Song of Time. This is only possible in rando's "Intended" Door of Time option, in which the Ocarina of Time and all 3 spritual stones are required to open the door, instead of the vanilla requirements of just having the song of time.
* remove modify dpad equips toggle, replace with checks for dpad menu
* remove extra check
* add ability to hold c-up to assign to dpad when dpad menuing is enabled
* disable d-pad navigation on item menu when holding c-up to equip
* dpad+c-up stuff for equipment menu
* ADD: Checbox for songs colors
* TWEAK: RandoColors for normal songs
* kind of quick and dirty but it works
* TWEAK: Clarity of the tooltip
Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: aMannus <mannusmenting@gmail.com>
Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com>
Co-authored-by: Dog <5172592+Dog@users.noreply.github.com>
Co-authored-by: Vague Rant <vaguerant@users.noreply.github.com>
Co-authored-by: Baoulettes <perlouzerie@hotmail.fr>
Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com>
2022-07-11 20:11:07 -04:00
|
|
|
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
|
|
|
|
2022-06-22 14:59:21 -04:00
|
|
|
#if defined(__APPLE__)
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2022-03-21 21:52:44 -04:00
|
|
|
timer = CreateWaitableTimer(nullptr, false, nullptr);
|
2022-05-11 13:18:24 -04:00
|
|
|
#endif
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
|
|
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
|
|
|
|
|
|
|
char title[512];
|
|
|
|
int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME);
|
|
|
|
|
2022-07-05 20:02:47 -04:00
|
|
|
window_width = width;
|
|
|
|
window_height = height;
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
2022-06-16 21:08:47 -04:00
|
|
|
window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
|
|
|
SDL_GL_GetDrawableSize(wnd, &window_width, &window_height);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
if (start_in_fullscreen) {
|
|
|
|
set_fullscreen(true, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx = SDL_GL_CreateContext(wnd);
|
|
|
|
|
|
|
|
SDL_GL_SetSwapInterval(1);
|
|
|
|
|
|
|
|
SohImGui::WindowImpl window_impl;
|
|
|
|
window_impl.backend = SohImGui::Backend::SDL;
|
|
|
|
window_impl.sdl = { wnd, ctx };
|
|
|
|
SohImGui::Init(window_impl);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
|
|
|
|
inverted_scancode_table[windows_scancode_table[i]] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < sizeof(scancode_rmapping_extended) / sizeof(scancode_rmapping_extended[0]); i++) {
|
|
|
|
inverted_scancode_table[scancode_rmapping_extended[i][0]] = inverted_scancode_table[scancode_rmapping_extended[i][1]] + 0x100;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < sizeof(scancode_rmapping_nonextended) / sizeof(scancode_rmapping_nonextended[0]); i++) {
|
|
|
|
inverted_scancode_table[scancode_rmapping_nonextended[i][0]] = inverted_scancode_table[scancode_rmapping_nonextended[i][1]];
|
|
|
|
inverted_scancode_table[scancode_rmapping_nonextended[i][1]] += 0x100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_set_fullscreen_changed_callback(void (*on_fullscreen_changed)(bool is_now_fullscreen)) {
|
|
|
|
on_fullscreen_changed_callback = on_fullscreen_changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_set_fullscreen(bool enable) {
|
|
|
|
set_fullscreen(enable, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_show_cursor(bool hide) {
|
|
|
|
SDL_ShowCursor(hide);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void)) {
|
|
|
|
on_key_down_callback = on_key_down;
|
|
|
|
on_key_up_callback = on_key_up;
|
|
|
|
on_all_keys_up_callback = on_all_keys_up;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) {
|
2022-05-11 13:18:24 -04:00
|
|
|
while (1)
|
2022-03-21 21:52:44 -04:00
|
|
|
{
|
|
|
|
run_one_game_iter();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_get_dimensions(uint32_t *width, uint32_t *height) {
|
|
|
|
*width = window_width;
|
|
|
|
*height = window_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int translate_scancode(int scancode) {
|
|
|
|
if (scancode < 512) {
|
|
|
|
return inverted_scancode_table[scancode];
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-13 23:12:11 -04:00
|
|
|
static int untranslate_scancode(int translatedScancode) {
|
|
|
|
for (int i = 0; i < 512; i++) {
|
|
|
|
if (inverted_scancode_table[i] == translatedScancode) {
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
static void gfx_sdl_onkeydown(int scancode) {
|
|
|
|
int key = translate_scancode(scancode);
|
|
|
|
if (on_key_down_callback != NULL) {
|
|
|
|
on_key_down_callback(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_onkeyup(int scancode) {
|
|
|
|
int key = translate_scancode(scancode);
|
|
|
|
if (on_key_up_callback != NULL) {
|
|
|
|
on_key_up_callback(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_handle_events(void) {
|
|
|
|
SDL_Event event;
|
|
|
|
while (SDL_PollEvent(&event)) {
|
|
|
|
SohImGui::EventImpl event_impl;
|
|
|
|
event_impl.sdl = { &event };
|
|
|
|
SohImGui::Update(event_impl);
|
|
|
|
switch (event.type) {
|
|
|
|
#ifndef TARGET_WEB
|
|
|
|
// Scancodes are broken in Emscripten SDL2: https://bugzilla.libsdl.org/show_bug.cgi?id=3259
|
|
|
|
case SDL_KEYDOWN:
|
|
|
|
gfx_sdl_onkeydown(event.key.keysym.scancode);
|
|
|
|
break;
|
|
|
|
case SDL_KEYUP:
|
|
|
|
gfx_sdl_onkeyup(event.key.keysym.scancode);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case SDL_WINDOWEVENT:
|
|
|
|
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
2022-06-16 21:08:47 -04:00
|
|
|
SDL_GL_GetDrawableSize(wnd, &window_width, &window_height);
|
2022-03-21 21:52:44 -04:00
|
|
|
}
|
|
|
|
break;
|
testing out item replacement (#416)
* skip learning song of storms
* don't set flag when getting goron tunic as child
* Initiates prelude check when master sword unloads.
Not quite how N64 rando does it but so far it's the only way I've found to make it trigger without also triggering the time travel again.
* Stops Shadow Temple lore prompts from appearing in rando.
* Skips cutscene of royal tomb explosion in rando.
Explosion sound doesn't play correctly and I think the debris appears in the wrong place, but the functionality is here.
* Improves visual of exploding gravestone.
* Adds some comments explaining the rando differences
* Skip ruto text box in jabu blue warp
For rando
* skip intro cutscene in dodongo's cavern
* load spoiler files on boot, fix spoilerfile existing check when making new saves
* name entry dropped spoiler logic
* make sure to actually init the cvar
* no chime on load
* uncomment
* Skip ganondrof cutscene
Skip to scream part of the death animation, skipping the text boxes etc. For rando
* Update z_boss_ganondrof.c
* skip owl flight cutscenes in rando
* Fixes skipped text so it only applies to shadow temple.
Earlier fix inadvertently applied to some other text as well, changed logic so that only specified sceneNums and textIds can have this enabled, and text skipped by sceneNum can have the skip overriden by textId if needed. Currently there are no overrides so the textId section of the logic is commented out to avoid compilation errors.
* Adds a default to the switch case statements that leaves the randoSkipText variable unchanged, just in case.
* TEST: Text for item
* Adding ganon flavor text
* ADD: AMMO Count
* format ganon text/hint text
* Autoskip the tower cutscene if settings call for tower collapse.
* ganon hint text logic
* Improved prelude after time travel fix
* swapped the sizes between ganon hint text and ganon text, as they were set to the wrong things.
* this is all i did
* not the cleanest code ever but it's working
* ADD: GS Count
* ADD: Wallter (crash for now)
* TWEAK: Wallet check
* FIX: Use DrawItem instread of DrawUpgrade... b-baka!
* Fixes some vanilla bugs introduced by rando code.
* Added cutscene skip for zelda escaping
Using the debug cutscene skipping function. Also added a conditional so the bridge doesn't spawn closed when cutscene is ready to trigger
* ADD: X Spacing + Placeholders for song
* ADD: default case for items
* TWEAK: Spacing
* FIX: Light Arrow
* ADD: Ammo Option
* use groups instead
* ADD: More spacing logic
* songs and names
* TWEAK: Color on wallet
* colors
* Added flags cutscene before nabooru fight
* ADD: ChromaKey text
* First attempt skip cs after nabooru defeat
* Better implementation for specific rando cutscene skips
* use pulseaudio defaults
* spaces/tabs
* move color push/pop to stop crash
* make the colors work again
* the real bottle fix
* pulseaudio values tuned for n64 audio at 44.1khz
* update tlength
* remove one hardcoded samplerate
* Cleaned up and fixed zelda escape skip
The if statement is a freaking monster, but unless we want to skip more cutscenes in the same way later, this is the most compact way of doing it that I know of.
* Revert one line to match original
nothing functional
* another hint line that breaks autonewline logic
* don't autospawn epona if we don't have the song/ocarina
* Trying to use iron knuckle death effects
not working yet
* Streamlined OoT cutscene skip for future additions
Also cleaned up if statement in general
* Made if statement more readable
Also added clarity for what cutscene was skipped
* Fixed typo in comment
* Janky nabooru defeat cs skip
* altar text formatting (gonna need help shortening some of the french ones)
* more altar text formatting
* english altar text formatting complete
* make gtg blocking guard check for card not bridge
* FIX: Typo!
* FIX: Uppercases
* FIX: Typo
* TWEAK: Alter + some names
* TWEAK: More caps!
* ADD: Missing string
TWEAK more uppercases and namefixe
s
* Hide nabooru death by covering her in flames
* bandaid fix for death crash issue
* Twinrova defeat cs skip
Skips the animation and manually calls the function to show the "beam" around the sisters
* fix crash
* fix caps to match
* fix great fairy reward mashing/shielding issue
* TWEAK : Typo clé to Clé
* TWEAK: Some Altar hints
TWEAK: Some capitals
* TWEAK: Unmatching text + some cap again
* TWEAK: More tweaks
* fix build
* remove extra json.hpp, add hint
* Update randomizer_item_tracker.cpp
* TWEAK: Double Defense with RedParticles instead of white
* make sure we don't optimize out the check to ensure a spoilerfile exists
* vanilla ganon boss key hint formatting
* TWEAK: FR- better way of the hero text
* fix
* and again
* Initializes dungeonsDone items in gSaveContext to 0.
* Replaces sizeof calculation with a NUM_DUNGEONS constant.
* Fixes Saria's Gift on the LW Bridge from getting killed when holding shield.
* More airtight fix for Saria's Gift on the Bridge.
* Lifts one of the conditions in the if statement a little higher to prevent unnecessary lookups of getItemId.
* Invalidate text box icon before drawing
* Fixes the case where Saria's gift is an Ice Trap.
We still get the Ice Trap once, but never again. This does mean you can now hold R while walking in to avoid the ice trap, but everything else seems to work fine.
* Initial commit
Might need changing when we change the settings in the future
* Fixes Door of Time opening cutscene after warping with prelude.
* Initial waterfall skip
Very rudimentary way of doing things but it seems to work so :shrug:
* inital rework
* fixed default rotation for 2D sprites
* fix tab/space issues
* 3d drops rando merge fix again
* Allows Impa to appear in the Lullaby check post drawbridge escape.
* Changes Ganon's Trials Count setting to a checkbox
The checkbox is whether or not to skip all of them. Leaving the box unchecked will mean doing all of them. Eventually this will be switched back to a slider once we implement the logic for which trials start out completed.
* Sets all Ganon's Trials to incomplete in new saves.
Fixes https://github.com/briaguya-ai/rando-issue-tracker/issues/131
* fix castle guards when oot throw cutscene has already played in rando
* Properly removes the beams when trials are cleared.
* Removes Question Mark from Skip Ganon's Trials UI.
* Adds a todo comment about when to change back to slider.
* make deku seeds check for bullet bag
* Various tweaks
TWEAK: Altar Text
TWEAK: Hint names
TWEAK: Replace more problematic œ to oe
* upgrade ocarina on both child and adult equips
* FIX: Jabu Item
* update equipped hookshot/longshot when obtained as other age
* add hint
* don't give the bgs check without the claim check
* Skips Darunia Cutscene in Fire Temple
* Added a TODO note about not skipping the cutscene.
There is a setting we will want to have eventually that will require this cutscene to not be skipped since it is used during a glitch.
* remove todo
* restore fast ocarina option in imgui that was lost in merge
* Fixes grey screen issue + tooltip for 2 handed shield
* update to use dg instead of g for textures in item tracker
* TWEAK: Default color for cosmetic RAND button was not the corect one
* fix texture crash, remove unused item tracker code
* don't open mask shop until we get zelda's letter
* Update README.md
* Prevents "correct" chime under incorrect conditions.
* Fixes typo in conditional and adds "bonk" sound effect.
"Bonk" sound is NA_SE_SY_OCARINA_ERROR and it plays when conditions for the Door of Time have not been met after playing Song of Time. This is only possible in rando's "Intended" Door of Time option, in which the Ocarina of Time and all 3 spritual stones are required to open the door, instead of the vanilla requirements of just having the song of time.
* remove modify dpad equips toggle, replace with checks for dpad menu
* remove extra check
* add ability to hold c-up to assign to dpad when dpad menuing is enabled
* disable d-pad navigation on item menu when holding c-up to equip
* dpad+c-up stuff for equipment menu
* ADD: Checbox for songs colors
* TWEAK: RandoColors for normal songs
* kind of quick and dirty but it works
* TWEAK: Clarity of the tooltip
Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: aMannus <mannusmenting@gmail.com>
Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com>
Co-authored-by: Dog <5172592+Dog@users.noreply.github.com>
Co-authored-by: Vague Rant <vaguerant@users.noreply.github.com>
Co-authored-by: Baoulettes <perlouzerie@hotmail.fr>
Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com>
2022-07-11 20:11:07 -04:00
|
|
|
case SDL_DROPFILE:
|
|
|
|
CVar_SetString("gDroppedFile", event.drop.file);
|
|
|
|
CVar_SetS32("gNewFileDropped", 1);
|
|
|
|
Game::SaveSettings();
|
|
|
|
break;
|
2022-03-21 21:52:44 -04:00
|
|
|
case SDL_QUIT:
|
2022-07-13 23:12:11 -04:00
|
|
|
ModInternal::ExecuteHooks<ModInternal::ExitGame>();
|
2022-05-29 16:45:27 -04:00
|
|
|
SDL_Quit(); // bandaid fix for linux window closing issue
|
2022-03-21 21:52:44 -04:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool gfx_sdl_start_frame(void) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t qpc_to_100ns(uint64_t qpc) {
|
|
|
|
const uint64_t qpc_freq = SDL_GetPerformanceFrequency();
|
|
|
|
return qpc / qpc_freq * 10000000 + qpc % qpc_freq * 10000000 / qpc_freq;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void sync_framerate_with_timer(void) {
|
|
|
|
uint64_t t;
|
2022-05-29 12:16:23 -04:00
|
|
|
t = qpc_to_100ns(SDL_GetPerformanceCounter());
|
2022-03-21 21:52:44 -04:00
|
|
|
|
2022-05-29 12:16:23 -04:00
|
|
|
const int64_t next = previous_time + 10 * FRAME_INTERVAL_US_NUMERATOR / FRAME_INTERVAL_US_DENOMINATOR;
|
|
|
|
const int64_t left = next - t;
|
2022-03-21 21:52:44 -04:00
|
|
|
if (left > 0) {
|
2022-06-22 14:59:21 -04:00
|
|
|
#if defined __linux__ || defined __APPLE__
|
2022-03-21 21:52:44 -04:00
|
|
|
const timespec spec = { 0, left * 100 };
|
|
|
|
nanosleep(&spec, nullptr);
|
|
|
|
#else
|
2022-05-29 12:16:23 -04:00
|
|
|
// The accuracy of this timer seems to usually be within +- 1.0 ms
|
2022-03-21 21:52:44 -04:00
|
|
|
LARGE_INTEGER li;
|
|
|
|
li.QuadPart = -left;
|
|
|
|
SetWaitableTimer(timer, &li, 0, nullptr, nullptr, false);
|
|
|
|
WaitForSingleObject(timer, INFINITE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-05-29 12:16:23 -04:00
|
|
|
t = qpc_to_100ns(SDL_GetPerformanceCounter());
|
|
|
|
if (left > 0 && t - next < 10000) {
|
|
|
|
// In case it takes some time for the application to wake up after sleep,
|
|
|
|
// or inaccurate timer,
|
|
|
|
// don't let that slow down the framerate.
|
|
|
|
t = next;
|
|
|
|
}
|
2022-03-21 21:52:44 -04:00
|
|
|
previous_time = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_swap_buffers_begin(void) {
|
|
|
|
sync_framerate_with_timer();
|
|
|
|
SDL_GL_SwapWindow(wnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_swap_buffers_end(void) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static double gfx_sdl_get_time(void) {
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2022-05-29 12:16:23 -04:00
|
|
|
static void gfx_sdl_set_target_fps(int fps) {
|
|
|
|
target_fps = fps;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gfx_sdl_set_maximum_frame_latency(int latency) {
|
|
|
|
// Not supported by SDL :(
|
|
|
|
}
|
|
|
|
|
|
|
|
static float gfx_sdl_get_detected_hz(void) {
|
|
|
|
return 0;
|
2022-03-21 21:52:44 -04:00
|
|
|
}
|
|
|
|
|
2022-07-13 23:12:11 -04:00
|
|
|
static const char* gfx_sdl_get_key_name(int scancode) {
|
|
|
|
return SDL_GetScancodeName((SDL_Scancode) untranslate_scancode(scancode));
|
|
|
|
}
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
struct GfxWindowManagerAPI gfx_sdl = {
|
|
|
|
gfx_sdl_init,
|
|
|
|
gfx_sdl_set_keyboard_callbacks,
|
|
|
|
gfx_sdl_set_fullscreen_changed_callback,
|
|
|
|
gfx_sdl_set_fullscreen,
|
|
|
|
gfx_sdl_show_cursor,
|
|
|
|
gfx_sdl_main_loop,
|
|
|
|
gfx_sdl_get_dimensions,
|
|
|
|
gfx_sdl_handle_events,
|
|
|
|
gfx_sdl_start_frame,
|
|
|
|
gfx_sdl_swap_buffers_begin,
|
|
|
|
gfx_sdl_swap_buffers_end,
|
|
|
|
gfx_sdl_get_time,
|
2022-05-29 12:16:23 -04:00
|
|
|
gfx_sdl_set_target_fps,
|
|
|
|
gfx_sdl_set_maximum_frame_latency,
|
2022-07-13 23:12:11 -04:00
|
|
|
gfx_sdl_get_detected_hz,
|
|
|
|
gfx_sdl_get_key_name
|
2022-03-21 21:52:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|