mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
core, always allocate a power of 2 for cartridges
This commit is contained in:
parent
12d506baa8
commit
28165a19e4
1 changed files with 9 additions and 8 deletions
|
@ -713,7 +713,6 @@ static unsigned char *PicoCartAlloc(int filesize, int is_sms)
|
|||
{
|
||||
unsigned char *rom;
|
||||
|
||||
if (is_sms) {
|
||||
// make size power of 2 for easier banking handling
|
||||
int s = 0, tmp = filesize;
|
||||
while ((tmp >>= 1) != 0)
|
||||
|
@ -721,13 +720,15 @@ static unsigned char *PicoCartAlloc(int filesize, int is_sms)
|
|||
if (filesize > (1 << s))
|
||||
s++;
|
||||
rom_alloc_size = 1 << s;
|
||||
|
||||
if (is_sms) {
|
||||
// be sure we can cover all address space
|
||||
if (rom_alloc_size < 0x10000)
|
||||
rom_alloc_size = 0x10000;
|
||||
}
|
||||
else {
|
||||
// align to 512K for memhandlers
|
||||
rom_alloc_size = (filesize + 0x7ffff) & ~0x7ffff;
|
||||
rom_alloc_size = (rom_alloc_size + 0x7ffff) & ~0x7ffff;
|
||||
}
|
||||
|
||||
if (rom_alloc_size - filesize < 4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue