- 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
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
CAPTION "TAS Editor"
MENU TASEDITMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,273,296
PUSHBUTTON "Hacky truncate after current frame",IDC_HACKY1,312,7,124,38
LTEXT "I think this will prove useful enough for a hotkey at some point",IDC_STATIC,312,46,125,16
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,347,7,124,38
LTEXT "I think this will prove useful enough for a hotkey at some point",IDC_STATIC,347,46,125,16
END
ASSEMBLER DIALOGEX 0, 0, 202, 135
@ -1444,9 +1444,9 @@ BEGIN
"TASEDIT", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 463
RIGHTMARGIN, 506
TOPMARGIN, 7
BOTTOMMARGIN, 342
BOTTOMMARGIN, 349
END
"ASSEMBLER", DIALOG

View File

@ -54,9 +54,19 @@ static void GetDispInfo(NMLVDISPINFO* nmlvDispInfo)
case 6:
case 7:
case 8:
case 9: {
int bit = (item.iSubItem - 2);
uint8 data = currMovieData.records[item.iItem].joysticks[0];
case 9:
case 10:
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))
{
item.pszText[0] = MovieRecord::mnemonics[bit];
@ -88,8 +98,13 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
return CDRF_NOTIFYSUBITEMDRAW;
case CDDS_SUBITEMPREPAINT:
SelectObject(msg->nmcd.hdc,debugSystem->hFixedFont);
if((msg->iSubItem-2)/8==0)
if((int)msg->nmcd.dwItemSpec < currMovieData.greenZoneCount)
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;
default:
return CDRF_DODEFAULT;
@ -211,8 +226,9 @@ void DoubleClick(LPNMITEMACTIVATE info)
else //if an input column was clicked:
{
//toggle the bit
int bit = (info->iSubItem-2);
currMovieData.records[index].toggleBit(0,bit);
int joy = (info->iSubItem - 2)/8;
int bit = (info->iSubItem - 2)%8;
currMovieData.records[index].toggleBit(joy,bit);
//update the row
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.
static void InsertFrames()
{
@ -241,7 +274,6 @@ static void InsertFrames()
}
InvalidateGreenZone(*selectionFrames.begin());
UpdateTasEdit();
RedrawList();
}
@ -249,6 +281,13 @@ static void InsertFrames()
//delete frames at the currently selected positions.
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.
//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
//why not the current green zone max?
currFrameCounter = currMovieData.greenZoneCount-1;
ClearSelection();
UpdateTasEdit();
RedrawList();
}
@ -404,6 +443,22 @@ static void InitDialog()
ListView_InsertColumn(hwndList, colidx++, &lvc);
lvc.pszText = "R";
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

View File

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

View File

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

View File

