- add 2nd player to tasedit

- fix bugs which broke movies with saveram which was added when 7zip was added
- fix bugs in tasedit insert and delete
This commit is contained in:
zeromus 2008-06-28 23:31:02 +00:00
parent e8da728db3
commit 033ae55048
6 changed files with 957 additions and 886 deletions

View File

@ -1259,15 +1259,15 @@ BEGIN
PUSHBUTTON "Metadata...",IDC_BUTTON_METADATA,239,71,50,14 PUSHBUTTON "Metadata...",IDC_BUTTON_METADATA,239,71,50,14
END END
TASEDIT DIALOGEX 0, 0, 470, 349 TASEDIT DIALOGEX 0, 0, 513, 356
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TAS Editor" CAPTION "TAS Editor"
MENU TASEDITMENU MENU TASEDITMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,273,296 CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,302,342
PUSHBUTTON "Hacky truncate after current frame",IDC_HACKY1,312,7,124,38 PUSHBUTTON "Hacky truncate after current frame",IDC_HACKY1,347,7,124,38
LTEXT "I think this will prove useful enough for a hotkey at some point",IDC_STATIC,312,46,125,16 LTEXT "I think this will prove useful enough for a hotkey at some point",IDC_STATIC,347,46,125,16
END END
ASSEMBLER DIALOGEX 0, 0, 202, 135 ASSEMBLER DIALOGEX 0, 0, 202, 135
@ -1444,9 +1444,9 @@ BEGIN
"TASEDIT", DIALOG "TASEDIT", DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 463 RIGHTMARGIN, 506
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 342 BOTTOMMARGIN, 349
END END
"ASSEMBLER", DIALOG "ASSEMBLER", DIALOG

View File

@ -54,9 +54,19 @@ static void GetDispInfo(NMLVDISPINFO* nmlvDispInfo)
case 6: case 6:
case 7: case 7:
case 8: case 8:
case 9: { case 9:
int bit = (item.iSubItem - 2); case 10:
uint8 data = currMovieData.records[item.iItem].joysticks[0]; case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
{
int joy = (item.iSubItem - 2)/8;
int bit = (item.iSubItem - 2)%8;
uint8 data = currMovieData.records[item.iItem].joysticks[joy];
if(data & (1<<bit)) if(data & (1<<bit))
{ {
item.pszText[0] = MovieRecord::mnemonics[bit]; item.pszText[0] = MovieRecord::mnemonics[bit];
@ -88,8 +98,13 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
return CDRF_NOTIFYSUBITEMDRAW; return CDRF_NOTIFYSUBITEMDRAW;
case CDDS_SUBITEMPREPAINT: case CDDS_SUBITEMPREPAINT:
SelectObject(msg->nmcd.hdc,debugSystem->hFixedFont); SelectObject(msg->nmcd.hdc,debugSystem->hFixedFont);
if((msg->iSubItem-2)/8==0)
if((int)msg->nmcd.dwItemSpec < currMovieData.greenZoneCount) if((int)msg->nmcd.dwItemSpec < currMovieData.greenZoneCount)
msg->clrTextBk = RGB(192,255,192); msg->clrTextBk = RGB(192,255,192);
else {}
else if((int)msg->nmcd.dwItemSpec < currMovieData.greenZoneCount)
msg->clrTextBk = RGB(144,192,144);
else msg->clrTextBk = RGB(192,192,192);
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
default: default:
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
@ -211,8 +226,9 @@ void DoubleClick(LPNMITEMACTIVATE info)
else //if an input column was clicked: else //if an input column was clicked:
{ {
//toggle the bit //toggle the bit
int bit = (info->iSubItem-2); int joy = (info->iSubItem - 2)/8;
currMovieData.records[index].toggleBit(0,bit); int bit = (info->iSubItem - 2)%8;
currMovieData.records[index].toggleBit(joy,bit);
//update the row //update the row
ListView_Update(hwndList,index); ListView_Update(hwndList,index);
@ -224,6 +240,23 @@ void DoubleClick(LPNMITEMACTIVATE info)
} }
} }
//removes all selections
static void ClearSelection()
{
int frameCount = ListView_GetItemCount(hwndList);
LVITEM lvi;
lvi.mask = LVIF_STATE;
lvi.state = 0;
lvi.stateMask = LVIS_SELECTED;
for(int i=0;i<frameCount;i++)
{
lvi.iItem = i;
ListView_SetItem(hwndList,&lvi);
}
selectionFrames.clear();
}
//insert frames at the currently selected positions. //insert frames at the currently selected positions.
static void InsertFrames() static void InsertFrames()
{ {
@ -241,7 +274,6 @@ static void InsertFrames()
} }
InvalidateGreenZone(*selectionFrames.begin()); InvalidateGreenZone(*selectionFrames.begin());
UpdateTasEdit(); UpdateTasEdit();
RedrawList(); RedrawList();
} }
@ -249,6 +281,13 @@ static void InsertFrames()
//delete frames at the currently selected positions. //delete frames at the currently selected positions.
static void DeleteFrames() static void DeleteFrames()
{ {
int frames = selectionFrames.size();
if(frames == currMovieData.records.size())
{
MessageBox(hwndTasEdit,"Please don't delete all of the frames in the movie. This violates an internal invariant we need to keep.","Error deleting",0);
return;
}
//this is going to be _really_ slow. //this is going to be _really_ slow.
//insert frames before each selection //insert frames before each selection
@ -263,7 +302,7 @@ static void DeleteFrames()
//in the particular case of deletion, we need to make sure we reset currFrameCounter to something reasonable //in the particular case of deletion, we need to make sure we reset currFrameCounter to something reasonable
//why not the current green zone max? //why not the current green zone max?
currFrameCounter = currMovieData.greenZoneCount-1; currFrameCounter = currMovieData.greenZoneCount-1;
ClearSelection();
UpdateTasEdit(); UpdateTasEdit();
RedrawList(); RedrawList();
} }
@ -404,6 +443,22 @@ static void InitDialog()
ListView_InsertColumn(hwndList, colidx++, &lvc); ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "R"; lvc.pszText = "R";
ListView_InsertColumn(hwndList, colidx++, &lvc); ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "A";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "B";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "S";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "T";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "U";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "D";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "L";
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "R";
ListView_InsertColumn(hwndList, colidx++, &lvc);
//----------------------------- //-----------------------------
//the initial update //the initial update

View File

@ -302,7 +302,6 @@ 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(FCEUFILE *fp);
//mbg 6/25/08 - remove this one day
//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
@ -607,8 +606,11 @@ void hand(X6502 *X, int type, unsigned int A)
} }
int suppressAddPowerCommand=0; // hack... yeah, I know... int suppressAddPowerCommand=0; // hack... yeah, I know...
void MapperInit();
void PowerNES(void) void PowerNES(void)
{ {
MapperInit();
if(!suppressAddPowerCommand) if(!suppressAddPowerCommand)
FCEUMOV_AddCommand(FCEUNPCMD_POWER); FCEUMOV_AddCommand(FCEUNPCMD_POWER);
if(!GameInfo) return; if(!GameInfo) return;
@ -639,6 +641,8 @@ void PowerNES(void)
if(GameInfo->type==GIT_VSUNI) if(GameInfo->type==GIT_VSUNI)
FCEU_VSUniPower(); FCEU_VSUniPower();
timestampbase=0; timestampbase=0;
X6502_Power(); X6502_Power();
FCEU_PowerCheats(); FCEU_PowerCheats();

View File

@ -112,6 +112,7 @@ inline const char* ESIFC_Name(ESIFC esifc)
typedef struct typedef struct
{ {
uint8 *name; //Game name, UTF8 encoding uint8 *name; //Game name, UTF8 encoding
int mappernum;
EGIT type; EGIT type;
EGIV vidsys; //Current emulated video system; EGIV vidsys; //Current emulated video system;

View File

@ -310,6 +310,24 @@ struct CHINF {
int32 mirror; int32 mirror;
}; };
void MapperInit()
{
if(NewiNES_Init(MapperNo))
{
}
else
{
iNESCart.Power=iNESPower;
if(head.ROM_type&2)
{
iNESCart.SaveGame[0]=WRAM;
iNESCart.SaveGameLen[0]=8192;
}
}
}
static void CheckHInfo(void) static void CheckHInfo(void)
{ {
/* ROM images that have the battery-backed bit set in the header that really /* ROM images that have the battery-backed bit set in the header that really
@ -684,19 +702,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
// return(0); // return(0);
// } // }
if(NewiNES_Init(MapperNo))
{
} GameInfo->mappernum = MapperNo;
else MapperInit();
{
iNESCart.Power=iNESPower;
if(head.ROM_type&2)
{
iNESCart.SaveGame[0]=WRAM;
iNESCart.SaveGameLen[0]=8192;
}
}
FCEU_LoadGameSave(&iNESCart); FCEU_LoadGameSave(&iNESCart);
strcpy(LoadedRomFName,name); //bbit edited: line added strcpy(LoadedRomFName,name); //bbit edited: line added

View File

@ -611,7 +611,10 @@ static void poweron(bool shouldDisableBatteryLoading)
//"hack for movie WRAM clearing on record from poweron" //"hack for movie WRAM clearing on record from poweron"
//but W-T-F. are you telling me that there is some problem with the poweron sequence? //but W-T-F. are you telling me that there is some problem with the poweron sequence?
//screw that. we're using the main poweron sequence, even if that breaks old movie compatibility (unlikely) //screw that. we're using the main poweron sequence, even if that breaks old movie compatibility (unlikely)
extern int disableBatteryLoading;
if(shouldDisableBatteryLoading) disableBatteryLoading=1;
PowerNES(); PowerNES();
if(shouldDisableBatteryLoading) disableBatteryLoading=0;
} }