Replace direct file access with VFS routines
This commit is contained in:
28
src/debug.c
28
src/debug.c
@@ -22,38 +22,44 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#include "fceu-types.h"
|
||||
#include "x6502.h"
|
||||
#include "fceu.h"
|
||||
#include "debug.h"
|
||||
#include "cart.h"
|
||||
|
||||
|
||||
void FCEUI_DumpVid(const char *fname, uint32 start, uint32 end) {
|
||||
FILE *fp = FCEUD_UTF8fopen(fname, "wb");
|
||||
RFILE *fp = filestream_open(fname,
|
||||
RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
fceuindbg = 1;
|
||||
start &= 0x3FFF;
|
||||
end &= 0x3FFF;
|
||||
for (; start <= end; start++)
|
||||
fputc(VPage[start >> 10][start], fp);
|
||||
fclose(fp);
|
||||
filestream_putc(fp, VPage[start >> 10][start]);
|
||||
filestream_close(fp);
|
||||
fceuindbg = 0;
|
||||
}
|
||||
|
||||
void FCEUI_DumpMem(const char *fname, uint32 start, uint32 end) {
|
||||
FILE *fp = FCEUD_UTF8fopen(fname, "wb");
|
||||
RFILE *fp = filestream_open(fname,
|
||||
RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
fceuindbg = 1;
|
||||
for (; start <= end; start++)
|
||||
fputc(ARead[start](start), fp);
|
||||
fclose(fp);
|
||||
filestream_putc(fp, ARead[start](start));
|
||||
filestream_close(fp);
|
||||
fceuindbg = 0;
|
||||
}
|
||||
|
||||
void FCEUI_LoadMem(const char *fname, uint32 start, int hl) {
|
||||
int t;
|
||||
|
||||
FILE *fp = FCEUD_UTF8fopen(fname, "rb");
|
||||
while ((t = fgetc(fp)) >= 0) {
|
||||
RFILE *fp = filestream_open(fname,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
while ((t = filestream_getc(fp)) >= 0) {
|
||||
if (start > 0xFFFF) break;
|
||||
if (hl) {
|
||||
extern uint8 *Page[32];
|
||||
@@ -63,7 +69,7 @@ void FCEUI_LoadMem(const char *fname, uint32 start, int hl) {
|
||||
BWrite[start](start, t);
|
||||
start++;
|
||||
}
|
||||
fclose(fp);
|
||||
filestream_close(fp);
|
||||
}
|
||||
|
||||
#ifdef FCEUDEF_DEBUGGER
|
||||
|
||||
Reference in New Issue
Block a user