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
|
||||
#include "../../ines.h"
|
||||
|
||||
#include "../../nsf.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void LoadCDLogFile();
|
||||
|
@ -46,6 +48,11 @@ int CDLogger_wndx=0, CDLogger_wndy=0;
|
|||
//extern uint8 *ROM;
|
||||
//extern uint8 *VROM;
|
||||
|
||||
extern uint8 *NSFDATA;
|
||||
extern int NSFMaxBank;
|
||||
static uint8 NSFLoadLow;
|
||||
static uint8 NSFLoadHigh;
|
||||
|
||||
//volatile int loggingcodedata;
|
||||
//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.");
|
||||
return;
|
||||
}
|
||||
if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
||||
FCEUD_PrintError("Sorry, you can't yet use the Code Data Logger with NSFs.");
|
||||
return;
|
||||
}
|
||||
//if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
||||
// FCEUD_PrintError("Sorry, you can't yet use the Code Data Logger with NSFs.");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if(!hCDLogger){
|
||||
CreateDialog(fceu_hInstance,"CDLOGGER",NULL,CDLoggerCallB);
|
||||
|
@ -307,11 +314,18 @@ void LogPCM(int romaddress){
|
|||
|
||||
void SaveStrippedRom(){ //this is based off of iNesSave()
|
||||
//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];
|
||||
FILE *fp;
|
||||
OPENFILENAME ofn;
|
||||
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){
|
||||
MessageBox(NULL, "Unable to Generate Stripped Rom. Get Something Logged and try again.", "Error", MB_OK);
|
||||
return;
|
||||
|
@ -319,8 +333,13 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
|
|||
memset(&ofn,0,sizeof(ofn));
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
ofn.hInstance=fceu_hInstance;
|
||||
ofn.lpstrTitle="Save Stripped Rom File As...";
|
||||
ofn.lpstrFilter=filter;
|
||||
ofn.lpstrTitle="Save Stripped file As...";
|
||||
if (GameInfo->type==GIT_NSF) {
|
||||
ofn.lpstrFilter=NSFfilter;
|
||||
}
|
||||
else {
|
||||
ofn.lpstrFilter=NESfilter;
|
||||
}
|
||||
strcpy(sromfilename,GetRomName());
|
||||
ofn.lpstrFile=sromfilename;
|
||||
ofn.nMaxFile=256;
|
||||
|
@ -330,6 +349,32 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
|
|||
|
||||
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(head.ROM_type&4) /* Trainer */
|
||||
|
@ -344,5 +389,7 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
|
|||
//fwrite(ROM,0x4000,head.ROM_size,fp);
|
||||
|
||||
if(head.VROM_size)fwrite(VROM,0x2000,head.VROM_size,fp);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
|
|
@ -522,10 +522,10 @@ void ConfigCheats(HWND hParent) {
|
|||
FCEUD_PrintError("You must have a game loaded before you can manipulate cheats.");
|
||||
return;
|
||||
}
|
||||
if (GameInfo->type==GIT_NSF) {
|
||||
FCEUD_PrintError("Sorry, you can't cheat with NSFs.");
|
||||
return;
|
||||
}
|
||||
//if (GameInfo->type==GIT_NSF) {
|
||||
// FCEUD_PrintError("Sorry, you can't cheat with NSFs.");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (!CheatWindow) {
|
||||
selcheat=-1;
|
||||
|
|
|
@ -510,9 +510,15 @@ int GetMemViewData(uint32 i){
|
|||
if(EditingMode == 1){
|
||||
i &= 0x3FFF;
|
||||
if(i < 0x2000)return VPage[(i)>>10][(i)];
|
||||
//NSF PPU Viewer crash here (UGETAB)
|
||||
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(i < 16) return *((unsigned char *)&head+i);
|
||||
if(i < 16+PRGsize[0])return PRGptr[0][i-16];
|
||||
|
@ -768,10 +774,10 @@ CursorStartAddy++;
|
|||
void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset){
|
||||
SCROLLINFO si;
|
||||
|
||||
if (GameInfo->type==GIT_NSF) {
|
||||
FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
||||
return;
|
||||
}
|
||||
//if (GameInfo->type==GIT_NSF) {
|
||||
// FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if(!hMemView)DoMemView();
|
||||
if(EditingMode != newEditingMode)
|
||||
|
@ -1608,10 +1614,10 @@ void DoMemView() {
|
|||
FCEUD_PrintError("You must have a game loaded before you can use the Memory Viewer.");
|
||||
return;
|
||||
}
|
||||
if (GameInfo->type==GIT_NSF) {
|
||||
FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
||||
return;
|
||||
}
|
||||
//if (GameInfo->type==GIT_NSF) {
|
||||
// FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (!hMemView){
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
||||
FCEUD_PrintError("Sorry, you can't yet use the Trace Logger with NSFs.");
|
||||
return;
|
||||
}
|
||||
//if (GameInfo->type==GIT_NSF) { //todo: NSF support!
|
||||
// FCEUD_PrintError("Sorry, you can't yet use the Trace Logger with NSFs.");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if(!hTracer){
|
||||
CreateDialog(fceu_hInstance,"TRACER",NULL,TracerCallB);
|
||||
|
|
|
@ -353,7 +353,7 @@ void ResetGameLoaded(void)
|
|||
int UNIFLoad(const char *name, FCEUFILE *fp);
|
||||
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode);
|
||||
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
|
||||
|
||||
|
@ -416,7 +416,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
|
|||
goto endlseq;*/
|
||||
if(iNESLoad(name,fp,OverwriteVidMode))
|
||||
goto endlseq;
|
||||
if(NSFLoad(fp))
|
||||
if(NSFLoad(name,fp))
|
||||
goto endlseq;
|
||||
if(UNIFLoad(name,fp))
|
||||
goto endlseq;
|
||||
|
|
38
src/nsf.cpp
38
src/nsf.cpp
|
@ -109,15 +109,19 @@ static DECLFR(NSFROMRead)
|
|||
|
||||
static int doreset=0;
|
||||
static int NSFNMIFlags;
|
||||
static uint8 *NSFDATA=0;
|
||||
static int NSFMaxBank;
|
||||
uint8 *NSFDATA=0;
|
||||
int NSFMaxBank;
|
||||
|
||||
static int NSFSize;
|
||||
static uint8 BSon;
|
||||
static uint8 BankCounter;
|
||||
|
||||
static uint16 PlayAddr;
|
||||
static uint16 InitAddr;
|
||||
static uint16 LoadAddr;
|
||||
|
||||
extern char LoadedRomFName[2048];
|
||||
|
||||
NSF_HEADER NSFHeader; //mbg merge 6/29/06 - needs to be global
|
||||
|
||||
void NSFMMC5_Close(void);
|
||||
|
@ -160,7 +164,7 @@ static INLINE void BANKSET(uint32 A, uint32 bank)
|
|||
setprg4(A,bank);
|
||||
}
|
||||
|
||||
int NSFLoad(FCEUFILE *fp)
|
||||
int NSFLoad(const char *name, FCEUFILE *fp)
|
||||
{
|
||||
int x;
|
||||
|
||||
|
@ -187,7 +191,7 @@ int NSFLoad(FCEUFILE *fp)
|
|||
NSFSize=FCEU_fgetsize(fp)-0x80;
|
||||
|
||||
NSFMaxBank=((NSFSize+(LoadAddr&0xfff)+4095)/4096);
|
||||
NSFMaxBank=uppow2(NSFMaxBank);
|
||||
NSFMaxBank=PRGsize[0]=uppow2(NSFMaxBank);
|
||||
|
||||
if(!(NSFDATA=(uint8 *)FCEU_malloc(NSFMaxBank*4096)))
|
||||
return 0;
|
||||
|
@ -199,6 +203,30 @@ int NSFLoad(FCEUFILE *fp)
|
|||
NSFMaxBank--;
|
||||
|
||||
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++)
|
||||
BSon|=NSFHeader.BankSwitch[x];
|
||||
|
||||
|
@ -225,6 +253,8 @@ int NSFLoad(FCEUFILE *fp)
|
|||
|
||||
GameInterface=NSFGI;
|
||||
|
||||
strcpy(LoadedRomFName,name);
|
||||
|
||||
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);
|
||||
if(NSFHeader.SoundChip)
|
||||
|
|
|
@ -46,6 +46,8 @@ typedef struct {
|
|||
void NSF_init(void);
|
||||
void DrawNSF(uint8 *XBuf);
|
||||
extern NSF_HEADER NSFHeader; //mbg merge 6/29/06
|
||||
extern uint8 *NSFDATA;
|
||||
extern int NSFMaxBank;
|
||||
void NSFDealloc(void);
|
||||
void NSFDodo(void);
|
||||
void DoNSFFrame(void);
|
||||
|
|
|
@ -1863,7 +1863,7 @@ void FCEUPPU_Power(void)
|
|||
|
||||
int FCEUPPU_Loop(int skip)
|
||||
{
|
||||
if(newppu) {
|
||||
if((newppu) && (GameInfo->type!=GIT_NSF)) {
|
||||
int FCEUX_PPU_Loop(int skip);
|
||||
return FCEUX_PPU_Loop(skip);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue