Bunch of updates refactoring adding some sneshacking code some gui stuff
This commit is contained in:
@@ -9,343 +9,397 @@ namespace Application {
|
|||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
// ===========================================================================================
|
using ushort = unsigned short;
|
||||||
// Graphics
|
|
||||||
// ===========================================================================================
|
|
||||||
|
|
||||||
constexpr int tile_address = 0x1B52; // JP = Same
|
//===========================================================================================
|
||||||
constexpr int tile_address_floor = 0x1B5A; // JP = Same
|
// Magic numbers
|
||||||
constexpr int subtype1_tiles = 0x8000; // JP = Same
|
//===========================================================================================
|
||||||
constexpr int subtype2_tiles = 0x83F0; // JP = Same
|
/// <summary>
|
||||||
constexpr int subtype3_tiles = 0x84F0; // JP = Same
|
/// Bit set for object priority
|
||||||
constexpr int gfx_animated_pointer = 0x10275; //JP 0x10624 //long pointer
|
/// </summary>
|
||||||
constexpr int overworldgfxGroups2 = 0x6073; //0x60B3
|
constexpr ushort TilePriorityBit = 0x2000;
|
||||||
constexpr int gfx_1_pointer = 0x6790; //2byte pointer bank 00 pc -> 0x4320 CF80 ; 004F80
|
|
||||||
constexpr int gfx_2_pointer = 0x6795; //D05F ; 00505F
|
|
||||||
constexpr int gfx_3_pointer = 0x679A; //D13E ; 00513E
|
|
||||||
constexpr int hud_palettes = 0xDD660;
|
|
||||||
constexpr int maxGfx = 0xC3FB5;
|
|
||||||
|
|
||||||
// ===========================================================================================
|
/// <summary>
|
||||||
// Overworld Related Variables
|
/// Bit set for object hflip
|
||||||
// ===========================================================================================
|
/// </summary>
|
||||||
|
constexpr ushort TileHFlipBit = 0x4000;
|
||||||
|
|
||||||
constexpr int compressedAllMap32PointersHigh = 0x1794D;
|
/// <summary>
|
||||||
constexpr int compressedAllMap32PointersLow = 0x17B2D;
|
/// Bit set for object vflip
|
||||||
constexpr int overworldgfxGroups = 0x05D97;
|
/// </summary>
|
||||||
constexpr int map16Tiles = 0x78000;
|
constexpr ushort TileVFlipBit = 0x8000;
|
||||||
constexpr int map32TilesTL = 0x18000;
|
|
||||||
constexpr int map32TilesTR = 0x1B400;
|
|
||||||
constexpr int map32TilesBL = 0x20000;
|
|
||||||
constexpr int map32TilesBR = 0x23400;
|
|
||||||
constexpr int overworldPalGroup1 = 0xDE6C8;
|
|
||||||
constexpr int overworldPalGroup2 = 0xDE86C;
|
|
||||||
constexpr int overworldPalGroup3 = 0xDE604;
|
|
||||||
constexpr int overworldMapPalette = 0x7D1C;
|
|
||||||
constexpr int overworldSpritePalette = 0x7B41;
|
|
||||||
constexpr int overworldMapPaletteGroup = 0x75504;
|
|
||||||
constexpr int overworldSpritePaletteGroup = 0x75580;
|
|
||||||
constexpr int overworldSpriteset = 0x7A41;
|
|
||||||
constexpr int overworldSpecialGFXGroup = 0x16821;
|
|
||||||
constexpr int overworldSpecialPALGroup = 0x16831;
|
|
||||||
|
|
||||||
constexpr int overworldSpritesBegining = 0x4C881;
|
/// <summary>
|
||||||
constexpr int overworldSpritesAgahnim = 0x4CA21;
|
/// Bits used for tile name
|
||||||
constexpr int overworldSpritesZelda = 0x4C901;
|
/// </summary>
|
||||||
|
constexpr ushort TileNameMask = 0x03FF;
|
||||||
|
|
||||||
constexpr int overworldItemsPointers = 0xDC2F9;
|
constexpr int Uncompressed3BPPSize = 0x0600;
|
||||||
constexpr int overworldItemsAddress = 0xDC8B9; //1BC2F9
|
constexpr int UncompressedSheetSize = 0x0800;
|
||||||
constexpr int overworldItemsBank = 0xDC8BF;
|
|
||||||
constexpr int overworldItemsEndData = 0xDC89C; //0DC89E
|
|
||||||
|
|
||||||
constexpr int mapGfx = 0x7C9C;
|
constexpr int NumberOfSheets = 223;
|
||||||
constexpr int overlayPointers = 0x77664;
|
constexpr int LimitOfMap32 = 8864;
|
||||||
constexpr int overlayPointersBank = 0x0E;
|
constexpr int NumberOfRooms = 296;
|
||||||
|
|
||||||
constexpr int overworldTilesType = 0x71459;
|
constexpr int NumberOfOWMaps = 160;
|
||||||
constexpr int overworldMessages = 0x3F51D;
|
constexpr int Map32PerScreen = 256;
|
||||||
|
constexpr int NumberOfMap16 = 3752; // 4096
|
||||||
|
constexpr int NumberOfMap32 = Map32PerScreen * NumberOfOWMaps;
|
||||||
|
constexpr int NumberOfOWSprites = 352;
|
||||||
|
constexpr int NumberOfColors = 3143;
|
||||||
|
|
||||||
//TODO:
|
// ===========================================================================================
|
||||||
constexpr int overworldMusicBegining = 0x14303;
|
// Graphics
|
||||||
constexpr int overworldMusicZelda = 0x14303 + 0x40;
|
// ===========================================================================================
|
||||||
constexpr int overworldMusicMasterSword = 0x14303 + 0x80;
|
|
||||||
constexpr int overworldMusicAgahim = 0x14303 + 0xC0;
|
|
||||||
constexpr int overworldMusicDW = 0x14403;
|
|
||||||
|
|
||||||
constexpr int overworldEntranceAllowedTilesLeft = 0xDB8C1;
|
constexpr int tile_address = 0x1B52; // JP = Same
|
||||||
constexpr int overworldEntranceAllowedTilesRight = 0xDB917;
|
constexpr int tile_address_floor = 0x1B5A; // JP = Same
|
||||||
|
constexpr int subtype1_tiles = 0x8000; // JP = Same
|
||||||
|
constexpr int subtype2_tiles = 0x83F0; // JP = Same
|
||||||
|
constexpr int subtype3_tiles = 0x84F0; // JP = Same
|
||||||
|
constexpr int gfx_animated_pointer = 0x10275; // JP 0x10624 //long pointer
|
||||||
|
constexpr int overworldgfxGroups2 = 0x6073; // 0x60B3
|
||||||
|
constexpr int gfx_1_pointer =
|
||||||
|
0x6790; // 2byte pointer bank 00 pc -> 0x4320 CF80 ; 004F80
|
||||||
|
constexpr int gfx_2_pointer = 0x6795; // D05F ; 00505F
|
||||||
|
constexpr int gfx_3_pointer = 0x679A; // D13E ; 00513E
|
||||||
|
constexpr int hud_palettes = 0xDD660;
|
||||||
|
constexpr int maxGfx = 0xC3FB5;
|
||||||
|
|
||||||
constexpr int overworldMapSize = 0x12844; //0x00 = small maps, 0x20 = large maps
|
// ===========================================================================================
|
||||||
constexpr int overworldMapSizeHighByte = 0x12884; //0x01 = small maps, 0x03 = large maps
|
// Overworld Related Variables
|
||||||
|
// ===========================================================================================
|
||||||
|
|
||||||
//relative to the WORLD + 0x200 per map
|
constexpr int compressedAllMap32PointersHigh = 0x1794D;
|
||||||
//large map that are not == parent id = same position as their parent!
|
constexpr int compressedAllMap32PointersLow = 0x17B2D;
|
||||||
//eg for X position small maps :
|
constexpr int overworldgfxGroups = 0x05D97;
|
||||||
//0000, 0200, 0400, 0600, 0800, 0A00, 0C00, 0E00
|
constexpr int map16Tiles = 0x78000;
|
||||||
//all Large map would be :
|
constexpr int map32TilesTL = 0x18000;
|
||||||
//0000, 0000, 0400, 0400, 0800, 0800, 0C00, 0C00
|
constexpr int map32TilesTR = 0x1B400;
|
||||||
|
constexpr int map32TilesBL = 0x20000;
|
||||||
|
constexpr int map32TilesBR = 0x23400;
|
||||||
|
constexpr int overworldPalGroup1 = 0xDE6C8;
|
||||||
|
constexpr int overworldPalGroup2 = 0xDE86C;
|
||||||
|
constexpr int overworldPalGroup3 = 0xDE604;
|
||||||
|
constexpr int overworldMapPalette = 0x7D1C;
|
||||||
|
constexpr int overworldSpritePalette = 0x7B41;
|
||||||
|
constexpr int overworldMapPaletteGroup = 0x75504;
|
||||||
|
constexpr int overworldSpritePaletteGroup = 0x75580;
|
||||||
|
constexpr int overworldSpriteset = 0x7A41;
|
||||||
|
constexpr int overworldSpecialGFXGroup = 0x16821;
|
||||||
|
constexpr int overworldSpecialPALGroup = 0x16831;
|
||||||
|
|
||||||
constexpr int overworldTransitionPositionY = 0x128C4;
|
constexpr int overworldSpritesBegining = 0x4C881;
|
||||||
constexpr int overworldTransitionPositionX = 0x12944;
|
constexpr int overworldSpritesAgahnim = 0x4CA21;
|
||||||
|
constexpr int overworldSpritesZelda = 0x4C901;
|
||||||
|
|
||||||
constexpr int overworldScreenSize = 0x1788D;
|
constexpr int overworldItemsPointers = 0xDC2F9;
|
||||||
|
constexpr int overworldItemsAddress = 0xDC8B9; // 1BC2F9
|
||||||
|
constexpr int overworldItemsBank = 0xDC8BF;
|
||||||
|
constexpr int overworldItemsEndData = 0xDC89C; // 0DC89E
|
||||||
|
|
||||||
//===========================================================================================
|
constexpr int mapGfx = 0x7C9C;
|
||||||
//Overworld Exits/Entrances Variables
|
constexpr int overlayPointers = 0x77664;
|
||||||
//===========================================================================================
|
constexpr int overlayPointersBank = 0x0E;
|
||||||
constexpr int OWExitRoomId = 0x15D8A; // 0x15E07 Credits sequences
|
|
||||||
//105C2 Ending maps
|
|
||||||
//105E2 Sprite Group Table for Ending
|
|
||||||
constexpr int OWExitMapId = 0x15E28;
|
|
||||||
constexpr int OWExitVram = 0x15E77;
|
|
||||||
constexpr int OWExitYScroll = 0x15F15;
|
|
||||||
constexpr int OWExitXScroll = 0x15FB3;
|
|
||||||
constexpr int OWExitYPlayer = 0x16051;
|
|
||||||
constexpr int OWExitXPlayer = 0x160EF;
|
|
||||||
constexpr int OWExitYCamera = 0x1618D;
|
|
||||||
constexpr int OWExitXCamera = 0x1622B;
|
|
||||||
constexpr int OWExitDoorPosition = 0x15724;
|
|
||||||
constexpr int OWExitUnk1 = 0x162C9;
|
|
||||||
constexpr int OWExitUnk2 = 0x16318;
|
|
||||||
constexpr int OWExitDoorType1 = 0x16367;
|
|
||||||
constexpr int OWExitDoorType2 = 0x16405;
|
|
||||||
constexpr int OWEntranceMap = 0xDB96F;
|
|
||||||
constexpr int OWEntrancePos = 0xDBA71;
|
|
||||||
constexpr int OWEntranceEntranceId = 0xDBB73;
|
|
||||||
constexpr int OWHolePos = 0xDB800;//(0x13 entries, 2 bytes each) modified(less 0x400) map16 coordinates for each hole
|
|
||||||
constexpr int OWHoleArea = 0xDB826;//(0x13 entries, 2 bytes each) corresponding area numbers for each hole
|
|
||||||
constexpr int OWHoleEntrance = 0xDB84C;//(0x13 entries, 1 byte each) corresponding entrance numbers
|
|
||||||
|
|
||||||
constexpr int OWExitMapIdWhirlpool = 0x16AE5; // JP = ;016849
|
constexpr int overworldTilesType = 0x71459;
|
||||||
constexpr int OWExitVramWhirlpool = 0x16B07; // JP = ;01686B
|
constexpr int overworldMessages = 0x3F51D;
|
||||||
constexpr int OWExitYScrollWhirlpool = 0x16B29;// JP = ;01688D
|
|
||||||
constexpr int OWExitXScrollWhirlpool = 0x16B4B;// JP = ;016DE7
|
|
||||||
constexpr int OWExitYPlayerWhirlpool = 0x16B6D;// JP = ;016E09
|
|
||||||
constexpr int OWExitXPlayerWhirlpool = 0x16B8F;// JP = ;016E2B
|
|
||||||
constexpr int OWExitYCameraWhirlpool = 0x16BB1;// JP = ;016E4D
|
|
||||||
constexpr int OWExitXCameraWhirlpool = 0x16BD3;// JP = ;016E6F
|
|
||||||
constexpr int OWExitUnk1Whirlpool = 0x16BF5;// JP = ;016E91
|
|
||||||
constexpr int OWExitUnk2Whirlpool = 0x16C17;// JP = ;016EB3
|
|
||||||
constexpr int OWWhirlpoolPosition = 0x16CF8;// JP = ;016F94
|
|
||||||
|
|
||||||
//===========================================================================================
|
// TODO:
|
||||||
//Dungeon Related Variables
|
constexpr int overworldMusicBegining = 0x14303;
|
||||||
//===========================================================================================
|
constexpr int overworldMusicZelda = 0x14303 + 0x40;
|
||||||
//That could be turned into a pointer :
|
constexpr int overworldMusicMasterSword = 0x14303 + 0x80;
|
||||||
constexpr int dungeons_palettes_groups = 0x75460; //JP 0x67DD0
|
constexpr int overworldMusicAgahim = 0x14303 + 0xC0;
|
||||||
constexpr int dungeons_main_bg_palette_pointers = 0xDEC4B; //JP Same
|
constexpr int overworldMusicDW = 0x14403;
|
||||||
constexpr int dungeons_palettes = 0xDD734; //JP Same (where all dungeons palettes are)
|
|
||||||
|
|
||||||
//That could be turned into a pointer :
|
constexpr int overworldEntranceAllowedTilesLeft = 0xDB8C1;
|
||||||
constexpr int room_items_pointers = 0xDB69;//JP 0xDB67
|
constexpr int overworldEntranceAllowedTilesRight = 0xDB917;
|
||||||
|
|
||||||
constexpr int rooms_sprite_pointer = 0x4C298; //JP Same //2byte bank 09D62E
|
constexpr int overworldMapSize = 0x12844; // 0x00 = small maps, 0x20 = large
|
||||||
constexpr int room_header_pointer = 0xB5DD; //LONG
|
// maps
|
||||||
constexpr int room_header_pointers_bank = 0xB5E7; //JP Same
|
constexpr int overworldMapSizeHighByte =
|
||||||
|
0x12884; // 0x01 = small maps, 0x03 = large maps
|
||||||
|
|
||||||
constexpr int gfx_groups_pointer = 0x6237;
|
// relative to the WORLD + 0x200 per map
|
||||||
constexpr int room_object_layout_pointer = 0x882D;
|
// large map that are not == parent id = same position as their parent!
|
||||||
|
// eg for X position small maps :
|
||||||
|
// 0000, 0200, 0400, 0600, 0800, 0A00, 0C00, 0E00
|
||||||
|
// all Large map would be :
|
||||||
|
// 0000, 0000, 0400, 0400, 0800, 0800, 0C00, 0C00
|
||||||
|
|
||||||
constexpr int room_object_pointer = 0x874C; //Long pointer
|
constexpr int overworldTransitionPositionY = 0x128C4;
|
||||||
|
constexpr int overworldTransitionPositionX = 0x12944;
|
||||||
|
|
||||||
constexpr int chests_length_pointer = 0xEBF6;
|
constexpr int overworldScreenSize = 0x1788D;
|
||||||
constexpr int chests_data_pointer1 = 0xEBFB;
|
|
||||||
//constexpr int chests_data_pointer2 = 0xEC0A; //Disabled for now could be used for expansion
|
|
||||||
//constexpr int chests_data_pointer3 = 0xEC10; //Disabled for now could be used for expansion
|
|
||||||
|
|
||||||
constexpr int blocks_length = 0x8896; //word value
|
//===========================================================================================
|
||||||
constexpr int blocks_pointer1 = 0x15AFA;
|
// Overworld Exits/Entrances Variables
|
||||||
constexpr int blocks_pointer2 = 0x15B01;
|
//===========================================================================================
|
||||||
constexpr int blocks_pointer3 = 0x15B08;
|
constexpr int OWExitRoomId = 0x15D8A; // 0x15E07 Credits sequences
|
||||||
constexpr int blocks_pointer4 = 0x15B0F;
|
// 105C2 Ending maps
|
||||||
|
// 105E2 Sprite Group Table for Ending
|
||||||
|
constexpr int OWExitMapId = 0x15E28;
|
||||||
|
constexpr int OWExitVram = 0x15E77;
|
||||||
|
constexpr int OWExitYScroll = 0x15F15;
|
||||||
|
constexpr int OWExitXScroll = 0x15FB3;
|
||||||
|
constexpr int OWExitYPlayer = 0x16051;
|
||||||
|
constexpr int OWExitXPlayer = 0x160EF;
|
||||||
|
constexpr int OWExitYCamera = 0x1618D;
|
||||||
|
constexpr int OWExitXCamera = 0x1622B;
|
||||||
|
constexpr int OWExitDoorPosition = 0x15724;
|
||||||
|
constexpr int OWExitUnk1 = 0x162C9;
|
||||||
|
constexpr int OWExitUnk2 = 0x16318;
|
||||||
|
constexpr int OWExitDoorType1 = 0x16367;
|
||||||
|
constexpr int OWExitDoorType2 = 0x16405;
|
||||||
|
constexpr int OWEntranceMap = 0xDB96F;
|
||||||
|
constexpr int OWEntrancePos = 0xDBA71;
|
||||||
|
constexpr int OWEntranceEntranceId = 0xDBB73;
|
||||||
|
constexpr int OWHolePos = 0xDB800; //(0x13 entries, 2 bytes each) modified(less
|
||||||
|
// 0x400) map16 coordinates for each hole
|
||||||
|
constexpr int OWHoleArea = 0xDB826; //(0x13 entries, 2 bytes each) corresponding
|
||||||
|
// area numbers for each hole
|
||||||
|
constexpr int OWHoleEntrance =
|
||||||
|
0xDB84C; //(0x13 entries, 1 byte each) corresponding entrance numbers
|
||||||
|
|
||||||
constexpr int torch_data = 0x2736A; //JP 0x2704A
|
constexpr int OWExitMapIdWhirlpool = 0x16AE5; // JP = ;016849
|
||||||
constexpr int torches_length_pointer = 0x88C1;
|
constexpr int OWExitVramWhirlpool = 0x16B07; // JP = ;01686B
|
||||||
|
constexpr int OWExitYScrollWhirlpool = 0x16B29; // JP = ;01688D
|
||||||
|
constexpr int OWExitXScrollWhirlpool = 0x16B4B; // JP = ;016DE7
|
||||||
|
constexpr int OWExitYPlayerWhirlpool = 0x16B6D; // JP = ;016E09
|
||||||
|
constexpr int OWExitXPlayerWhirlpool = 0x16B8F; // JP = ;016E2B
|
||||||
|
constexpr int OWExitYCameraWhirlpool = 0x16BB1; // JP = ;016E4D
|
||||||
|
constexpr int OWExitXCameraWhirlpool = 0x16BD3; // JP = ;016E6F
|
||||||
|
constexpr int OWExitUnk1Whirlpool = 0x16BF5; // JP = ;016E91
|
||||||
|
constexpr int OWExitUnk2Whirlpool = 0x16C17; // JP = ;016EB3
|
||||||
|
constexpr int OWWhirlpoolPosition = 0x16CF8; // JP = ;016F94
|
||||||
|
|
||||||
constexpr int sprite_blockset_pointer = 0x5B57;
|
//===========================================================================================
|
||||||
constexpr int sprites_data = 0x4D8B0;//It use the unused pointers to have more space //Save purpose
|
// Dungeon Related Variables
|
||||||
constexpr int sprites_data_empty_room = 0x4D8AE;
|
//===========================================================================================
|
||||||
constexpr int sprites_end_data = 0x4EC9E;
|
// That could be turned into a pointer :
|
||||||
|
constexpr int dungeons_palettes_groups = 0x75460; // JP 0x67DD0
|
||||||
|
constexpr int dungeons_main_bg_palette_pointers = 0xDEC4B; // JP Same
|
||||||
|
constexpr int dungeons_palettes =
|
||||||
|
0xDD734; // JP Same (where all dungeons palettes are)
|
||||||
|
|
||||||
constexpr int pit_pointer = 0x394AB;
|
// That could be turned into a pointer :
|
||||||
constexpr int pit_count = 0x394A6;
|
constexpr int room_items_pointers = 0xDB69; // JP 0xDB67
|
||||||
|
|
||||||
constexpr int doorPointers = 0xF83C0;
|
constexpr int rooms_sprite_pointer = 0x4C298; // JP Same //2byte bank 09D62E
|
||||||
|
constexpr int room_header_pointer = 0xB5DD; // LONG
|
||||||
|
constexpr int room_header_pointers_bank = 0xB5E7; // JP Same
|
||||||
|
|
||||||
//doors
|
constexpr int gfx_groups_pointer = 0x6237;
|
||||||
constexpr int door_gfx_up = 0x4D9E;
|
constexpr int room_object_layout_pointer = 0x882D;
|
||||||
//
|
|
||||||
constexpr int door_gfx_down = 0x4E06;
|
|
||||||
constexpr int door_gfx_cavexit_down = 0x4E06;
|
|
||||||
constexpr int door_gfx_left = 0x4E66;
|
|
||||||
constexpr int door_gfx_right = 0x4EC6;
|
|
||||||
|
|
||||||
constexpr int door_pos_up = 0x197E;
|
constexpr int room_object_pointer = 0x874C; // Long pointer
|
||||||
constexpr int door_pos_down = 0x1996;
|
|
||||||
constexpr int door_pos_left = 0x19AE;
|
|
||||||
constexpr int door_pos_right = 0x19C6;
|
|
||||||
|
|
||||||
//TEXT EDITOR RELATED CONSTANTS
|
constexpr int chests_length_pointer = 0xEBF6;
|
||||||
constexpr int gfx_font = 0x70000; //2bpp format
|
constexpr int chests_data_pointer1 = 0xEBFB;
|
||||||
constexpr int text_data = 0xE0000;
|
// constexpr int chests_data_pointer2 = 0xEC0A; //Disabled for now could be used
|
||||||
constexpr int text_data2 = 0x75F40;
|
// for expansion constexpr int chests_data_pointer3 = 0xEC10; //Disabled for now
|
||||||
constexpr int pointers_dictionaries = 0x74703;
|
// could be used for expansion
|
||||||
constexpr int characters_width = 0x74ADF;
|
|
||||||
|
|
||||||
//===========================================================================================
|
constexpr int blocks_length = 0x8896; // word value
|
||||||
//Dungeon Entrances Related Variables
|
constexpr int blocks_pointer1 = 0x15AFA;
|
||||||
//===========================================================================================
|
constexpr int blocks_pointer2 = 0x15B01;
|
||||||
constexpr int entrance_room = 0x14813; //0x14577 //word value for each room
|
constexpr int blocks_pointer3 = 0x15B08;
|
||||||
constexpr int entrance_scrolledge = 0x1491D; //0x14681 //8 bytes per room, HU, FU, HD, FD, HL, FL, HR, FR
|
constexpr int blocks_pointer4 = 0x15B0F;
|
||||||
constexpr int entrance_yscroll = 0x14D45; // 0x14AA9 //2bytes each room
|
|
||||||
constexpr int entrance_xscroll = 0x14E4F; // 0x14BB3 //2bytes
|
|
||||||
constexpr int entrance_yposition = 0x14F59; //0x14CBD 2bytes
|
|
||||||
constexpr int entrance_xposition = 0x15063;// 0x14DC7 2bytes
|
|
||||||
constexpr int entrance_camerayposition = 0x1516D;// 0x14ED1 2bytes
|
|
||||||
constexpr int entrance_cameraxposition = 0x15277;// 0x14FDB 2bytes
|
|
||||||
|
|
||||||
constexpr int entrance_gfx_group = 0x5D97;
|
constexpr int torch_data = 0x2736A; // JP 0x2704A
|
||||||
constexpr int entrance_blockset = 0x15381; //0x150E5 1byte
|
constexpr int torches_length_pointer = 0x88C1;
|
||||||
constexpr int entrance_floor = 0x15406; // 0x1516A 1byte
|
|
||||||
constexpr int entrance_dungeon = 0x1548B; // 0x151EF 1byte (dungeon id)
|
|
||||||
constexpr int entrance_door = 0x15510; // 0x15274 1byte
|
|
||||||
constexpr int entrance_ladderbg = 0x15595; //0x152F9 //1 byte, ---b ---a b = bg2, a = need to check -_-
|
|
||||||
constexpr int entrance_scrolling = 0x1561A;//0x1537E //1byte --h- --v-
|
|
||||||
constexpr int entrance_scrollquadrant = 0x1569F; //0x15403 1byte
|
|
||||||
constexpr int entrance_exit = 0x15724; //0x15488 //2byte word
|
|
||||||
constexpr int entrance_music = 0x1582E; //0x15592
|
|
||||||
|
|
||||||
constexpr int startingentrance_room = 0x15B6E; //0x158D2 //word value for each room
|
constexpr int sprite_blockset_pointer = 0x5B57;
|
||||||
constexpr int startingentrance_scrolledge = 0x15B7C; //0x158E0 //8 bytes per room, HU, FU, HD, FD, HL, FL, HR, FR
|
constexpr int sprites_data =
|
||||||
constexpr int startingentrance_yscroll = 0x15BB4; // 0x14AA9 //2bytes each room
|
0x4D8B0; // It use the unused pointers to have more space //Save purpose
|
||||||
constexpr int startingentrance_xscroll = 0x15BC2; // 0x14BB3 //2bytes
|
constexpr int sprites_data_empty_room = 0x4D8AE;
|
||||||
constexpr int startingentrance_yposition = 0x15BD0; //0x14CBD 2bytes
|
constexpr int sprites_end_data = 0x4EC9E;
|
||||||
constexpr int startingentrance_xposition = 0x15BDE;// 0x14DC7 2bytes
|
|
||||||
constexpr int startingentrance_camerayposition = 0x15BEC;// 0x14ED1 2bytes
|
|
||||||
constexpr int startingentrance_cameraxposition = 0x15BFA;// 0x14FDB 2bytes
|
|
||||||
|
|
||||||
constexpr int startingentrance_blockset = 0x15C08; //0x150E5 1byte
|
constexpr int pit_pointer = 0x394AB;
|
||||||
constexpr int startingentrance_floor = 0x15C0F; // 0x1516A 1byte
|
constexpr int pit_count = 0x394A6;
|
||||||
constexpr int startingentrance_dungeon = 0x15C16; // 0x151EF 1byte (dungeon id)
|
|
||||||
|
|
||||||
constexpr int startingentrance_door = 0x15C2B; // 0x15274 1byte
|
constexpr int doorPointers = 0xF83C0;
|
||||||
|
|
||||||
constexpr int startingentrance_ladderbg = 0x15C1D; //0x152F9 //1 byte, ---b ---a b = bg2, a = need to check -_-
|
// doors
|
||||||
constexpr int startingentrance_scrolling = 0x15C24;//0x1537E //1byte --h- --v-
|
constexpr int door_gfx_up = 0x4D9E;
|
||||||
constexpr int startingentrance_scrollquadrant = 0x15C2B; //0x15403 1byte
|
//
|
||||||
constexpr int startingentrance_exit = 0x15C32; //0x15488 //2byte word
|
constexpr int door_gfx_down = 0x4E06;
|
||||||
constexpr int startingentrance_music = 0x15C4E; //0x15592
|
constexpr int door_gfx_cavexit_down = 0x4E06;
|
||||||
constexpr int startingentrance_entrance = 0x15C40;
|
constexpr int door_gfx_left = 0x4E66;
|
||||||
|
constexpr int door_gfx_right = 0x4EC6;
|
||||||
|
|
||||||
constexpr int items_data_start = 0xDDE9; //save purpose
|
constexpr int door_pos_up = 0x197E;
|
||||||
constexpr int items_data_end = 0xE6B2; //save purpose
|
constexpr int door_pos_down = 0x1996;
|
||||||
constexpr int initial_equipement = 0x271A6;
|
constexpr int door_pos_left = 0x19AE;
|
||||||
constexpr int messages_id_dungeon = 0x3F61D;
|
constexpr int door_pos_right = 0x19C6;
|
||||||
|
|
||||||
constexpr int chests_backupitems = 0x3B528; //item id you get instead if you already have that item
|
// TEXT EDITOR RELATED CONSTANTS
|
||||||
constexpr int chests_yoffset = 0x4836C;
|
constexpr int gfx_font = 0x70000; // 2bpp format
|
||||||
constexpr int chests_xoffset = 0x4836C + (76 * 1);
|
constexpr int text_data = 0xE0000;
|
||||||
constexpr int chests_itemsgfx = 0x4836C + (76 * 2);
|
constexpr int text_data2 = 0x75F40;
|
||||||
constexpr int chests_itemswide = 0x4836C + (76 * 3);
|
constexpr int pointers_dictionaries = 0x74703;
|
||||||
constexpr int chests_itemsproperties = 0x4836C + (76 * 4);
|
constexpr int characters_width = 0x74ADF;
|
||||||
constexpr int chests_sramaddress = 0x4836C + (76 * 5);
|
|
||||||
constexpr int chests_sramvalue = 0x4836C + (76 * 7);
|
|
||||||
constexpr int chests_msgid = 0x442DD;
|
|
||||||
|
|
||||||
constexpr int dungeons_startrooms = 0x7939;
|
//===========================================================================================
|
||||||
constexpr int dungeons_endrooms = 0x792D;
|
// Dungeon Entrances Related Variables
|
||||||
constexpr int dungeons_bossrooms = 0x10954;//short value
|
//===========================================================================================
|
||||||
|
constexpr int entrance_room = 0x14813; // 0x14577 //word value for each room
|
||||||
|
constexpr int entrance_scrolledge =
|
||||||
|
0x1491D; // 0x14681 //8 bytes per room, HU, FU, HD, FD, HL, FL, HR, FR
|
||||||
|
constexpr int entrance_yscroll = 0x14D45; // 0x14AA9 //2bytes each room
|
||||||
|
constexpr int entrance_xscroll = 0x14E4F; // 0x14BB3 //2bytes
|
||||||
|
constexpr int entrance_yposition = 0x14F59; // 0x14CBD 2bytes
|
||||||
|
constexpr int entrance_xposition = 0x15063; // 0x14DC7 2bytes
|
||||||
|
constexpr int entrance_camerayposition = 0x1516D; // 0x14ED1 2bytes
|
||||||
|
constexpr int entrance_cameraxposition = 0x15277; // 0x14FDB 2bytes
|
||||||
|
|
||||||
//Bed Related Values (Starting location)
|
constexpr int entrance_gfx_group = 0x5D97;
|
||||||
|
constexpr int entrance_blockset = 0x15381; // 0x150E5 1byte
|
||||||
|
constexpr int entrance_floor = 0x15406; // 0x1516A 1byte
|
||||||
|
constexpr int entrance_dungeon = 0x1548B; // 0x151EF 1byte (dungeon id)
|
||||||
|
constexpr int entrance_door = 0x15510; // 0x15274 1byte
|
||||||
|
constexpr int entrance_ladderbg =
|
||||||
|
0x15595; // 0x152F9 //1 byte, ---b ---a b = bg2, a = need to check -_-
|
||||||
|
constexpr int entrance_scrolling = 0x1561A; // 0x1537E //1byte --h- --v-
|
||||||
|
constexpr int entrance_scrollquadrant = 0x1569F; // 0x15403 1byte
|
||||||
|
constexpr int entrance_exit = 0x15724; // 0x15488 //2byte word
|
||||||
|
constexpr int entrance_music = 0x1582E; // 0x15592
|
||||||
|
|
||||||
constexpr int bedPositionX = 0x039A37; //short value
|
constexpr int startingentrance_room =
|
||||||
constexpr int bedPositionY = 0x039A32; //short value
|
0x15B6E; // 0x158D2 //word value for each room
|
||||||
|
constexpr int startingentrance_scrolledge =
|
||||||
|
0x15B7C; // 0x158E0 //8 bytes per room, HU, FU, HD, FD, HL, FL, HR, FR
|
||||||
|
constexpr int startingentrance_yscroll = 0x15BB4; // 0x14AA9 //2bytes each room
|
||||||
|
constexpr int startingentrance_xscroll = 0x15BC2; // 0x14BB3 //2bytes
|
||||||
|
constexpr int startingentrance_yposition = 0x15BD0; // 0x14CBD 2bytes
|
||||||
|
constexpr int startingentrance_xposition = 0x15BDE; // 0x14DC7 2bytes
|
||||||
|
constexpr int startingentrance_camerayposition = 0x15BEC; // 0x14ED1 2bytes
|
||||||
|
constexpr int startingentrance_cameraxposition = 0x15BFA; // 0x14FDB 2bytes
|
||||||
|
|
||||||
constexpr int bedPositionResetXLow = 0x02DE53; //short value(on 2 different bytes)
|
constexpr int startingentrance_blockset = 0x15C08; // 0x150E5 1byte
|
||||||
constexpr int bedPositionResetXHigh = 0x02DE58; //^^^^^^
|
constexpr int startingentrance_floor = 0x15C0F; // 0x1516A 1byte
|
||||||
|
constexpr int startingentrance_dungeon = 0x15C16; // 0x151EF 1byte (dungeon id)
|
||||||
|
|
||||||
constexpr int bedPositionResetYLow = 0x02DE5D; //short value(on 2 different bytes)
|
constexpr int startingentrance_door = 0x15C2B; // 0x15274 1byte
|
||||||
constexpr int bedPositionResetYHigh = 0x02DE62;//^^^^^^
|
|
||||||
|
|
||||||
constexpr int bedSheetPositionX = 0x0480BD; //short value
|
constexpr int startingentrance_ladderbg =
|
||||||
constexpr int bedSheetPositionY = 0x0480B8; //short value
|
0x15C1D; // 0x152F9 //1 byte, ---b ---a b = bg2, a = need to check -_-
|
||||||
|
constexpr int startingentrance_scrolling = 0x15C24; // 0x1537E //1byte --h- --v-
|
||||||
|
constexpr int startingentrance_scrollquadrant = 0x15C2B; // 0x15403 1byte
|
||||||
|
constexpr int startingentrance_exit = 0x15C32; // 0x15488 //2byte word
|
||||||
|
constexpr int startingentrance_music = 0x15C4E; // 0x15592
|
||||||
|
constexpr int startingentrance_entrance = 0x15C40;
|
||||||
|
|
||||||
//===========================================================================================
|
constexpr int items_data_start = 0xDDE9; // save purpose
|
||||||
//Gravestones related variables
|
constexpr int items_data_end = 0xE6B2; // save purpose
|
||||||
//===========================================================================================
|
constexpr int initial_equipement = 0x271A6;
|
||||||
|
constexpr int messages_id_dungeon = 0x3F61D;
|
||||||
|
|
||||||
constexpr int GravesYTilePos = 0x49968; //short (0x0F entries)
|
constexpr int chests_backupitems =
|
||||||
constexpr int GravesXTilePos = 0x49986; //short (0x0F entries)
|
0x3B528; // item id you get instead if you already have that item
|
||||||
constexpr int GravesTilemapPos = 0x499A4; //short (0x0F entries)
|
constexpr int chests_yoffset = 0x4836C;
|
||||||
constexpr int GravesGFX = 0x499C2; //short (0x0F entries)
|
constexpr int chests_xoffset = 0x4836C + (76 * 1);
|
||||||
|
constexpr int chests_itemsgfx = 0x4836C + (76 * 2);
|
||||||
|
constexpr int chests_itemswide = 0x4836C + (76 * 3);
|
||||||
|
constexpr int chests_itemsproperties = 0x4836C + (76 * 4);
|
||||||
|
constexpr int chests_sramaddress = 0x4836C + (76 * 5);
|
||||||
|
constexpr int chests_sramvalue = 0x4836C + (76 * 7);
|
||||||
|
constexpr int chests_msgid = 0x442DD;
|
||||||
|
|
||||||
constexpr int GravesXPos = 0x4994A; //short (0x0F entries)
|
constexpr int dungeons_startrooms = 0x7939;
|
||||||
constexpr int GravesYLine = 0x4993A; //short (0x08 entries)
|
constexpr int dungeons_endrooms = 0x792D;
|
||||||
constexpr int GravesCountOnY = 0x499E0; //Byte 0x09 entries
|
constexpr int dungeons_bossrooms = 0x10954; // short value
|
||||||
|
|
||||||
constexpr int GraveLinkSpecialHole = 0x46DD9; //short
|
// Bed Related Values (Starting location)
|
||||||
constexpr int GraveLinkSpecialStairs = 0x46DE0; //short
|
|
||||||
|
|
||||||
//===========================================================================================
|
constexpr int bedPositionX = 0x039A37; // short value
|
||||||
//Palettes Related Variables - This contain all the palettes of the game
|
constexpr int bedPositionY = 0x039A32; // short value
|
||||||
//===========================================================================================
|
|
||||||
constexpr int overworldPaletteMain = 0xDE6C8;
|
|
||||||
constexpr int overworldPaletteAuxialiary = 0xDE86C;
|
|
||||||
constexpr int overworldPaletteAnimated = 0xDE604;
|
|
||||||
constexpr int globalSpritePalettesLW = 0xDD218;
|
|
||||||
constexpr int globalSpritePalettesDW = 0xDD290;
|
|
||||||
constexpr int armorPalettes = 0xDD308; // Green, Blue, Red, Bunny, Electrocuted (15 colors each)
|
|
||||||
constexpr int spritePalettesAux1 = 0xDD39E; // 7 colors each
|
|
||||||
constexpr int spritePalettesAux2 = 0xDD446; // 7 colors each
|
|
||||||
constexpr int spritePalettesAux3 = 0xDD4E0; // 7 colors each
|
|
||||||
constexpr int swordPalettes = 0xDD630; // 3 colors each - 4 entries
|
|
||||||
constexpr int shieldPalettes = 0xDD648; // 4 colors each - 3 entries
|
|
||||||
constexpr int hudPalettes = 0xDD660;
|
|
||||||
constexpr int dungeonMapPalettes = 0xDD70A; // 21 colors
|
|
||||||
constexpr int dungeonMainPalettes = 0xDD734; //(15*6) colors each - 20 entries
|
|
||||||
constexpr int dungeonMapBgPalettes = 0xDE544; // 16*6
|
|
||||||
constexpr int hardcodedGrassLW = 0x5FEA9; // Mirrored Value at 0x75645 : 0x75625
|
|
||||||
constexpr int hardcodedGrassDW = 0x05FEB3; // 0x7564F
|
|
||||||
constexpr int hardcodedGrassSpecial = 0x75640;
|
|
||||||
|
|
||||||
//===========================================================================================
|
constexpr int bedPositionResetXLow =
|
||||||
//Dungeon Map Related Variables
|
0x02DE53; // short value(on 2 different bytes)
|
||||||
//===========================================================================================
|
constexpr int bedPositionResetXHigh = 0x02DE58; //^^^^^^
|
||||||
constexpr int dungeonMap_rooms_ptr = 0x57605; //14 pointers of map data
|
|
||||||
constexpr int dungeonMap_floors = 0x575D9; //14 words values
|
|
||||||
|
|
||||||
constexpr int dungeonMap_gfx_ptr = 0x57BE4; //14 pointers of gfx data
|
constexpr int bedPositionResetYLow =
|
||||||
constexpr int dungeonMap_datastart = 0x57039; //data start for floors/gfx MUST skip 575D9 to 57621 (pointers)
|
0x02DE5D; // short value(on 2 different bytes)
|
||||||
|
constexpr int bedPositionResetYHigh = 0x02DE62; //^^^^^^
|
||||||
|
|
||||||
|
constexpr int bedSheetPositionX = 0x0480BD; // short value
|
||||||
|
constexpr int bedSheetPositionY = 0x0480B8; // short value
|
||||||
|
|
||||||
constexpr int dungeonMap_expCheck = 0x56652; //IF Byte = 0xB9 dungeon maps are not expanded
|
//===========================================================================================
|
||||||
constexpr int dungeonMap_tile16 = 0x57009;
|
// Gravestones related variables
|
||||||
constexpr int dungeonMap_tile16Exp = 0x109010;
|
//===========================================================================================
|
||||||
constexpr int dungeonMap_bossrooms = 0x56807; //14 words values 0x000F = no boss
|
|
||||||
|
|
||||||
constexpr int triforceVertices = 0x04FFD2; //group of 3, X, Y ,Z
|
constexpr int GravesYTilePos = 0x49968; // short (0x0F entries)
|
||||||
constexpr int TriforceFaces = 0x04FFE4; //group of 5
|
constexpr int GravesXTilePos = 0x49986; // short (0x0F entries)
|
||||||
|
constexpr int GravesTilemapPos = 0x499A4; // short (0x0F entries)
|
||||||
|
constexpr int GravesGFX = 0x499C2; // short (0x0F entries)
|
||||||
|
|
||||||
constexpr int crystalVertices = 0x04FF98;
|
constexpr int GravesXPos = 0x4994A; // short (0x0F entries)
|
||||||
|
constexpr int GravesYLine = 0x4993A; // short (0x08 entries)
|
||||||
|
constexpr int GravesCountOnY = 0x499E0; // Byte 0x09 entries
|
||||||
|
|
||||||
//===========================================================================================
|
constexpr int GraveLinkSpecialHole = 0x46DD9; // short
|
||||||
// Names
|
constexpr int GraveLinkSpecialStairs = 0x46DE0; // short
|
||||||
//===========================================================================================
|
|
||||||
static const std::string RoomEffect[] =
|
//===========================================================================================
|
||||||
{
|
// Palettes Related Variables - This contain all the palettes of the game
|
||||||
"Nothing",
|
//===========================================================================================
|
||||||
|
constexpr int overworldPaletteMain = 0xDE6C8;
|
||||||
|
constexpr int overworldPaletteAuxialiary = 0xDE86C;
|
||||||
|
constexpr int overworldPaletteAnimated = 0xDE604;
|
||||||
|
constexpr int globalSpritePalettesLW = 0xDD218;
|
||||||
|
constexpr int globalSpritePalettesDW = 0xDD290;
|
||||||
|
constexpr int armorPalettes =
|
||||||
|
0xDD308; // Green, Blue, Red, Bunny, Electrocuted (15 colors each)
|
||||||
|
constexpr int spritePalettesAux1 = 0xDD39E; // 7 colors each
|
||||||
|
constexpr int spritePalettesAux2 = 0xDD446; // 7 colors each
|
||||||
|
constexpr int spritePalettesAux3 = 0xDD4E0; // 7 colors each
|
||||||
|
constexpr int swordPalettes = 0xDD630; // 3 colors each - 4 entries
|
||||||
|
constexpr int shieldPalettes = 0xDD648; // 4 colors each - 3 entries
|
||||||
|
constexpr int hudPalettes = 0xDD660;
|
||||||
|
constexpr int dungeonMapPalettes = 0xDD70A; // 21 colors
|
||||||
|
constexpr int dungeonMainPalettes = 0xDD734; //(15*6) colors each - 20 entries
|
||||||
|
constexpr int dungeonMapBgPalettes = 0xDE544; // 16*6
|
||||||
|
constexpr int hardcodedGrassLW = 0x5FEA9; // Mirrored Value at 0x75645 : 0x75625
|
||||||
|
constexpr int hardcodedGrassDW = 0x05FEB3; // 0x7564F
|
||||||
|
constexpr int hardcodedGrassSpecial = 0x75640;
|
||||||
|
|
||||||
|
//===========================================================================================
|
||||||
|
// Dungeon Map Related Variables
|
||||||
|
//===========================================================================================
|
||||||
|
constexpr int dungeonMap_rooms_ptr = 0x57605; // 14 pointers of map data
|
||||||
|
constexpr int dungeonMap_floors = 0x575D9; // 14 words values
|
||||||
|
|
||||||
|
constexpr int dungeonMap_gfx_ptr = 0x57BE4; // 14 pointers of gfx data
|
||||||
|
constexpr int dungeonMap_datastart =
|
||||||
|
0x57039; // data start for floors/gfx MUST skip 575D9 to 57621 (pointers)
|
||||||
|
|
||||||
|
constexpr int dungeonMap_expCheck =
|
||||||
|
0x56652; // IF Byte = 0xB9 dungeon maps are not expanded
|
||||||
|
constexpr int dungeonMap_tile16 = 0x57009;
|
||||||
|
constexpr int dungeonMap_tile16Exp = 0x109010;
|
||||||
|
constexpr int dungeonMap_bossrooms = 0x56807; // 14 words values 0x000F = no
|
||||||
|
// boss
|
||||||
|
|
||||||
|
constexpr int triforceVertices = 0x04FFD2; // group of 3, X, Y ,Z
|
||||||
|
constexpr int TriforceFaces = 0x04FFE4; // group of 5
|
||||||
|
|
||||||
|
constexpr int crystalVertices = 0x04FF98;
|
||||||
|
|
||||||
|
//===========================================================================================
|
||||||
|
// Names
|
||||||
|
//===========================================================================================
|
||||||
|
static const std::string RoomEffect[] = {"Nothing",
|
||||||
"Nothing",
|
"Nothing",
|
||||||
"Moving Floor",
|
"Moving Floor",
|
||||||
"Moving Water",
|
"Moving Water",
|
||||||
"Trinexx Shell",
|
"Trinexx Shell",
|
||||||
"Red Flashes",
|
"Red Flashes",
|
||||||
"Light Torch to See Floor",
|
"Light Torch to See Floor",
|
||||||
"Ganon's Darkness"
|
"Ganon's Darkness"};
|
||||||
};
|
|
||||||
|
|
||||||
static const std::string RoomTag[] =
|
static const std::string RoomTag[] = {"Nothing",
|
||||||
{
|
|
||||||
"Nothing",
|
|
||||||
|
|
||||||
"NW Kill Enemy to Open",
|
"NW Kill Enemy to Open",
|
||||||
"NE Kill Enemy to Open",
|
"NE Kill Enemy to Open",
|
||||||
@@ -413,47 +467,21 @@ namespace Constants {
|
|||||||
"Push Block for Chest",
|
"Push Block for Chest",
|
||||||
"Clear Room for Triforce Door",
|
"Clear Room for Triforce Door",
|
||||||
"Light Torches for Chest",
|
"Light Torches for Chest",
|
||||||
"Kill Boss Again"
|
"Kill Boss Again"};
|
||||||
};
|
|
||||||
|
|
||||||
static const std::string SecretItemNames[] =
|
static const std::string SecretItemNames[] = {
|
||||||
{
|
"Nothing", "Green Rupee", "Rock hoarder", "Bee", "Health pack",
|
||||||
"Nothing",
|
"Bomb", "Heart ", "Blue Rupee",
|
||||||
"Green Rupee",
|
|
||||||
"Rock hoarder",
|
|
||||||
"Bee",
|
|
||||||
"Health pack",
|
|
||||||
"Bomb",
|
|
||||||
"Heart ",
|
|
||||||
"Blue Rupee",
|
|
||||||
|
|
||||||
"Key",
|
"Key", "Arrow", "Bomb", "Heart", "Magic",
|
||||||
"Arrow",
|
"Full Magic", "Cucco", "Green Soldier", "Bush Stal", "Blue Soldier",
|
||||||
"Bomb",
|
|
||||||
"Heart",
|
|
||||||
"Magic",
|
|
||||||
"Full Magic",
|
|
||||||
"Cucco",
|
|
||||||
"Green Soldier",
|
|
||||||
"Bush Stal",
|
|
||||||
"Blue Soldier",
|
|
||||||
|
|
||||||
"Landmine",
|
"Landmine", "Heart", "Fairy", "Heart",
|
||||||
"Heart",
|
"Nothing ", // 22
|
||||||
"Fairy",
|
|
||||||
"Heart",
|
|
||||||
"Nothing ", //22
|
|
||||||
|
|
||||||
"Hole",
|
"Hole", "Warp", "Staircase", "Bombable", "Switch"};
|
||||||
"Warp",
|
|
||||||
"Staircase",
|
|
||||||
"Bombable",
|
|
||||||
"Switch"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
static const std::string Type1RoomObjectNames[] = {
|
||||||
static const std::string Type1RoomObjectNames[] =
|
|
||||||
{
|
|
||||||
"Ceiling ↔",
|
"Ceiling ↔",
|
||||||
"Wall (top, north) ↔",
|
"Wall (top, north) ↔",
|
||||||
"Wall (top, south) ↔",
|
"Wall (top, south) ↔",
|
||||||
@@ -702,10 +730,9 @@ namespace Constants {
|
|||||||
"Nothing",
|
"Nothing",
|
||||||
"Nothing",
|
"Nothing",
|
||||||
"Nothing",
|
"Nothing",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::string Type2RoomObjectNames[] =
|
static const std::string Type2RoomObjectNames[] = {
|
||||||
{
|
|
||||||
"Corner (top, concave) ▛",
|
"Corner (top, concave) ▛",
|
||||||
"Corner (top, concave) ▙",
|
"Corner (top, concave) ▙",
|
||||||
"Corner (top, concave) ▜",
|
"Corner (top, concave) ▜",
|
||||||
@@ -770,12 +797,9 @@ namespace Constants {
|
|||||||
"Unknown", // TODO: NEEDS IN GAME CHECKING
|
"Unknown", // TODO: NEEDS IN GAME CHECKING
|
||||||
"Pew",
|
"Pew",
|
||||||
"Magic bat altar",
|
"Magic bat altar",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const std::string Type3RoomObjectNames[] = {
|
||||||
|
|
||||||
static const std::string Type3RoomObjectNames[] =
|
|
||||||
{
|
|
||||||
"Waterfall face (empty)",
|
"Waterfall face (empty)",
|
||||||
"Waterfall face (short)",
|
"Waterfall face (short)",
|
||||||
"Waterfall face (long)",
|
"Waterfall face (long)",
|
||||||
@@ -904,10 +928,9 @@ namespace Constants {
|
|||||||
"Arrow tile ↓",
|
"Arrow tile ↓",
|
||||||
"Arrow tile →",
|
"Arrow tile →",
|
||||||
"Nothing",
|
"Nothing",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::string TileTypeNames[] =
|
static const std::string TileTypeNames[] = {
|
||||||
{
|
|
||||||
"$00 Nothing (standard floor)",
|
"$00 Nothing (standard floor)",
|
||||||
"$01 Collision",
|
"$01 Collision",
|
||||||
"$02 Collision",
|
"$02 Collision",
|
||||||
@@ -1163,13 +1186,11 @@ namespace Constants {
|
|||||||
"$FC Door X top? (unused?)",
|
"$FC Door X top? (unused?)",
|
||||||
"$FD Door X top? (unused?)",
|
"$FD Door X top? (unused?)",
|
||||||
"$FE Door X top? (unused?)",
|
"$FE Door X top? (unused?)",
|
||||||
"$FF Door X top? (unused?)"
|
"$FF Door X top? (unused?)"};
|
||||||
};
|
|
||||||
|
|
||||||
|
} // namespace Constants
|
||||||
}
|
} // namespace Core
|
||||||
}
|
} // namespace Application
|
||||||
}
|
} // namespace yaze
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -19,8 +19,8 @@ Overworld::~Overworld() {
|
|||||||
free(allmapsTilesDW);
|
free(allmapsTilesDW);
|
||||||
free(allmapsTilesSP);
|
free(allmapsTilesSP);
|
||||||
|
|
||||||
delete overworldMapPointer;
|
delete[] overworldMapPointer;
|
||||||
delete owactualMapPointer;
|
delete[] owactualMapPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TileInfo GetTilesInfo(ushort tile) {
|
static TileInfo GetTilesInfo(ushort tile) {
|
||||||
|
|||||||
@@ -22,20 +22,10 @@ void Editor::UpdateScreen() {
|
|||||||
|
|
||||||
DrawYazeMenu();
|
DrawYazeMenu();
|
||||||
|
|
||||||
if (isLoaded) {
|
|
||||||
if (!doneLoaded) {
|
|
||||||
overworld.Load(rom);
|
|
||||||
overworld_texture = &overworld.owactualMapTexture;
|
|
||||||
doneLoaded = true;
|
|
||||||
}
|
|
||||||
// ImGui::Image((void*)(intptr_t)overworld_texture,
|
|
||||||
// ImVec2(overworld.overworldMapBitmap->GetWidth(),
|
|
||||||
// overworld.overworldMapBitmap->GetHeight()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginTabBar("##TabBar")) {
|
if (ImGui::BeginTabBar("##TabBar")) {
|
||||||
DrawOverworldEditor();
|
DrawOverworldEditor();
|
||||||
DrawDungeonEditor();
|
DrawDungeonEditor();
|
||||||
|
DrawSpriteEditor();
|
||||||
DrawScreenEditor();
|
DrawScreenEditor();
|
||||||
DrawROMInfo();
|
DrawROMInfo();
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
@@ -50,6 +40,7 @@ void Editor::DrawYazeMenu() {
|
|||||||
DrawFileMenu();
|
DrawFileMenu();
|
||||||
DrawEditMenu();
|
DrawEditMenu();
|
||||||
DrawViewMenu();
|
DrawViewMenu();
|
||||||
|
DrawHelpMenu();
|
||||||
ImGui::EndMenuBar();
|
ImGui::EndMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +51,8 @@ void Editor::DrawYazeMenu() {
|
|||||||
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||||
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||||
rom.LoadFromFile(filePathName);
|
rom.LoadFromFile(filePathName);
|
||||||
isLoaded = true;
|
owEditor.SetRom(rom);
|
||||||
|
rom_data_ = (void *)rom.GetRawData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// close
|
// close
|
||||||
@@ -137,10 +129,16 @@ void Editor::DrawEditMenu() const {
|
|||||||
void Editor::DrawViewMenu() const {
|
void Editor::DrawViewMenu() const {
|
||||||
static bool show_imgui_metrics = false;
|
static bool show_imgui_metrics = false;
|
||||||
static bool show_imgui_style_editor = false;
|
static bool show_imgui_style_editor = false;
|
||||||
|
static bool show_memory_editor = false;
|
||||||
if (show_imgui_metrics) {
|
if (show_imgui_metrics) {
|
||||||
ImGui::ShowMetricsWindow(&show_imgui_metrics);
|
ImGui::ShowMetricsWindow(&show_imgui_metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (show_memory_editor) {
|
||||||
|
static MemoryEditor mem_edit;
|
||||||
|
mem_edit.DrawWindow("Memory Editor", rom_data_, rom.getSize());
|
||||||
|
}
|
||||||
|
|
||||||
if (show_imgui_style_editor) {
|
if (show_imgui_style_editor) {
|
||||||
ImGui::Begin("Style Editor (ImGui)", &show_imgui_style_editor);
|
ImGui::Begin("Style Editor (ImGui)", &show_imgui_style_editor);
|
||||||
ImGui::ShowStyleEditor();
|
ImGui::ShowStyleEditor();
|
||||||
@@ -154,6 +152,8 @@ void Editor::DrawViewMenu() const {
|
|||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::MenuItem("HEX Editor", nullptr, &show_memory_editor);
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (ImGui::BeginMenu("GUI Tools")) {
|
if (ImGui::BeginMenu("GUI Tools")) {
|
||||||
ImGui::MenuItem("Metrics (ImGui)", nullptr, &show_imgui_metrics);
|
ImGui::MenuItem("Metrics (ImGui)", nullptr, &show_imgui_metrics);
|
||||||
@@ -165,6 +165,14 @@ void Editor::DrawViewMenu() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::DrawHelpMenu() const {
|
||||||
|
if (ImGui::BeginMenu("Help")) {
|
||||||
|
if (ImGui::MenuItem("About")) {
|
||||||
|
}
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// first step would be to decompress all graphics data from the game
|
// first step would be to decompress all graphics data from the game
|
||||||
// (in alttp that's easy they're all located in the same location all the
|
// (in alttp that's easy they're all located in the same location all the
|
||||||
// same sheet size 128x32) have a code that convert PC address to SNES and
|
// same sheet size 128x32) have a code that convert PC address to SNES and
|
||||||
@@ -235,6 +243,12 @@ void Editor::DrawDungeonEditor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::DrawSpriteEditor() {
|
||||||
|
if (ImGui::BeginTabItem("Sprites")) {
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::DrawScreenEditor() {
|
void Editor::DrawScreenEditor() {
|
||||||
if (ImGui::BeginTabItem("Screens")) {
|
if (ImGui::BeginTabItem("Screens")) {
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
@@ -243,7 +257,7 @@ void Editor::DrawScreenEditor() {
|
|||||||
|
|
||||||
void Editor::DrawROMInfo() {
|
void Editor::DrawROMInfo() {
|
||||||
if (ImGui::BeginTabItem("ROM Info")) {
|
if (ImGui::BeginTabItem("ROM Info")) {
|
||||||
if (isLoaded) {
|
if (rom.isLoaded()) {
|
||||||
ImGui::Text("Title: %s", rom.getTitle());
|
ImGui::Text("Title: %s", rom.getTitle());
|
||||||
ImGui::Text("Version: %d", rom.getVersion());
|
ImGui::Text("Version: %d", rom.getVersion());
|
||||||
ImGui::Text("ROM Size: %ld", rom.getSize());
|
ImGui::Text("ROM Size: %ld", rom.getSize());
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Core/Icons.h"
|
#include "Core/Icons.h"
|
||||||
#include "Data/Overworld.h"
|
|
||||||
#include "OverworldEditor.h"
|
#include "OverworldEditor.h"
|
||||||
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
||||||
#include "Utils/ROM.h"
|
#include "Utils/ROM.h"
|
||||||
@@ -13,6 +12,7 @@
|
|||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
#include "imgui/imgui_internal.h"
|
#include "imgui/imgui_internal.h"
|
||||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||||
|
#include "imgui/imgui_memory_editor.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace Application {
|
namespace Application {
|
||||||
@@ -27,20 +27,20 @@ class Editor {
|
|||||||
void DrawFileMenu() const;
|
void DrawFileMenu() const;
|
||||||
void DrawEditMenu() const;
|
void DrawEditMenu() const;
|
||||||
void DrawViewMenu() const;
|
void DrawViewMenu() const;
|
||||||
|
void DrawHelpMenu() const;
|
||||||
|
|
||||||
void DrawOverworldEditor();
|
void DrawOverworldEditor();
|
||||||
void DrawDungeonEditor();
|
void DrawDungeonEditor();
|
||||||
|
void DrawSpriteEditor();
|
||||||
void DrawScreenEditor();
|
void DrawScreenEditor();
|
||||||
void DrawROMInfo();
|
void DrawROMInfo();
|
||||||
|
|
||||||
bool isLoaded = false;
|
OverworldEditor owEditor;
|
||||||
bool doneLoaded = false;
|
|
||||||
GLuint *overworld_texture;
|
|
||||||
Data::Overworld overworld;
|
|
||||||
::yaze::Application::Editor::OverworldEditor owEditor;
|
|
||||||
Utils::ROM rom;
|
Utils::ROM rom;
|
||||||
|
|
||||||
|
void* rom_data_;
|
||||||
|
|
||||||
|
bool isLoaded = true;
|
||||||
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "OverworldEditor.h"
|
#include "OverworldEditor.h"
|
||||||
#include "Core/Icons.h"
|
#include "Core/Icons.h"
|
||||||
|
#include "Graphics/Bitmap.h"
|
||||||
|
#include "Graphics/Tile.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@@ -7,6 +9,28 @@ namespace yaze {
|
|||||||
namespace Application {
|
namespace Application {
|
||||||
namespace Editor {
|
namespace Editor {
|
||||||
void OverworldEditor::Update() {
|
void OverworldEditor::Update() {
|
||||||
|
|
||||||
|
if (rom_.isLoaded()) {
|
||||||
|
if (!doneLoaded) {
|
||||||
|
overworld.Load(rom_);
|
||||||
|
Graphics::CreateAllGfxData(rom_.GetRawData(), allGfx16Ptr);
|
||||||
|
|
||||||
|
// allgfxBitmap.LoadBitmapFromROM(allGfx16Ptr, allgfx_texture,
|
||||||
|
// &allgfx_width,
|
||||||
|
// &allgfx_height);
|
||||||
|
doneLoaded = true;
|
||||||
|
}
|
||||||
|
// Graphics::tile8 all_tiles;
|
||||||
|
// all_tiles.id = 1;
|
||||||
|
// all_tiles.data =
|
||||||
|
// Graphics::export_tile_to_png(tile8 rawtile, const r_palette pal, const
|
||||||
|
// char *filename)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (show_changelist_) {
|
||||||
|
DrawChangelist();
|
||||||
|
}
|
||||||
|
|
||||||
DrawToolset();
|
DrawToolset();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (ImGui::BeginTable("#owEditTable", 2, ow_edit_flags, ImVec2(0, 0))) {
|
if (ImGui::BeginTable("#owEditTable", 2, ow_edit_flags, ImVec2(0, 0))) {
|
||||||
@@ -21,7 +45,7 @@ void OverworldEditor::Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OverworldEditor::DrawToolset() {
|
void OverworldEditor::DrawToolset() {
|
||||||
if (ImGui::BeginTable("Toolset", 12, toolset_table_flags, ImVec2(0, 0))) {
|
if (ImGui::BeginTable("Toolset", 14, toolset_table_flags, ImVec2(0, 0))) {
|
||||||
|
|
||||||
ImGui::TableSetupColumn("#undoTool");
|
ImGui::TableSetupColumn("#undoTool");
|
||||||
ImGui::TableSetupColumn("#redoTool");
|
ImGui::TableSetupColumn("#redoTool");
|
||||||
@@ -31,10 +55,12 @@ void OverworldEditor::DrawToolset() {
|
|||||||
ImGui::TableSetupColumn("#zoomInTool");
|
ImGui::TableSetupColumn("#zoomInTool");
|
||||||
ImGui::TableSetupColumn("#separator");
|
ImGui::TableSetupColumn("#separator");
|
||||||
ImGui::TableSetupColumn("#history");
|
ImGui::TableSetupColumn("#history");
|
||||||
ImGui::TableSetupColumn("#entranceExitTool");
|
ImGui::TableSetupColumn("#entranceTool");
|
||||||
|
ImGui::TableSetupColumn("#exitTool");
|
||||||
ImGui::TableSetupColumn("#itemTool");
|
ImGui::TableSetupColumn("#itemTool");
|
||||||
ImGui::TableSetupColumn("#spriteTool");
|
ImGui::TableSetupColumn("#spriteTool");
|
||||||
ImGui::TableSetupColumn("#transportTool");
|
ImGui::TableSetupColumn("#transportTool");
|
||||||
|
ImGui::TableSetupColumn("#musicTool");
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Button(ICON_MD_UNDO);
|
ImGui::Button(ICON_MD_UNDO);
|
||||||
@@ -43,7 +69,12 @@ void OverworldEditor::DrawToolset() {
|
|||||||
ImGui::Button(ICON_MD_REDO);
|
ImGui::Button(ICON_MD_REDO);
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Button(ICON_MD_MANAGE_HISTORY);
|
if (ImGui::Button(ICON_MD_MANAGE_HISTORY)) {
|
||||||
|
if (!show_changelist_)
|
||||||
|
show_changelist_ = true;
|
||||||
|
else
|
||||||
|
show_changelist_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text(ICON_MD_MORE_VERT);
|
ImGui::Text(ICON_MD_MORE_VERT);
|
||||||
@@ -61,7 +92,10 @@ void OverworldEditor::DrawToolset() {
|
|||||||
ImGui::Button(ICON_MD_DRAW);
|
ImGui::Button(ICON_MD_DRAW);
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Button(ICON_MD_SENSOR_DOOR);
|
ImGui::Button(ICON_MD_DOOR_FRONT);
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Button(ICON_MD_DOOR_BACK);
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Button(ICON_MD_GRASS);
|
ImGui::Button(ICON_MD_GRASS);
|
||||||
@@ -72,6 +106,9 @@ void OverworldEditor::DrawToolset() {
|
|||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Button(ICON_MD_ADD_LOCATION);
|
ImGui::Button(ICON_MD_ADD_LOCATION);
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Button(ICON_MD_MUSIC_NOTE);
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,18 +259,35 @@ void OverworldEditor::DrawOverworldCanvas() {
|
|||||||
}
|
}
|
||||||
void OverworldEditor::DrawTileSelector() {
|
void OverworldEditor::DrawTileSelector() {
|
||||||
if (ImGui::BeginTabBar("##TabBar")) {
|
if (ImGui::BeginTabBar("##TabBar")) {
|
||||||
|
if (ImGui::BeginTabItem("Tile8")) {
|
||||||
|
if (rom_.isLoaded()) {
|
||||||
|
ImGui::Image((void *)(intptr_t)overworld_texture,
|
||||||
|
ImVec2(overworld.overworldMapBitmap->GetWidth(),
|
||||||
|
overworld.overworldMapBitmap->GetHeight()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
if (ImGui::BeginTabItem("Tile16")) {
|
if (ImGui::BeginTabItem("Tile16")) {
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginTabItem("Tile8")) {
|
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverworldEditor::DrawChangelist() {
|
||||||
|
if (!ImGui::Begin("Changelist")) {
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ImGui::Text("Test");
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Editor
|
} // namespace Editor
|
||||||
} // namespace Application
|
} // namespace Application
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -2,25 +2,50 @@
|
|||||||
#define YAZE_APPLICATION_EDITOR_OVERWORLDEDITOR_H
|
#define YAZE_APPLICATION_EDITOR_OVERWORLDEDITOR_H
|
||||||
|
|
||||||
#include "Core/Icons.h"
|
#include "Core/Icons.h"
|
||||||
|
#include "Data/Overworld.h"
|
||||||
|
#include "Utils/Compression.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace Application {
|
namespace Application {
|
||||||
namespace Editor {
|
namespace Editor {
|
||||||
|
|
||||||
|
using byte = unsigned char;
|
||||||
|
|
||||||
class OverworldEditor {
|
class OverworldEditor {
|
||||||
public:
|
public:
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
void SetRom(Utils::ROM & rom) { rom_ = rom; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawToolset();
|
void DrawToolset();
|
||||||
void DrawOverworldMapSettings();
|
void DrawOverworldMapSettings();
|
||||||
void DrawOverworldCanvas();
|
void DrawOverworldCanvas();
|
||||||
void DrawTileSelector();
|
void DrawTileSelector();
|
||||||
|
|
||||||
|
void DrawChangelist();
|
||||||
|
|
||||||
|
bool show_changelist_ = false;
|
||||||
|
|
||||||
|
Utils::ROM rom_;
|
||||||
|
Data::Overworld overworld;
|
||||||
|
Utils::ALTTPCompression alttp_compressor_;
|
||||||
|
Graphics::Bitmap allgfxBitmap;
|
||||||
|
int allgfx_width = 0;
|
||||||
|
int allgfx_height = 0;
|
||||||
|
GLuint *allgfx_texture = nullptr;
|
||||||
|
|
||||||
|
byte* allGfx16Ptr = new byte[(128 * 7136) / 2];
|
||||||
|
|
||||||
|
GLuint *overworld_texture;
|
||||||
|
|
||||||
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
||||||
ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders;
|
ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders;
|
||||||
ImGuiTableFlags ow_edit_flags = ImGuiTableFlags_Reorderable | ImGuiTableFlags_Resizable | ImGuiTableFlags_SizingStretchSame;
|
ImGuiTableFlags ow_edit_flags = ImGuiTableFlags_Reorderable |
|
||||||
|
ImGuiTableFlags_Resizable |
|
||||||
|
ImGuiTableFlags_SizingStretchSame;
|
||||||
|
|
||||||
float canvas_table_ratio = 30.f;
|
float canvas_table_ratio = 30.f;
|
||||||
|
|
||||||
@@ -32,6 +57,9 @@ private:
|
|||||||
|
|
||||||
int current_world_ = 0;
|
int current_world_ = 0;
|
||||||
|
|
||||||
|
bool isLoaded = false;
|
||||||
|
bool doneLoaded = false;
|
||||||
|
|
||||||
constexpr static int kByteSize = 3;
|
constexpr static int kByteSize = 3;
|
||||||
constexpr static int kMessageIdSize = 5;
|
constexpr static int kMessageIdSize = 5;
|
||||||
constexpr static float kInputFieldSize = 30.f;
|
constexpr static float kInputFieldSize = 30.f;
|
||||||
|
|||||||
@@ -1,13 +1,178 @@
|
|||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
|
#include "Utils/ROM.h"
|
||||||
|
#include "Utils/Compression.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace Application {
|
namespace Application {
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
Bitmap::Bitmap(int width, int height, byte* data)
|
int GetPCGfxAddress(byte *romData, byte id) {
|
||||||
|
char** info1, **info2,** info3, **info4;
|
||||||
|
int gfxPointer1 =
|
||||||
|
Utils::lorom_snes_to_pc((romData[Constants::gfx_1_pointer + 1] << 8) +
|
||||||
|
(romData[Constants::gfx_1_pointer]), info1);
|
||||||
|
int gfxPointer2 =
|
||||||
|
Utils::lorom_snes_to_pc((romData[Constants::gfx_2_pointer + 1] << 8) +
|
||||||
|
(romData[Constants::gfx_2_pointer]), info2);
|
||||||
|
int gfxPointer3 =
|
||||||
|
Utils::lorom_snes_to_pc((romData[Constants::gfx_3_pointer + 1] << 8) +
|
||||||
|
(romData[Constants::gfx_3_pointer]), info3);
|
||||||
|
|
||||||
|
byte gfxGamePointer1 = romData[gfxPointer1 + id];
|
||||||
|
byte gfxGamePointer2 = romData[gfxPointer2 + id];
|
||||||
|
byte gfxGamePointer3 = romData[gfxPointer3 + id];
|
||||||
|
|
||||||
|
return Utils::lorom_snes_to_pc(Utils::AddressFromBytes(gfxGamePointer1, gfxGamePointer2,
|
||||||
|
gfxGamePointer3), info4);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte *CreateAllGfxDataRaw(byte *romData) {
|
||||||
|
// 0-112 -> compressed 3bpp bgr -> (decompressed each) 0x600 bytes
|
||||||
|
// 113-114 -> compressed 2bpp -> (decompressed each) 0x800 bytes
|
||||||
|
// 115-126 -> uncompressed 3bpp sprites -> (each) 0x600 bytes
|
||||||
|
// 127-217 -> compressed 3bpp sprites -> (decompressed each) 0x600 bytes
|
||||||
|
// 218-222 -> compressed 2bpp -> (decompressed each) 0x800 bytes
|
||||||
|
|
||||||
|
Utils::ALTTPCompression alttp_compressor_;
|
||||||
|
|
||||||
|
byte *buffer = new byte[346624];
|
||||||
|
int bufferPos = 0;
|
||||||
|
byte *data = new byte[2048];
|
||||||
|
unsigned int uncompressedSize = 0;
|
||||||
|
unsigned int compressedSize = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < Constants::NumberOfSheets; i++) {
|
||||||
|
isbpp3[i] = ((i >= 0 && i <= 112) || // Compressed 3bpp bg
|
||||||
|
(i >= 115 && i <= 126) || // Uncompressed 3bpp sprites
|
||||||
|
(i >= 127 && i <= 217) // Compressed 3bpp sprites
|
||||||
|
);
|
||||||
|
|
||||||
|
// uncompressed sheets
|
||||||
|
if (i >= 115 && i <= 126) {
|
||||||
|
data = new byte[Constants::Uncompressed3BPPSize];
|
||||||
|
int startAddress = GetPCGfxAddress(romData, (byte)i);
|
||||||
|
for (int j = 0; j < Constants::Uncompressed3BPPSize; j++) {
|
||||||
|
data[j] = romData[j + startAddress];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data = alttp_compressor_.DecompressGfx(
|
||||||
|
romData, GetPCGfxAddress(romData, (byte)i),
|
||||||
|
Constants::UncompressedSheetSize, &uncompressedSize, &compressedSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < sizeof(data); j++) {
|
||||||
|
buffer[j + bufferPos] = data[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferPos += sizeof(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateAllGfxData(byte *romData, byte* allgfx16Ptr) {
|
||||||
|
byte* data = CreateAllGfxDataRaw(romData);
|
||||||
|
byte* newData =
|
||||||
|
new byte[0x6F800]; // NEED TO GET THE APPROPRIATE SIZE FOR THAT
|
||||||
|
byte* mask = new byte[]{0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
|
||||||
|
int sheetPosition = 0;
|
||||||
|
|
||||||
|
// 8x8 tile
|
||||||
|
for (int s = 0; s < Constants::NumberOfSheets; s++) // Per Sheet
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 4; j++) // Per Tile Line Y
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; i++) // Per Tile Line X
|
||||||
|
{
|
||||||
|
for (int y = 0; y < 8; y++) // Per Pixel Line
|
||||||
|
{
|
||||||
|
if (isbpp3[s]) {
|
||||||
|
byte lineBits0 =
|
||||||
|
data[(y * 2) + (i * 24) + (j * 384) + sheetPosition];
|
||||||
|
byte lineBits1 =
|
||||||
|
data[(y * 2) + (i * 24) + (j * 384) + 1 + sheetPosition];
|
||||||
|
byte lineBits2 =
|
||||||
|
data[(y) + (i * 24) + (j * 384) + 16 + sheetPosition];
|
||||||
|
|
||||||
|
for (int x = 0; x < 4; x++) // Per Pixel X
|
||||||
|
{
|
||||||
|
byte pixdata = 0;
|
||||||
|
byte pixdata2 = 0;
|
||||||
|
|
||||||
|
if ((lineBits0 & mask[(x * 2)]) == mask[(x * 2)]) {
|
||||||
|
pixdata += 1;
|
||||||
|
}
|
||||||
|
if ((lineBits1 & mask[(x * 2)]) == mask[(x * 2)]) {
|
||||||
|
pixdata += 2;
|
||||||
|
}
|
||||||
|
if ((lineBits2 & mask[(x * 2)]) == mask[(x * 2)]) {
|
||||||
|
pixdata += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((lineBits0 & mask[(x * 2) + 1]) == mask[(x * 2) + 1]) {
|
||||||
|
pixdata2 += 1;
|
||||||
|
}
|
||||||
|
if ((lineBits1 & mask[(x * 2) + 1]) == mask[(x * 2) + 1]) {
|
||||||
|
pixdata2 += 2;
|
||||||
|
}
|
||||||
|
if ((lineBits2 & mask[(x * 2) + 1]) == mask[(x * 2) + 1]) {
|
||||||
|
pixdata2 += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
newData[(y * 64) + (x) + (i * 4) + (j * 512) + (s * 2048)] =
|
||||||
|
(byte)((pixdata << 4) | pixdata2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
byte lineBits0 =
|
||||||
|
data[(y * 2) + (i * 16) + (j * 256) + sheetPosition];
|
||||||
|
byte lineBits1 =
|
||||||
|
data[(y * 2) + (i * 16) + (j * 256) + 1 + sheetPosition];
|
||||||
|
|
||||||
|
for (int x = 0; x < 4; x++) // Per Pixel X
|
||||||
|
{
|
||||||
|
byte pixdata = 0;
|
||||||
|
byte pixdata2 = 0;
|
||||||
|
|
||||||
|
if ((lineBits0 & mask[(x * 2)]) == mask[(x * 2)]) {
|
||||||
|
pixdata += 1;
|
||||||
|
}
|
||||||
|
if ((lineBits1 & mask[(x * 2)]) == mask[(x * 2)]) {
|
||||||
|
pixdata += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((lineBits0 & mask[(x * 2) + 1]) == mask[(x * 2) + 1]) {
|
||||||
|
pixdata2 += 1;
|
||||||
|
}
|
||||||
|
if ((lineBits1 & mask[(x * 2) + 1]) == mask[(x * 2) + 1]) {
|
||||||
|
pixdata2 += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
newData[(y * 64) + (x) + (i * 4) + (j * 512) + (s * 2048)] =
|
||||||
|
(byte)((pixdata << 4) | pixdata2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isbpp3[s]) {
|
||||||
|
sheetPosition += Constants::Uncompressed3BPPSize;
|
||||||
|
} else {
|
||||||
|
sheetPosition += Constants::UncompressedSheetSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte *allgfx16Data = (byte *) allgfx16Ptr;
|
||||||
|
|
||||||
|
for (int i = 0; i < 0x6F800; i++) {
|
||||||
|
allgfx16Data[i] = newData[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap::Bitmap(int width, int height, byte *data)
|
||||||
: width_(width), height_(height), pixel_data_(data) {}
|
: width_(width), height_(height), pixel_data_(data) {}
|
||||||
|
|
||||||
void Bitmap::Create(GLuint* out_texture) {
|
void Bitmap::Create(GLuint *out_texture) {
|
||||||
// // Read the pixel data from the ROM
|
// // Read the pixel data from the ROM
|
||||||
// SDL_RWops * src = SDL_RWFromMem(pixel_data_, 0);
|
// SDL_RWops * src = SDL_RWFromMem(pixel_data_, 0);
|
||||||
// // Create the surface from that RW stream
|
// // Create the surface from that RW stream
|
||||||
@@ -45,21 +210,18 @@ void Bitmap::Create(GLuint* out_texture) {
|
|||||||
*out_texture = image_texture;
|
*out_texture = image_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Bitmap::GetWidth() {
|
int Bitmap::GetWidth() { return width_; }
|
||||||
return width_;
|
int Bitmap::GetHeight() { return height_; }
|
||||||
}
|
|
||||||
int Bitmap::GetHeight() {
|
|
||||||
return height_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simple helper function to load an image into a OpenGL texture with common
|
// Simple helper function to load an image into a OpenGL texture with common
|
||||||
// settings
|
// settings
|
||||||
bool Bitmap::LoadBitmapFromROM(unsigned char* texture_data, GLuint* out_texture,
|
bool Bitmap::LoadBitmapFromROM(unsigned char *texture_data, GLuint *out_texture,
|
||||||
int* out_width, int* out_height) {
|
int *out_width, int *out_height) {
|
||||||
// Load from file
|
// Load from file
|
||||||
int image_width = 0;
|
int image_width = 0;
|
||||||
int image_height = 0;
|
int image_height = 0;
|
||||||
if (texture_data == NULL) return false;
|
if (texture_data == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Create a OpenGL texture identifier
|
// Create a OpenGL texture identifier
|
||||||
GLuint image_texture;
|
GLuint image_texture;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Application {
|
|||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
using byte = unsigned char;
|
using byte = unsigned char;
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
class Bitmap {
|
class Bitmap {
|
||||||
public:
|
public:
|
||||||
@@ -31,8 +32,14 @@ private:
|
|||||||
int width_;
|
int width_;
|
||||||
int height_;
|
int height_;
|
||||||
byte *pixel_data_;
|
byte *pixel_data_;
|
||||||
SDL_PixelFormat pixel_format_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool isbpp3[Constants::NumberOfSheets];
|
||||||
|
|
||||||
|
int GetPCGfxAddress(byte* romData, byte id);
|
||||||
|
byte* CreateAllGfxDataRaw(byte* romData);
|
||||||
|
void CreateAllGfxData(byte* romData, byte* allgfx16Ptr);
|
||||||
|
|
||||||
} // namespace Graphics
|
} // namespace Graphics
|
||||||
} // namespace Application
|
} // namespace Application
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ ushort TileInfo::toShort() {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* hexString(const char* str, const unsigned int size) {
|
char *hexString(const char *str, const unsigned int size) {
|
||||||
char* toret = (char*)malloc(size * 3 + 1);
|
char *toret = (char *)malloc(size * 3 + 1);
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
@@ -40,8 +40,8 @@ char* hexString(const char* str, const unsigned int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void export_tile_to_png(tile8 rawtile, const r_palette pal,
|
void export_tile_to_png(tile8 rawtile, const r_palette pal,
|
||||||
const char* filename) {
|
const char *filename) {
|
||||||
FILE* fp = fopen(filename, "wb");
|
FILE *fp = fopen(filename, "wb");
|
||||||
png_structp png_ptr =
|
png_structp png_ptr =
|
||||||
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
@@ -49,8 +49,8 @@ void export_tile_to_png(tile8 rawtile, const r_palette pal,
|
|||||||
png_set_strip_alpha(png_ptr);
|
png_set_strip_alpha(png_ptr);
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
png_color* png_palette =
|
png_color *png_palette =
|
||||||
(png_color*)png_malloc(png_ptr, pal.size * sizeof(png_color));
|
(png_color *)png_malloc(png_ptr, pal.size * sizeof(png_color));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pal.size; i++) {
|
for (unsigned int i = 0; i < pal.size; i++) {
|
||||||
png_palette[i].blue = pal.colors[i].blue;
|
png_palette[i].blue = pal.colors[i].blue;
|
||||||
@@ -65,9 +65,9 @@ void export_tile_to_png(tile8 rawtile, const r_palette pal,
|
|||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
png_set_packing(png_ptr);
|
png_set_packing(png_ptr);
|
||||||
|
|
||||||
png_byte* row_pointers[8];
|
png_byte *row_pointers[8];
|
||||||
for (unsigned int i = 0; i < 8; i++) {
|
for (unsigned int i = 0; i < 8; i++) {
|
||||||
row_pointers[i] = (png_byte*)png_malloc(png_ptr, sizeof(png_byte));
|
row_pointers[i] = (png_byte *)png_malloc(png_ptr, sizeof(png_byte));
|
||||||
memcpy(row_pointers[i], rawtile.data + i * 8, 8);
|
memcpy(row_pointers[i], rawtile.data + i * 8, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,33 +80,33 @@ void export_tile_to_png(tile8 rawtile, const r_palette pal,
|
|||||||
png_free(png_ptr, row_pointers);
|
png_free(png_ptr, row_pointers);
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_bpp1_tile(const char* data, const unsigned int offset) {
|
tile8 unpack_bpp1_tile(const char *data, const unsigned int offset) {
|
||||||
return (unpack_bpp_tile(data, offset, 1));
|
return (unpack_bpp_tile(data, offset, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_bpp2_tile(const char* data, const unsigned int offset) {
|
tile8 unpack_bpp2_tile(const char *data, const unsigned int offset) {
|
||||||
return (unpack_bpp_tile(data, offset, 2));
|
return (unpack_bpp_tile(data, offset, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_bpp3_tile(const char* data, const unsigned int offset) {
|
tile8 unpack_bpp3_tile(const char *data, const unsigned int offset) {
|
||||||
return (unpack_bpp_tile(data, offset, 3));
|
return (unpack_bpp_tile(data, offset, 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_bpp4_tile(const char* data, const unsigned int offset) {
|
tile8 unpack_bpp4_tile(const char *data, const unsigned int offset) {
|
||||||
return (unpack_bpp_tile(data, offset, 4));
|
return (unpack_bpp_tile(data, offset, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_bpp8_tile(const char* data, const unsigned int offset) {
|
tile8 unpack_bpp8_tile(const char *data, const unsigned int offset) {
|
||||||
return (unpack_bpp_tile(data, offset, 8));
|
return (unpack_bpp_tile(data, offset, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_mode7_tile(const char* data, const unsigned int offset) {
|
tile8 unpack_mode7_tile(const char *data, const unsigned int offset) {
|
||||||
tile8 tile;
|
tile8 tile;
|
||||||
memcpy(tile.data, data + offset, 64);
|
memcpy(tile.data, data + offset, 64);
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
tile8 unpack_bpp_tile(const char* data, const unsigned int offset,
|
tile8 unpack_bpp_tile(const char *data, const unsigned int offset,
|
||||||
const unsigned bpp) {
|
const unsigned bpp) {
|
||||||
tile8 tile;
|
tile8 tile;
|
||||||
assert(bpp >= 1 && bpp <= 8);
|
assert(bpp >= 1 && bpp <= 8);
|
||||||
@@ -155,33 +155,33 @@ tile8 unpack_bpp_tile(const char* data, const unsigned int offset,
|
|||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* pack_bpp1_tile(const tile8 tile) {
|
byte *pack_bpp1_tile(const tile8 tile) {
|
||||||
unsigned int p = 1;
|
unsigned int p = 1;
|
||||||
return pack_bpp_tile(tile, 1, &p);
|
return pack_bpp_tile(tile, 1, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* pack_bpp2_tile(const tile8 tile) {
|
byte *pack_bpp2_tile(const tile8 tile) {
|
||||||
unsigned int p = 1;
|
unsigned int p = 1;
|
||||||
return pack_bpp_tile(tile, 2, &p);
|
return pack_bpp_tile(tile, 2, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* pack_bpp3_tile(const tile8 tile) {
|
byte *pack_bpp3_tile(const tile8 tile) {
|
||||||
unsigned int p = 1;
|
unsigned int p = 1;
|
||||||
return pack_bpp_tile(tile, 3, &p);
|
return pack_bpp_tile(tile, 3, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* pack_bpp4_tile(const tile8 tile) {
|
byte *pack_bpp4_tile(const tile8 tile) {
|
||||||
unsigned int p = 1;
|
unsigned int p = 1;
|
||||||
return pack_bpp_tile(tile, 4, &p);
|
return pack_bpp_tile(tile, 4, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* pack_bpp8_tile(const tile8 tile) {
|
byte *pack_bpp8_tile(const tile8 tile) {
|
||||||
unsigned int p = 1;
|
unsigned int p = 1;
|
||||||
return pack_bpp_tile(tile, 8, &p);
|
return pack_bpp_tile(tile, 8, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* pack_bpp_tile(tile8 tile, const unsigned int bpp, unsigned int* size) {
|
byte *pack_bpp_tile(tile8 tile, const unsigned int bpp, unsigned int *size) {
|
||||||
byte* output = (byte*)malloc(bpp * 8);
|
byte *output = (byte *)malloc(bpp * 8);
|
||||||
memset(output, 0, bpp * 8);
|
memset(output, 0, bpp * 8);
|
||||||
unsigned maxcolor = 2 << bpp;
|
unsigned maxcolor = 2 << bpp;
|
||||||
*size = 0;
|
*size = 0;
|
||||||
@@ -189,14 +189,17 @@ byte* pack_bpp_tile(tile8 tile, const unsigned int bpp, unsigned int* size) {
|
|||||||
for (unsigned int col = 0; col < 8; col++) {
|
for (unsigned int col = 0; col < 8; col++) {
|
||||||
for (unsigned int row = 0; row < 8; row++) {
|
for (unsigned int row = 0; row < 8; row++) {
|
||||||
byte color = tile.data[col * 8 + row];
|
byte color = tile.data[col * 8 + row];
|
||||||
if (color > maxcolor) return NULL;
|
if (color > maxcolor)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (bpp == 1) output[col] += (byte)((color & 1) << (7 - row));
|
if (bpp == 1)
|
||||||
|
output[col] += (byte)((color & 1) << (7 - row));
|
||||||
if (bpp >= 2) {
|
if (bpp >= 2) {
|
||||||
output[col * 2] += (byte)((color & 1) << (7 - row));
|
output[col * 2] += (byte)((color & 1) << (7 - row));
|
||||||
output[col * 2 + 1] += (byte)(((color & 2) == 2) << (7 - row));
|
output[col * 2 + 1] += (byte)(((color & 2) == 2) << (7 - row));
|
||||||
}
|
}
|
||||||
if (bpp == 3) output[16 + col] += (byte)(((color & 4) == 4) << (7 - row));
|
if (bpp == 3)
|
||||||
|
output[16 + col] += (byte)(((color & 4) == 4) << (7 - row));
|
||||||
if (bpp >= 4) {
|
if (bpp >= 4) {
|
||||||
output[16 + col * 2] += (byte)(((color & 4) == 4) << (7 - row));
|
output[16 + col * 2] += (byte)(((color & 4) == 4) << (7 - row));
|
||||||
output[16 + col * 2 + 1] += (byte)(((color & 8) == 8) << (7 - row));
|
output[16 + col * 2 + 1] += (byte)(((color & 8) == 8) << (7 - row));
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ void ROM::LoadFromFile(const std::string& path) {
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
memcpy(title, current_rom_, 21);
|
memcpy(title, current_rom_, 21);
|
||||||
|
|
||||||
type = LoROM;
|
type = LoROM;
|
||||||
fastrom = (current_rom_[21] & 0b00110000) == 0b00110000;
|
fastrom = (current_rom_[21] & 0b00110000) == 0b00110000;
|
||||||
if (current_rom_[21] & 1)
|
if (current_rom_[21] & 1)
|
||||||
@@ -265,6 +266,11 @@ void ROM::LoadFromFile(const std::string& path) {
|
|||||||
make_sense = false;
|
make_sense = false;
|
||||||
if ((checksum ^ checksum_comp) == 0xFFFF)
|
if ((checksum ^ checksum_comp) == 0xFFFF)
|
||||||
make_sense = true;
|
make_sense = true;
|
||||||
|
|
||||||
|
loaded = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ROM::SnesToPc(int addr) {
|
int ROM::SnesToPc(int addr) {
|
||||||
@@ -293,7 +299,7 @@ int ROM::PcToSnes(int addr) {
|
|||||||
return ((addr * 2) & 0xFF0000) + (addr & 0x7FFF) + 0x8000;
|
return ((addr * 2) & 0xFF0000) + (addr & 0x7FFF) + 0x8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ROM::AddressFromBytes(byte addr1, byte addr2, byte addr3) {
|
int AddressFromBytes(byte addr1, byte addr2, byte addr3) {
|
||||||
return (addr1 << 16) | (addr2 << 8) | addr3;
|
return (addr1 << 16) | (addr2 << 8) | addr3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,11 +48,12 @@ int hirom_pc_to_snes(const unsigned int pc_addr);
|
|||||||
int hirom_sram_pc_to_snes(const unsigned int pc_addr);
|
int hirom_sram_pc_to_snes(const unsigned int pc_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AddressFromBytes(byte addr1, byte addr2, byte addr3);
|
||||||
|
|
||||||
class ROM {
|
class ROM {
|
||||||
public:
|
public:
|
||||||
int SnesToPc(int addr);
|
int SnesToPc(int addr);
|
||||||
int PcToSnes(int addr);
|
int PcToSnes(int addr);
|
||||||
int AddressFromBytes(byte addr1, byte addr2, byte addr3);
|
|
||||||
short AddressFromBytes(byte addr1, byte addr2);
|
short AddressFromBytes(byte addr1, byte addr2);
|
||||||
ushort ReadShort(int addr);
|
ushort ReadShort(int addr);
|
||||||
void Write(int addr, byte value);
|
void Write(int addr, byte value);
|
||||||
@@ -69,10 +70,14 @@ class ROM {
|
|||||||
unsigned int getSize() const { return size; }
|
unsigned int getSize() const { return size; }
|
||||||
char getVersion() const { return version; }
|
char getVersion() const { return version; }
|
||||||
|
|
||||||
|
bool isLoaded() const { return loaded; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<char> original_rom_;
|
std::vector<char> original_rom_;
|
||||||
std::vector<char> working_rom_;
|
std::vector<char> working_rom_;
|
||||||
|
|
||||||
|
bool loaded = false;
|
||||||
|
|
||||||
byte* current_rom_;
|
byte* current_rom_;
|
||||||
|
|
||||||
enum rom_type type;
|
enum rom_type type;
|
||||||
|
|||||||
Reference in New Issue
Block a user