Skip to content

Commit d0f94df

Browse files
Add NES 2.0 parsing to quickerNES
This is more just to reject more ROMs that quickerNES cannot run (as it runs under simple iNES assumptions and can't handle complicated cases) Also resolves #4402 (quickerNES won't be accepting any NES 2.0 ROM indicating it needs PAL or Dendy timing)
1 parent 14032a5 commit d0f94df

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

Assets/dll/libquicknes.dll

2.5 KB
Binary file not shown.

quicknes/bizinterface.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include <cstdlib>
2-
#include <cstring>
1+
#include <stdlib.h>
2+
#include <string.h>
33
#include <emu.hpp>
44
#include <jaffarCommon/file.hpp>
55
#include <jaffarCommon/serializers/contiguous.hpp>
@@ -21,10 +21,18 @@ QN_EXPORT quickerNES::Emu *qn_new()
2121
{
2222
// Zero intialized emulator to make super sure no side effects from previous data remains
2323
auto ptr = calloc(1, sizeof(quickerNES::Emu));
24+
if (!ptr) return NULL;
2425
auto e = new (ptr) quickerNES::Emu();
2526

2627
// Creating video buffer
2728
auto videoBuffer = (uint8_t *) malloc(VIDEO_BUFFER_SIZE);
29+
if (!videoBuffer)
30+
{
31+
e->~Emu();
32+
free(e);
33+
return NULL;
34+
}
35+
2836
e->set_pixels(videoBuffer, DEFAULT_WIDTH + 8);
2937

3038
return e;
@@ -39,7 +47,7 @@ QN_EXPORT void qn_delete(quickerNES::Emu *e)
3947

4048
QN_EXPORT const char *qn_loadines(quickerNES::Emu *e, const uint8_t *data, int length)
4149
{
42-
return e->load_ines(data);
50+
return e->load_ines(data, length);
4351
}
4452

4553
QN_EXPORT const char *qn_set_sample_rate(quickerNES::Emu *e, int rate)
@@ -192,7 +200,7 @@ QN_EXPORT const char *qn_battery_ram_clear(quickerNES::Emu *e)
192200
{
193201
int size = 0;
194202
qn_battery_ram_size(e, &size);
195-
std::memset(e->high_mem(), 0xff, size);
203+
memset(e->high_mem(), 0xff, size);
196204
return 0;
197205
}
198206

quicknes/core

0 commit comments

Comments
 (0)