@ -1,23 +1,23 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*
* Copyright notice for this file:
* Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
@ -79,7 +79,7 @@ void (*MapperReset)(void);
static int MapperNo=0;
/* MapperReset() is called when the NES is reset(with the reset button).
Mapperxxx_init is called when the NES has been powered on.
Mapperxxx_init is called when the NES has been powered on.
*/
@ -282,7 +282,7 @@ struct BADINF {
static struct BADINF BadROMImages[]=
{
#include "ines-bad.h"
#include "ines-bad.h"
};
void CheckBad(uint64 md5partial)
@ -310,6 +310,24 @@ struct CHINF {
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)
{
/* ROM images that have the battery-backed bit set in the header that really
@ -372,7 +390,7 @@ static void CheckHInfo(void)
static struct CHINF moo[]=
{
#include "ines-correct.h"
#include "ines-correct.h"
};
int tofix=0;
int x;
@ -526,18 +544,18 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
memset((char *)(&head)+0xA,0,0x6);
}
// int ROM_size=0;
// int ROM_size=0;
if(!head.ROM_size)
{
// FCEU_PrintError("No PRG ROM!");
// return(0);
// FCEU_PrintError("No PRG ROM!");
// return(0);
ROM_size=256;
//head.ROM_size++;
}
else
ROM_size=head.ROM_size;
// ROM_size = head.ROM_size;
// ROM_size = head.ROM_size;
VROM_size = head.VROM_size;
ROM_size=uppow2(ROM_size);
@ -684,19 +702,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
// return(0);
// }
if(NewiNES_Init(MapperNo))
{
}
else
{
iNESCart.Power=iNESPower;
if(head.ROM_type&2)
{
iNESCart.SaveGame[0]=WRAM;
iNESCart.SaveGameLen[0]=8192;
}
}
GameInfo->mappernum = MapperNo;
MapperInit();
FCEU_LoadGameSave(&iNESCart);
strcpy(LoadedRomFName,name); //bbit edited: line added
@ -1164,14 +1172,14 @@ void iNESStateRestore(int version)
for(x=0;x<8;x++)
setchr1(0x400*x,CHRBankList[x]);
if(0) switch(Mirroring)
if(0) switch(Mirroring)
{
case 0:setmirror(MI_H);break;
case 1:setmirror(MI_V);break;
case 0x12:
case 0x10:setmirror(MI_0);break;
case 0x13:
case 0x11:setmirror(MI_1);break;
case 0:setmirror(MI_H);break;
case 1:setmirror(MI_V);break;
case 0x12:
case 0x10:setmirror(MI_0);break;
case 0x13:
case 0x11:setmirror(MI_1);break;
}
if(MapStateRestore) MapStateRestore(version);
}
@ -1191,11 +1199,11 @@ static void iNESPower(void)
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
FCEU_CheatAddRAM(8,0x6000,WRAM);
/*
/*
#ifdef DEBUG_MAPPER
if(type==0) SetWriteHandler(0x4020,0xFFFF,WriteHandler);
#endif
*/
*/
/* This statement represents atrocious code. I need to rewrite
all of the iNES mapper code... */
IRQCount=IRQLatch=IRQa=0;
@ -1251,66 +1259,66 @@ typedef struct {
} BMAPPING;
/*
static BMAPPING bmap[] = {
{1, Mapper1_Init},
{2, UNROM_Init},
{3, CNROM_Init},
{4, Mapper4_Init},
{5, Mapper5_Init},
{12, Mapper12_Init},
{13, CPROM_Init},
{19, Mapper19_Init},
{44, Mapper44_Init},
{45, Mapper45_Init},
{47, Mapper47_Init},
{49, Mapper49_Init},
{52, Mapper52_Init},
{74, Mapper74_Init},
{90, Mapper90_Init},
{95, Mapper95_Init},
{105, Mapper105_Init},
{112, Mapper112_Init},
{114, Mapper114_Init},
{115, Mapper115_Init},
{116, Mapper116_Init},
{118, Mapper118_Init},
{119, Mapper119_Init},
{133, SA72008_Init},
{137, S8259D_Init},
{138, S8259B_Init},
{139, S8259C_Init},
{141, S8259A_Init},
{143, TCA01_Init},
{145, SA72007_Init},
{146, SA0161M_Init},
{147, TCU01_Init},
{148, SA0037_Init},
{149, SA0036_Init},
{150, S74LS374N_Init},
{155, Mapper155_Init},
{160, Mapper90_Init},
{163, Mapper163_Init},
{164, Mapper164_Init},
{165, Mapper165_Init},
{182, Mapper182_Init},
{183, Mapper183_Init},
{186, Mapper186_Init},
{187, Mapper187_Init},
{188, Mapper188_Init},
{191, Mapper191_Init},
{205, Mapper205_Init},
{206, DEIROM_Init},
{208, Mapper208_Init},
{209, Mapper209_Init},
{210, Mapper210_Init},
{215, Mapper215_Init},
{216, Mapper216_Init},
{217, Mapper217_Init},
{243, S74LS374NA_Init},
{245, Mapper245_Init},
{249, Mapper249_Init},
{250, Mapper250_Init},
{254, Mapper254_Init},
{ 0, 0}
{1, Mapper1_Init},
{2, UNROM_Init},
{3, CNROM_Init},
{4, Mapper4_Init},
{5, Mapper5_Init},
{12, Mapper12_Init},
{13, CPROM_Init},
{19, Mapper19_Init},
{44, Mapper44_Init},
{45, Mapper45_Init},
{47, Mapper47_Init},
{49, Mapper49_Init},
{52, Mapper52_Init},
{74, Mapper74_Init},
{90, Mapper90_Init},
{95, Mapper95_Init},
{105, Mapper105_Init},
{112, Mapper112_Init},
{114, Mapper114_Init},
{115, Mapper115_Init},
{116, Mapper116_Init},
{118, Mapper118_Init},
{119, Mapper119_Init},
{133, SA72008_Init},
{137, S8259D_Init},
{138, S8259B_Init},
{139, S8259C_Init},
{141, S8259A_Init},
{143, TCA01_Init},
{145, SA72007_Init},
{146, SA0161M_Init},
{147, TCU01_Init},
{148, SA0037_Init},
{149, SA0036_Init},
{150, S74LS374N_Init},
{155, Mapper155_Init},
{160, Mapper90_Init},
{163, Mapper163_Init},
{164, Mapper164_Init},
{165, Mapper165_Init},
{182, Mapper182_Init},
{183, Mapper183_Init},
{186, Mapper186_Init},
{187, Mapper187_Init},
{188, Mapper188_Init},
{191, Mapper191_Init},
{205, Mapper205_Init},
{206, DEIROM_Init},
{208, Mapper208_Init},
{209, Mapper209_Init},
{210, Mapper210_Init},
{215, Mapper215_Init},
{216, Mapper216_Init},
{217, Mapper217_Init},
{243, S74LS374NA_Init},
{245, Mapper245_Init},
{249, Mapper249_Init},
{250, Mapper250_Init},
{254, Mapper254_Init},
{ 0, 0}
};
*/
static BMAPPING bmap[] = {

View File

@ -611,7 +611,10 @@ static void poweron(bool shouldDisableBatteryLoading)
//"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?
//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();
if(shouldDisableBatteryLoading) disableBatteryLoading=0;
}