本文整理汇总了C++中CartInfo类的典型用法代码示例。如果您正苦于以下问题:C++ CartInfo类的具体用法?C++ CartInfo怎么用?C++ CartInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CartInfo类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: int
namespace MDFN_IEN_NES
{
struct UNIF_HEADER
{
char ID[4];
uint32 info;
};
struct BMAPPING
{
const char *name;
uint16 prg_rm;
int (*init)(CartInfo *);
int flags;
};
struct BFMAPPING
{
const char *name;
void (*init)(Stream *fp);
const uint32 info_ms;
};
static CartInfo UNIFCart;
static int vramo;
static int mirrortodo;
static uint8 *boardname = NULL;
static uint8 *sboardname = NULL;
static uint32 CHRRAMSize;
uint8 *UNIFchrrama = NULL;
static uint8 *exntar = NULL;
static UNIF_HEADER unhead;
static UNIF_HEADER uchead;
static uint8 *malloced[32] = { NULL };
static uint32 mallocedsizes[32] = { 0 };
static uint32 FixRomSize(uint32 size, uint32 minimum)
{
uint32 x = 1;
if(size < minimum)
return minimum;
while(x < size)
x <<= 1;
return x;
}
static void UNIF_StateAction(StateMem *sm, const unsigned load, const bool data_only)
{
SFORMAT StateRegs[] =
{
SFARRAY(exntar, 2048),
SFARRAY(UNIFchrrama, CHRRAMSize),
SFEND
};
if(NESIsVSUni)
{
MDFNNES_VSUNIStateAction(sm,load, data_only);
}
if(exntar || UNIFchrrama)
{
MDFNSS_StateAction(sm, load, data_only, StateRegs, "UNIF");
}
if(UNIFCart.StateAction)
UNIFCart.StateAction(sm, load, data_only);
}
static void FreeUNIF(void)
{
if(UNIFchrrama)
{
MDFN_free(UNIFchrrama);
UNIFchrrama = NULL;
}
if(exntar)
{
MDFN_free(exntar);
exntar = NULL;
}
if(boardname)
{
MDFN_free(boardname);
boardname = NULL;
}
for(int x = 0; x < 32; x++)
{
if(malloced[x])
//.........这里部分代码省略.........
示例2: UNIFGI
static void UNIFGI(GI h)
{
switch(h)
{
case GI_RESETSAVE:
FCEU_ClearGameSave(&UNIFCart);
break;
case GI_RESETM2:
if(UNIFCart.Reset)
UNIFCart.Reset();
break;
case GI_POWER:
if(UNIFCart.Power)
UNIFCart.Power();
if(UNIFchrrama) memset(UNIFchrrama,0,8192);
break;
case GI_CLOSE:
FCEU_SaveGameSave(&UNIFCart);
if(UNIFCart.Close)
UNIFCart.Close();
FreeUNIF();
break;
}
}
示例3: UNIFGI
static void UNIFGI(int h, void *param)
{
switch(h)
{
case GI_RESETM2:
if(UNIFCart.Reset)
UNIFCart.Reset();
break;
case GI_POWER:
if(UNIFCart.Power)
UNIFCart.Power();
if(UNIFchrrama) memset(UNIFchrrama,0,8192);
break;
case GI_CLOSE:
FCEU_SaveGameSave(&UNIFCart);
if(UNIFCart.Close)
UNIFCart.Close();
FreeUNIF();
ResetExState(0,0);
break;
case GI_INFOSTRING:
{
char board[24];
strncpy(board, sboardname, 20);
board[20] = 0;
sprintf(param, "UNIF, %s, %s%s", board, PAL?"PAL":"NTSC", UNIFCart.battery?", BB":"");
}
break;
}
}
示例4: UNIF_StateAction
static void UNIF_StateAction(StateMem *sm, const unsigned load, const bool data_only)
{
SFORMAT StateRegs[] =
{
SFARRAY(exntar, 2048),
SFARRAY(UNIFchrrama, CHRRAMSize),
SFEND
};
if(NESIsVSUni)
{
MDFNNES_VSUNIStateAction(sm,load, data_only);
}
if(exntar || UNIFchrrama)
{
MDFNSS_StateAction(sm, load, data_only, StateRegs, "UNIF");
}
if(UNIFCart.StateAction)
UNIFCart.StateAction(sm, load, data_only);
}
示例5: UNIFLoad
void UNIFLoad(Stream *fp, NESGameType *gt)
{
try
{
uint8 magic[4];
if(fp->read(magic, 4, false) != 4 || memcmp(magic, "UNIF", 4))
throw MDFN_Error(0, _("Not a valid UNIF file."));
ResetCartMapping();
ResetUNIF();
memset(WantInput, 0, sizeof(WantInput));
unhead.info = fp->get_LE<uint32>();
fp->seek(0x20, SEEK_SET);
LoadUNIFChunks(fp);
{
md5_context md5;
md5.starts();
for(int x = 0; x < 32; x++)
{
if(malloced[x])
{
md5.update(malloced[x],mallocedsizes[x]);
}
}
md5.finish(UNIFCart.MD5);
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(UNIFCart.MD5, 0).c_str());
memcpy(MDFNGameInfo->MD5,UNIFCart.MD5,sizeof(UNIFCart.MD5));
MDFN_printf("\n");
}
InitializeBoard();
MDFN_LoadGameSave(&UNIFCart);
gt->Power = UNIF_Power;
gt->Reset = UNIF_Reset;
gt->SaveNV = UNIF_SaveNV;
gt->Kill = UNIF_Kill;
gt->StateAction = UNIF_StateAction;
if(UNIFCart.CartExpSound.HiFill)
GameExpSound.push_back(UNIFCart.CartExpSound);
MDFNGameInfo->DesiredInput.push_back(WantInput[0]);
MDFNGameInfo->DesiredInput.push_back(WantInput[1]);
MDFNGameInfo->DesiredInput.push_back("gamepad");
MDFNGameInfo->DesiredInput.push_back("gamepad");
MDFNGameInfo->DesiredInput.push_back(WantInput[2]);
}
catch(...)
{
if(UNIFCart.Close)
UNIFCart.Close();
FreeUNIF();
ResetUNIF();
throw;
}
}
示例6: UNIF_Kill
static void UNIF_Kill(void)
{
if(UNIFCart.Close)
UNIFCart.Close();
FreeUNIF();
}
示例7: UNIF_Power
static void UNIF_Power(void)
{
if(UNIFCart.Power)
UNIFCart.Power(&UNIFCart);
if(UNIFchrrama) memset(UNIFchrrama, 0xFF, CHRRAMSize);
}
示例8: UNIF_Reset
static void UNIF_Reset(void)
{
if(UNIFCart.Reset)
UNIFCart.Reset(&UNIFCart);
}