Skip to content

Commit

Permalink
Spoiler Menu + Fixes (#77)
Browse files Browse the repository at this point in the history
* Spoiler Test (#72)

Testing Spoiler Menu

* Major update to menus.

Put things where they're supposed to go.

* More adjustments to gfx

* Compiles!

* Add awake callback.

* Formatting fixes.

* Update code info space and gfx hooks.

* Inputs are now working as intended.

* Menu now shows

* Added debug statement to show menu is opening but not drawing.

* Minor adjustments to input and newcodeinfo.

* Update exheader to support larger section_data size.

This should allow for a larger patch on the 3ds.

* Formatting.

Fix menu not showing with buffer issues.

* Update gfx.cpp (#73)

testing

* Remove unused header file.

* Fix improper memory allocation for custom messages (#74)

* Spoiler-Menu Update #1 (#75)

Reorganized in-game spoiler menu to make more sense. half implemented function to reveal checks on  obtain

* Fix warning in spoiler menu.

Remove magic barrier from being used without magic.

Currently the old zora swim system will be used until I can find a way to patch it back.

* Basecode update.

* Basecode change.

* Change which IPS patch is actually brought in.

* Update small keys for custom text.

* Finish custom text for dungeon items.

* Clang formatting.

* Update asm for banker reward.

* Include icons in spoiler menus.

* Adjust item effects to hopefully resolve the small key issue.

* Include fixes for tingle map overrides and custom text.

Tingle will now show what he actually sells!

* Use select as default for opening spoiler menu.

Have checks on start/select if a user has the spoiler menu assigned to do no action.

* Clang formatting.

* Remove giving sword back on time reset.

* Remove debug statement

---------

Co-authored-by: Tacoman369 <90735287+Tacoman369@users.noreply.github.com>
Co-authored-by: Nessy <robert@nesfield.co.uk>
  • Loading branch information
3 people authored Nov 19, 2023
1 parent 7530dac commit a9922cb
Show file tree
Hide file tree
Showing 29 changed files with 2,169 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ oldcode/loader/build
*.smdh
*.pyc
*.ips
!basecode1.1.ips
!deltapatch.ips
*.zar
source/patch_symbols.hpp
.DS_Store
Binary file renamed code/basecode1.1.ips → code/deltapatch.ips
Binary file not shown.
4 changes: 4 additions & 0 deletions code/include/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,9 @@ typedef struct {
#define BUTTON_L1 (1 << 9)
#define BUTTON_X (1 << 10)
#define BUTTON_Y (1 << 11)
#define CPAD_RIGHT (1 << 28)
#define CPAD_LEFT (1 << 29)
#define CPAD_UP (1 << 30)
#define CPAD_DOWN (1 << 31)

#endif // HID_H
58 changes: 57 additions & 1 deletion code/include/draw.h → code/include/rnd/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
extern "C" {
#include <3ds/gfx.h>
#include <3ds/types.h>
}

#define FB_BOTTOM_VRAM_ADDR ((void*)0x1F48F000) // cached
#define FB_BOTTOM_VRAM_PA 0x1848F000
Expand All @@ -42,22 +44,73 @@
#define SPACING_Y 11
#define SPACING_X 6

#define SPACING_SMALL_Y 9
#define SPACING_SMALL_X 6
#define RGB8(r, g, b) (((b)&0xFF) | (((g)&0xFF) << 8) | (((r)&0xFF) << 16))

#define COLOR_TITLE RGB8(0x33, 0x33, 0xFF)
#define COLOR_WHITE RGB8(0xFF, 0xFF, 0xFF)
#define COLOR_RED RGB8(0xFF, 0x00, 0x00)
#define COLOR_GREEN RGB8(0x00, 0xFF, 0x00)
#define COLOR_BLUE RGB8(0x56, 0xB4, 0xE9)
#define COLOR_ORANGE RGB8(0xE6, 0x9F, 0x00)
#define COLOR_YELLOW RGB8(0xF0, 0xE4, 0x42)
#define COLOR_PINK RGB8(0xCC, 0x79, 0xA7)
#define COLOR_BLACK RGB8(0x00, 0x00, 0x00)
#define COLOR_DARK_GRAY RGB8(0x29, 0x29, 0x29)
#define COLOR_LIGHT_GRAY RGB8(0x71, 0x71, 0x71)

#define DRAW_MAX_FORMATTED_STRING_SIZE 512

#define ICON_WIDTH 8
#define ICON_HEIGHT 8

typedef enum {
DISPLAY_0 = 0x400,
DISPLAY_1 = 0x401,
DISPLAY_BOTH = 0x402,
DISPLAY0_EXT = 0x410,
} Draw_Display;

typedef enum {
ICON_SMALL_KEY,
ICON_BOSS_KEY,
ICON_TRIFORCE,
ICON_FOOL,
ICON_CHECK,
ICON_NO,
ICON_VANILLA,
ICON_MASTER_QUEST,
ICON_MAP,
ICON_COMPASS,
ICON_BUTTON_R,
ICON_BUTTON_R_WIDE_1,
ICON_BUTTON_R_WIDE_2,
ICON_BUTTON_L,
ICON_BUTTON_L_WIDE_1,
ICON_BUTTON_L_WIDE_2,
ICON_BUTTON_A,
ICON_BUTTON_B,
ICON_BUTTON_X,
ICON_BUTTON_Y,
ICON_BUTTON_DPAD,
ICON_BUTTON_FACE,
ICON_BUTTON_FACEH,
ICON_BUTTON_FACEV,
ICON_BUTTON_JOYSTICK,
ICONS_COUNT
} Draw_IconType;

void Draw_Lock(void);
void Draw_Unlock(void);

void Draw_DrawIcon(u32 posX, u32 posY, u32 color, Draw_IconType icon);
void Draw_DrawRect(u32 posX, u32 posY, u32 width, u32 height, u32 color);
void Draw_DrawCharacter(u32 posX, u32 posY, u32 color, char character);
u32 Draw_DrawString(u32 posX, u32 posY, u32 color, const char* string);
u32 Draw_DrawString_Small(u32 posX, u32 posY, u32 color, const char* string);
u32 Draw_DrawFormattedString(u32 posX, u32 posY, u32 color, const char* fmt, ...);
u32 Draw_DrawFormattedString_Small(u32 posX, u32 posY, u32 color, const char* fmt, ...);

void Draw_DrawCharacterTop(u32 posX, u32 posY, u32 color, char character);
u32 Draw_DrawStringTop(u32 posX, u32 posY, u32 color, const char* string);
Expand All @@ -66,6 +119,9 @@ u32 Draw_DrawFormattedStringTop(u32 posX, u32 posY, u32 color, const char* fmt,
void Draw_FillFramebuffer(u32 value);
void Draw_ClearFramebuffer(void);
void Draw_SetupFramebuffer(void);
void Draw_FillBackBuffer(void);
void Draw_ClearBackbuffer(void);
void Draw_CopyBackBuffer(void);
void Draw_FlushFramebuffer(void);
void Draw_FlushFramebufferTop(void);

Expand Down Expand Up @@ -97,4 +153,4 @@ struct Graphics {
Framebuffer top1;
Framebuffer top2;
Framebuffer bottom;
};
};
56 changes: 56 additions & 0 deletions code/include/rnd/dungeon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef _RND_DUNGEON_H
#define _RND_DUNGEON_H

#include <string.h>
#include "rnd/savefile.h"
#include "rnd/settings.h"
#include "rnd/spoiler_data.h"
//#include "rnd/draw.h"
extern "C" {
#include <3ds/svc.h>
}

#define WOODFALL_KEY_COUNT 1
#define SNOWHEAD_KEY_COUNT 3
#define GREAT_KEY_COUNT 1
#define STONE_KEY_COUNT 4

namespace rnd {

typedef struct {
u16 spoilerIndex;
u8 keyAmount;
} KeyData;

typedef enum {
DUNGEON_WOODFALL = 0,
DUNGEON_SNOWHEAD,
DUNGEON_GREAT_BAY,
DUNGEON_STONE_TOWER,
DUNGEON_PIRATE_FORTRESS,
DUNGEON_BENEATH_THE_WELL,
DUNGEON_IKANA_CASTLE,
DUNGEON_SECRET_SHRINE,
DUNGEON_THE_MOON,
DUNGEON_SWAMP_SKULLTULA_HOUSE,
DUNGEON_OCEAN_SKULLTULA_HOUSE,
} DungeonId;

extern const char DungeonNames[][25];

static const char* const smallKeyStringWoodfall = "Woodfall Temple Small Key";
static const char* const smallKeyStringSnowhead = "Snowhead Temple Small Key";
static const char* const smallKeyStringGreatBay = "Great Bay Temple Small Key";
static const char* const smallKeyStringStone = "Stone Tower Temple Small Key";

static const char* const keyRingStringWoodfall = "Woodfall Temple Key Ring";
static const char* const keyRingStringSnowhead = "Snowhead Temple Key Ring";
static const char* const keyRingStringGreatBay = "Great Bay Temple Key Ring";
static const char* const keyRingStringStone = "Stone Tower Temple Key Ring";

u8 Dungeon_KeyAmount(u32);
u8 Dungeon_FoundSmallKeys(u32);

} // namespace rnd

#endif
67 changes: 67 additions & 0 deletions code/include/rnd/gfx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#ifndef _RND_GFX_H_
#define _RND_GFX_H_

#include "common/types.h"
#include "hid.h"
#include "rnd/custom_models.h"
#include "rnd/draw.h"
#include "rnd/dungeon.h"
#include "rnd/input.h"
#include "rnd/rheap.h"
#include "rnd/savefile.h"
#include "rnd/settings.h"
#include "rnd/spoiler_data.h"
#include "rnd/title_screen.h"
extern "C" {
#include <3ds/svc.h>
}

namespace rnd {
#define TICKS_PER_SEC 268123480
#define MAX_TICK_DELTA (TICKS_PER_SEC * 3)

#define UP_ARROW_CHR 24
#define DOWN_ARROW_CHR 25
#define LEFT_ARROW_CHR 27
#define RIGHT_ARROW_CHR 26
#define H_DOUBLE_ARROW_CHR 29
#define UP_SOLID_ARROW_CHR 30
#define DOWN_SOLID_ARROW_CHR 31

#define MAX_ENTRY_LINES 9
#define SCROLL_BAR_THICKNESS 2
#define SCROLL_BAR_MIN_THUMB_SIZE 4
#define COLOR_WARN RGB8(0xD1, 0xDF, 0x3C)
#define COLOR_SCROLL_BAR_BG RGB8(0x58, 0x58, 0x58)

#define COLOR_ICON_BOSS_KEY RGB8(0x20, 0xF9, 0x25)
#define COLOR_ICON_MAP RGB8(0xF9, 0x97, 0xFF)
#define COLOR_ICON_COMPASS RGB8(0x20, 0x3A, 0xF9)
#define COLOR_ICON_WOTH RGB8(0xFF, 0xF8, 0x2D)
#define COLOR_ICON_FOOL RGB8(0xFF, 0x2D, 0x4B)

#define COLOR_BUTTON_A RGB8(0xFF, 0x49, 0x3E)
#define COLOR_BUTTON_B RGB8(0xFD, 0xDD, 0x68)
#define COLOR_BUTTON_X RGB8(0x32, 0x7D, 0xFE)
#define COLOR_BUTTON_Y RGB8(0x00, 0xD0, 0x98)

typedef enum {
PAGE_SEEDHASH,
PAGE_DUNGEONITEMS,
PAGE_SPHERES,
PAGE_ITEMTRACKER_ALL,
PAGE_ITEMTRACKER_GROUPS,
PAGE_ENTRANCETRACKER_ALL,
PAGE_ENTRANCETRACKER_GROUPS,
PAGE_OPTIONS,
} GfxPage;

void Gfx_Init(void);
static u8 openingButton();
extern "C" void Gfx_Update();
extern "C" void Gfx_SleepQueryCallback();
extern "C" void Gfx_AwakeCallback();

} // namespace rnd

#endif //_RND_GFX_H_
Loading

0 comments on commit a9922cb

Please sign in to comment.