Skip to content

Commit

Permalink
fixed finale bug on unrom patch
Browse files Browse the repository at this point in the history
  • Loading branch information
nstbayless committed Mar 6, 2023
1 parent 23d0d0f commit b7e800b
Show file tree
Hide file tree
Showing 7 changed files with 279 additions and 75 deletions.
152 changes: 152 additions & 0 deletions nesm/src/icon.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added nesm/src/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions nesm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,19 @@ void handle_joystick_removed(uint32_t index)
}
}

// regenerate via gimp C source export
#include "icon.c"
SDL_Surface* getIcon(void)
{
// Create a 32x32 RGBA surface
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, icon.width, icon.height, icon.bytes_per_pixel * 8, SDL_PIXELFORMAT_ABGR8888);

// Set each pixel to a unique color based on its coordinates
memcpy(surface->pixels, icon.pixel_data, icon.width * icon.height * icon.bytes_per_pixel);

return surface;
}

#ifdef _WIN32
#include <windows.h>
#include <stringapiset.h>
Expand Down Expand Up @@ -378,6 +391,8 @@ int main(int argc, char** argv)

memset(&controller, 0, 2 * sizeof(SDL_GameController*));

SDL_Surface* iconsrf = getIcon();
SDL_SetWindowIcon(wnd, iconsrf);
SDL_ShowWindow(wnd);

while(!quit)
Expand Down Expand Up @@ -444,6 +459,7 @@ int main(int argc, char** argv)
}

SDL_DestroyWindow(wnd);
SDL_FreeSurface(iconsrf);
if (audio_device_id >= 0)
SDL_CloseAudioDevice(audio_device_id);

Expand Down
19 changes: 11 additions & 8 deletions src/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from src.util import *
from src import emulaunch

mmname = "MMagEdit v1.30"
mmname = "MMagEdit v1.31"
mmrepo = "https://github.com/nstbayless/mmagedit"
mmfmt = 202204032250

Expand Down Expand Up @@ -65,7 +65,7 @@ def emucredits():

# space available
ram_range_music = [0x8000, 0x860A]
ram_range_levels = [0xdaec, 0xe6c3]
ram_range_levels = [0xdaec, 0xe6c3+49]
ram_range_text = [0xEC67, 0xEE67]
ram_range_uncompressed_text = [0xEE67, 0xEE67+5] # pause text
ram_pause_text_offset = 0xBAD3
Expand Down Expand Up @@ -93,11 +93,14 @@ def emucredits():

mirror_pairs_count = 6 # (x2).
world_count = 4
level_count = 0xd
level_count = 0xE
level_idx_finale = 0xD
level_idx_44 = 0xC
global_macro_tiles_count = 0x24
global_med_tiles_count = 0x4c
macro_rows_per_level = 0x20
objects_start_y = macro_rows_per_level * 4

standard_macro_rows = 0x20
finale_macro_rows = 0x08

hidden_micro_tiles = range(0x78, 0x7e)
dangerous_micro_tiles = [0x01]
Expand Down Expand Up @@ -368,7 +371,7 @@ def emucredits():
["beer", "barrel-thrower", "beer-bros"],

# 6
["boss-final", "boss-5"], # eye boss, but in space.
["boss-final", "boss-5", "boss-finale"], # eye boss, but in space.

# 7
["goat"],
Expand Down Expand Up @@ -548,8 +551,8 @@ def emucredits():
# 5 -- beer
{ "palette": 1, "chr": [[0x58, 0x59], [0x5a, 0x5b]], "offset": [4, -24] },

# 6 -- glowy-eye ??
{ },
# 6 -- finale boss
{ "palette": 2, "chr": [[0x70, 0x71, 0x271, 0x270], [0x80, 0x81, 0x281, 0x280], [0x480, 0x481, 0x681, 0x680], [0x470, 0x471, 0x671, 0x670]], "offset": (0, 8) },

# 7 -- goat
{ "palette": 1, "chr": [[0xa0, 0xa1], [0xb0, 0xb1]] },
Expand Down
Loading

0 comments on commit b7e800b

Please sign in to comment.