Skip to content

Commit

Permalink
3rdParty: apply experimental rom size patch to mupen64plus-core
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Jan 9, 2025
1 parent b266371 commit 116eeb3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define __STDC_FORMAT_MACROS
#include <inttypes.h>

#define CART_ROM_ADDR_MASK UINT32_C(0x03ffffff);
#define CART_ROM_ADDR_MASK UINT32_C(0xefffffff);


void init_cart_rom(struct cart_rom* cart_rom,
Expand Down
5 changes: 3 additions & 2 deletions Source/3rdParty/mupen64plus-core/src/device/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "device.h"

#include "main/util.h"
#include "memory/memory.h"
#include "pif/pif.h"
#include "r4300/r4300_core.h"
Expand Down Expand Up @@ -57,7 +58,7 @@ static void get_pi_dma_handler(struct cart* cart, struct dd_controller* dd, uint

if (address >= MM_CART_ROM) {
if (address >= MM_CART_DOM3) {
/* 0x1fd00000 - 0x7fffffff : dom3 addr2, cart rom (Paper Mario (U)) ??? */
/* 0x1fd00000 - 0xffffffff : dom3 addr2, cart rom */
RW(cart, cart_dom3);
}
else {
Expand Down Expand Up @@ -155,7 +156,7 @@ void init_device(struct device* dev,
{ A(MM_DD_ROM, 0x1ffffff), M64P_MEM_NOTHING, { NULL, RW(open_bus) } },
{ A(MM_DOM2_ADDR2, 0x1ffff), M64P_MEM_FLASHRAMSTAT, { &dev->cart, RW(cart_dom2) } },
{ A(MM_IS_VIEWER, 0xfff), M64P_MEM_NOTHING, { &dev->is, RW(is_viewer) } },
{ A(MM_CART_ROM, rom_size-1), M64P_MEM_ROM, { &dev->cart.cart_rom, RW(cart_rom) } },
{ A(MM_CART_ROM, min(rom_size-1, 0x3ffffff)), M64P_MEM_ROM, { &dev->cart.cart_rom, RW(cart_rom) } },
{ A(MM_PIF_MEM, 0xffff), M64P_MEM_PIF, { &dev->pif, RW(pif_mem) } }
};

Expand Down
4 changes: 1 addition & 3 deletions Source/3rdParty/mupen64plus-core/src/device/gb/m64282fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
*/

#include "m64282fp.h"
#include "main/util.h"

#include <string.h>

int min(int a, int b) { return (a < b) ? a : b; }
int max(int a, int b) { return (a < b) ? b : a; }

int clamp(int v, int low, int high)
{
return min(high, max(low, v));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ enum {
MB_DD_ROM = MB_RSP_MEM + SP_MEM_SIZE,
MB_PIF_MEM = MB_DD_ROM + DD_ROM_MAX_SIZE,
MB_MAX_SIZE = MB_PIF_MEM + PIF_ROM_SIZE + PIF_RAM_SIZE,
MB_MAX_SIZE_FULL = 0x20000000
MB_MAX_SIZE_FULL = 0x120000000,
};

/* Use LSB of mem_base pointer to encode mem_base mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "osal/preproc.h"

enum { RDRAM_MAX_SIZE = 0x800000 };
enum { CART_ROM_MAX_SIZE = 0x4000000 };
enum { CART_ROM_MAX_SIZE = 0x100000000 };
enum { DD_ROM_MAX_SIZE = 0x400000 };

typedef void (*read32fn)(void*,uint32_t,uint32_t*);
Expand Down
3 changes: 3 additions & 0 deletions Source/3rdParty/mupen64plus-core/src/main/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ struct xoshiro256pp_state xoshiro256pp_seed(uint64_t seed);

uint64_t xoshiro256pp_next(struct xoshiro256pp_state* s);

#define min(a, b) ((a < b) ? a : b)
#define max(a, b) ((a < b) ? b : a)

/**********************
GUI utilities
**********************/
Expand Down

0 comments on commit 116eeb3

Please sign in to comment.