The modified FCEUXDSP 1.07 NSF Updates were applied.
Additionally, Hex Editor and PPU coding that was causing errors because of the updates was also changed.
This commit is contained in:
parent
819b1b7a52
commit
208d27fd14
|
@ -31,6 +31,8 @@
|
||||||
#define INESPRIV
|
#define INESPRIV
|
||||||
#include "../../ines.h"
|
#include "../../ines.h"
|
||||||
|
|
||||||
|
#include "../../nsf.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void LoadCDLogFile();
|
void LoadCDLogFile();
|
||||||
|
@ -46,6 +48,11 @@ int CDLogger_wndx=0, CDLogger_wndy=0;
|
||||||
//extern uint8 *ROM;
|
//extern uint8 *ROM;
|
||||||
//extern uint8 *VROM;
|
//extern uint8 *VROM;
|
||||||
|
|
||||||
|
extern uint8 *NSFDATA;
|
||||||
|
extern int NSFMaxBank;
|
||||||
|
static uint8 NSFLoadLow;
|
||||||
|
static uint8 NSFLoadHigh;
|
||||||
|
|
||||||
//volatile int loggingcodedata;
|
//volatile int loggingcodedata;
|
||||||
//int cdlogger_open;
|
//int cdlogger_open;
|
||||||
|
|
||||||
|
@ -263,10 +270,10 @@ void DoCDLogger(){
|
||||||
FCEUD_PrintError("You must have a game loaded before you can use the Code Data Logger.");
|
FCEUD_PrintError("You must have a game loaded before you can use the Code Data Logger.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
//if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
||||||
FCEUD_PrintError("Sorry, you can't yet use the Code Data Logger with NSFs.");
|
// FCEUD_PrintError("Sorry, you can't yet use the Code Data Logger with NSFs.");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(!hCDLogger){
|
if(!hCDLogger){
|
||||||
CreateDialog(fceu_hInstance,"CDLOGGER",NULL,CDLoggerCallB);
|
CreateDialog(fceu_hInstance,"CDLOGGER",NULL,CDLoggerCallB);
|
||||||
|
@ -307,11 +314,18 @@ void LogPCM(int romaddress){
|
||||||
|
|
||||||
void SaveStrippedRom(){ //this is based off of iNesSave()
|
void SaveStrippedRom(){ //this is based off of iNesSave()
|
||||||
//todo: make this support nsfs
|
//todo: make this support nsfs
|
||||||
const char filter[]="Stripped iNes Rom file(*.NES)\0*.nes\0";
|
const char NESfilter[]="Stripped iNes Rom file(*.NES)\0*.nes\0";
|
||||||
|
const char NSFfilter[]="Stripped NSF file(*.NSF)\0*.nsf\0";
|
||||||
char sromfilename[MAX_PATH];
|
char sromfilename[MAX_PATH];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (GameInfo->type==GIT_NSF) {
|
||||||
|
MessageBox(NULL, "Sorry, you're not allowed to save optimized NSFs yet. Please don't optimize individual banks, as there are still some issues with several NSFs to be fixed, and it is easier to fix those issues with as much of the bank data intact as possible.", "Disallowed", MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(codecount == 0){
|
if(codecount == 0){
|
||||||
MessageBox(NULL, "Unable to Generate Stripped Rom. Get Something Logged and try again.", "Error", MB_OK);
|
MessageBox(NULL, "Unable to Generate Stripped Rom. Get Something Logged and try again.", "Error", MB_OK);
|
||||||
return;
|
return;
|
||||||
|
@ -319,8 +333,13 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
|
||||||
memset(&ofn,0,sizeof(ofn));
|
memset(&ofn,0,sizeof(ofn));
|
||||||
ofn.lStructSize=sizeof(ofn);
|
ofn.lStructSize=sizeof(ofn);
|
||||||
ofn.hInstance=fceu_hInstance;
|
ofn.hInstance=fceu_hInstance;
|
||||||
ofn.lpstrTitle="Save Stripped Rom File As...";
|
ofn.lpstrTitle="Save Stripped file As...";
|
||||||
ofn.lpstrFilter=filter;
|
if (GameInfo->type==GIT_NSF) {
|
||||||
|
ofn.lpstrFilter=NSFfilter;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ofn.lpstrFilter=NESfilter;
|
||||||
|
}
|
||||||
strcpy(sromfilename,GetRomName());
|
strcpy(sromfilename,GetRomName());
|
||||||
ofn.lpstrFile=sromfilename;
|
ofn.lpstrFile=sromfilename;
|
||||||
ofn.nMaxFile=256;
|
ofn.nMaxFile=256;
|
||||||
|
@ -330,6 +349,32 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
|
||||||
|
|
||||||
fp = fopen(sromfilename,"wb");
|
fp = fopen(sromfilename,"wb");
|
||||||
|
|
||||||
|
if(GameInfo->type==GIT_NSF)
|
||||||
|
{
|
||||||
|
//Not used because if bankswitching, the addresses involved
|
||||||
|
//could still end up being used through writes
|
||||||
|
//static uint16 LoadAddr;
|
||||||
|
//LoadAddr=NSFHeader.LoadAddressLow;
|
||||||
|
//LoadAddr|=(NSFHeader.LoadAddressHigh&0x7F)<<8;
|
||||||
|
|
||||||
|
//Simple store/restore for writing a working NSF header
|
||||||
|
NSFLoadLow = NSFHeader.LoadAddressLow;
|
||||||
|
NSFLoadHigh = NSFHeader.LoadAddressHigh;
|
||||||
|
NSFHeader.LoadAddressLow=0;
|
||||||
|
NSFHeader.LoadAddressHigh&=0xF0;
|
||||||
|
fwrite(&NSFHeader,1,0x8,fp);
|
||||||
|
NSFHeader.LoadAddressLow = NSFLoadLow;
|
||||||
|
NSFHeader.LoadAddressHigh = NSFLoadHigh;
|
||||||
|
|
||||||
|
fseek(fp,0x8,SEEK_SET);
|
||||||
|
for(i = 0;i < ((NSFMaxBank+1)*4096);i++){
|
||||||
|
if(cdloggerdata[i] & 3)fputc(NSFDATA[i],fp);
|
||||||
|
else fputc(0,fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if(fwrite(&head,1,16,fp)!=16)return;
|
if(fwrite(&head,1,16,fp)!=16)return;
|
||||||
|
|
||||||
if(head.ROM_type&4) /* Trainer */
|
if(head.ROM_type&4) /* Trainer */
|
||||||
|
@ -344,5 +389,7 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
|
||||||
//fwrite(ROM,0x4000,head.ROM_size,fp);
|
//fwrite(ROM,0x4000,head.ROM_size,fp);
|
||||||
|
|
||||||
if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp);
|
if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp);
|
||||||
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,10 +522,10 @@ void ConfigCheats(HWND hParent) {
|
||||||
FCEUD_PrintError("You must have a game loaded before you can manipulate cheats.");
|
FCEUD_PrintError("You must have a game loaded before you can manipulate cheats.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GameInfo->type==GIT_NSF) {
|
//if (GameInfo->type==GIT_NSF) {
|
||||||
FCEUD_PrintError("Sorry, you can't cheat with NSFs.");
|
// FCEUD_PrintError("Sorry, you can't cheat with NSFs.");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (!CheatWindow) {
|
if (!CheatWindow) {
|
||||||
selcheat=-1;
|
selcheat=-1;
|
||||||
|
|
|
@ -510,8 +510,14 @@ int GetMemViewData(uint32 i){
|
||||||
if(EditingMode == 1){
|
if(EditingMode == 1){
|
||||||
i &= 0x3FFF;
|
i &= 0x3FFF;
|
||||||
if(i < 0x2000)return VPage[(i)>>10][(i)];
|
if(i < 0x2000)return VPage[(i)>>10][(i)];
|
||||||
if(i < 0x3F00)return vnapage[(i>>10)&0x3][i&0x3FF];
|
//NSF PPU Viewer crash here (UGETAB)
|
||||||
return PALRAM[i&0x1F];
|
if (GameInfo->type==GIT_NSF) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(i < 0x3F00)return vnapage[(i>>10)&0x3][i&0x3FF];
|
||||||
|
return PALRAM[i&0x1F];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(EditingMode == 2){ //todo: use getfiledata() here
|
if(EditingMode == 2){ //todo: use getfiledata() here
|
||||||
if(i < 16) return *((unsigned char *)&head+i);
|
if(i < 16) return *((unsigned char *)&head+i);
|
||||||
|
@ -768,10 +774,10 @@ CursorStartAddy++;
|
||||||
void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset){
|
void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset){
|
||||||
SCROLLINFO si;
|
SCROLLINFO si;
|
||||||
|
|
||||||
if (GameInfo->type==GIT_NSF) {
|
//if (GameInfo->type==GIT_NSF) {
|
||||||
FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
// FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(!hMemView)DoMemView();
|
if(!hMemView)DoMemView();
|
||||||
if(EditingMode != newEditingMode)
|
if(EditingMode != newEditingMode)
|
||||||
|
@ -1608,10 +1614,10 @@ void DoMemView() {
|
||||||
FCEUD_PrintError("You must have a game loaded before you can use the Memory Viewer.");
|
FCEUD_PrintError("You must have a game loaded before you can use the Memory Viewer.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GameInfo->type==GIT_NSF) {
|
//if (GameInfo->type==GIT_NSF) {
|
||||||
FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
// FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (!hMemView){
|
if (!hMemView){
|
||||||
memset(&wndclass,0,sizeof(wndclass));
|
memset(&wndclass,0,sizeof(wndclass));
|
||||||
|
|
|
@ -604,10 +604,10 @@ void DoTracer(){
|
||||||
FCEUD_PrintError("You must have a game loaded before you can use the Trace Logger.");
|
FCEUD_PrintError("You must have a game loaded before you can use the Trace Logger.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
//if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
||||||
FCEUD_PrintError("Sorry, you can't yet use the Trace Logger with NSFs.");
|
// FCEUD_PrintError("Sorry, you can't yet use the Trace Logger with NSFs.");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(!hTracer){
|
if(!hTracer){
|
||||||
CreateDialog(fceu_hInstance,"TRACER",NULL,TracerCallB);
|
CreateDialog(fceu_hInstance,"TRACER",NULL,TracerCallB);
|
||||||
|
|
|
@ -353,7 +353,7 @@ void ResetGameLoaded(void)
|
||||||
int UNIFLoad(const char *name, FCEUFILE *fp);
|
int UNIFLoad(const char *name, FCEUFILE *fp);
|
||||||
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode);
|
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode);
|
||||||
int FDSLoad(const char *name, FCEUFILE *fp);
|
int FDSLoad(const char *name, FCEUFILE *fp);
|
||||||
int NSFLoad(FCEUFILE *fp);
|
int NSFLoad(const char *name, FCEUFILE *fp);
|
||||||
|
|
||||||
//char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron
|
//char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
|
||||||
goto endlseq;*/
|
goto endlseq;*/
|
||||||
if(iNESLoad(name,fp,OverwriteVidMode))
|
if(iNESLoad(name,fp,OverwriteVidMode))
|
||||||
goto endlseq;
|
goto endlseq;
|
||||||
if(NSFLoad(fp))
|
if(NSFLoad(name,fp))
|
||||||
goto endlseq;
|
goto endlseq;
|
||||||
if(UNIFLoad(name,fp))
|
if(UNIFLoad(name,fp))
|
||||||
goto endlseq;
|
goto endlseq;
|
||||||
|
|
38
src/nsf.cpp
38
src/nsf.cpp
|
@ -109,15 +109,19 @@ static DECLFR(NSFROMRead)
|
||||||
|
|
||||||
static int doreset=0;
|
static int doreset=0;
|
||||||
static int NSFNMIFlags;
|
static int NSFNMIFlags;
|
||||||
static uint8 *NSFDATA=0;
|
uint8 *NSFDATA=0;
|
||||||
static int NSFMaxBank;
|
int NSFMaxBank;
|
||||||
|
|
||||||
static int NSFSize;
|
static int NSFSize;
|
||||||
static uint8 BSon;
|
static uint8 BSon;
|
||||||
|
static uint8 BankCounter;
|
||||||
|
|
||||||
static uint16 PlayAddr;
|
static uint16 PlayAddr;
|
||||||
static uint16 InitAddr;
|
static uint16 InitAddr;
|
||||||
static uint16 LoadAddr;
|
static uint16 LoadAddr;
|
||||||
|
|
||||||
|
extern char LoadedRomFName[2048];
|
||||||
|
|
||||||
NSF_HEADER NSFHeader; //mbg merge 6/29/06 - needs to be global
|
NSF_HEADER NSFHeader; //mbg merge 6/29/06 - needs to be global
|
||||||
|
|
||||||
void NSFMMC5_Close(void);
|
void NSFMMC5_Close(void);
|
||||||
|
@ -160,7 +164,7 @@ static INLINE void BANKSET(uint32 A, uint32 bank)
|
||||||
setprg4(A,bank);
|
setprg4(A,bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
int NSFLoad(FCEUFILE *fp)
|
int NSFLoad(const char *name, FCEUFILE *fp)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
@ -187,7 +191,7 @@ int NSFLoad(FCEUFILE *fp)
|
||||||
NSFSize=FCEU_fgetsize(fp)-0x80;
|
NSFSize=FCEU_fgetsize(fp)-0x80;
|
||||||
|
|
||||||
NSFMaxBank=((NSFSize+(LoadAddr&0xfff)+4095)/4096);
|
NSFMaxBank=((NSFSize+(LoadAddr&0xfff)+4095)/4096);
|
||||||
NSFMaxBank=uppow2(NSFMaxBank);
|
NSFMaxBank=PRGsize[0]=uppow2(NSFMaxBank);
|
||||||
|
|
||||||
if(!(NSFDATA=(uint8 *)FCEU_malloc(NSFMaxBank*4096)))
|
if(!(NSFDATA=(uint8 *)FCEU_malloc(NSFMaxBank*4096)))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -199,6 +203,30 @@ int NSFLoad(FCEUFILE *fp)
|
||||||
NSFMaxBank--;
|
NSFMaxBank--;
|
||||||
|
|
||||||
BSon=0;
|
BSon=0;
|
||||||
|
for(x=0;x<8;x++)
|
||||||
|
{
|
||||||
|
BSon|=NSFHeader.BankSwitch[x];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(BSon==0)
|
||||||
|
{
|
||||||
|
BankCounter=0x00;
|
||||||
|
|
||||||
|
if ((NSFHeader.LoadAddressHigh & 0x70) >= 0x70)
|
||||||
|
{
|
||||||
|
//Ice Climber, and other F000 base address tunes need this
|
||||||
|
BSon=0xFF;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(x=(NSFHeader.LoadAddressHigh & 0x70) / 0x10;x<8;x++)
|
||||||
|
{
|
||||||
|
NSFHeader.BankSwitch[x]=BankCounter;
|
||||||
|
BankCounter+=0x01;
|
||||||
|
}
|
||||||
|
BSon=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(x=0;x<8;x++)
|
for(x=0;x<8;x++)
|
||||||
BSon|=NSFHeader.BankSwitch[x];
|
BSon|=NSFHeader.BankSwitch[x];
|
||||||
|
|
||||||
|
@ -225,6 +253,8 @@ int NSFLoad(FCEUFILE *fp)
|
||||||
|
|
||||||
GameInterface=NSFGI;
|
GameInterface=NSFGI;
|
||||||
|
|
||||||
|
strcpy(LoadedRomFName,name);
|
||||||
|
|
||||||
FCEU_printf("NSF Loaded. File information:\n\n");
|
FCEU_printf("NSF Loaded. File information:\n\n");
|
||||||
FCEU_printf(" Name: %s\n Artist: %s\n Copyright: %s\n\n",NSFHeader.SongName,NSFHeader.Artist,NSFHeader.Copyright);
|
FCEU_printf(" Name: %s\n Artist: %s\n Copyright: %s\n\n",NSFHeader.SongName,NSFHeader.Artist,NSFHeader.Copyright);
|
||||||
if(NSFHeader.SoundChip)
|
if(NSFHeader.SoundChip)
|
||||||
|
|
|
@ -46,6 +46,8 @@ typedef struct {
|
||||||
void NSF_init(void);
|
void NSF_init(void);
|
||||||
void DrawNSF(uint8 *XBuf);
|
void DrawNSF(uint8 *XBuf);
|
||||||
extern NSF_HEADER NSFHeader; //mbg merge 6/29/06
|
extern NSF_HEADER NSFHeader; //mbg merge 6/29/06
|
||||||
|
extern uint8 *NSFDATA;
|
||||||
|
extern int NSFMaxBank;
|
||||||
void NSFDealloc(void);
|
void NSFDealloc(void);
|
||||||
void NSFDodo(void);
|
void NSFDodo(void);
|
||||||
void DoNSFFrame(void);
|
void DoNSFFrame(void);
|
||||||
|
|
|
@ -1863,7 +1863,7 @@ void FCEUPPU_Power(void)
|
||||||
|
|
||||||
int FCEUPPU_Loop(int skip)
|
int FCEUPPU_Loop(int skip)
|
||||||
{
|
{
|
||||||
if(newppu) {
|
if((newppu) && (GameInfo->type!=GIT_NSF)) {
|
||||||
int FCEUX_PPU_Loop(int skip);
|
int FCEUX_PPU_Loop(int skip);
|
||||||
return FCEUX_PPU_Loop(skip);
|
return FCEUX_PPU_Loop(skip);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue