//SetWindow bool Menu::SetWindow () { Err fErr (m_Err, L"SetWindow"); int nDepth, nFrameLimit, nAntialiasing; if (!m_pConfig->GetNum (s_sColorDepth, &nDepth) || !m_pConfig->GetNum (s_sFramelimit, &nFrameLimit) || !m_pConfig->GetNum (s_sAntialiasing, &nAntialiasing)) { return false; } unsigned int nWidth, nHeight; wstring sResolution; if (!m_pConfig->Get (s_sResolution, &sResolution)) { return false; } size_t nDeliPos = sResolution.find (s_sResDelim); if (nDeliPos == wstring::npos || !StrToNum (sResolution.substr (0, nDeliPos), &nWidth) || !StrToNum (sResolution.substr (nDeliPos + s_sResDelim.size ()), &nHeight)) { return fErr.Set (s_sErrResolution); } bool bFullscreen; if (!m_pConfig->GetBool (sCONF_FULLSCREEN, &bFullscreen)) { return false; } unsigned long nWindowStyle = sf::Style::Resize | sf::Style::Close; if (bFullscreen) { nWindowStyle = nWindowStyle | sf::Style::Fullscreen; } m_pWindow->Create (sf::VideoMode (nWidth, nHeight, nDepth), "MPong Developer Version", nWindowStyle, sf::WindowSettings (24, 8, nAntialiasing)); Render::SetRes (Vector2f (nWidth, nHeight)); if (nFrameLimit != 0) { m_pWindow->SetFramerateLimit (nFrameLimit); } bool bVerticalSync; if (!m_pConfig->GetBool (s_sVerticalSync, &bVerticalSync)) { return false; } m_pWindow->UseVerticalSync (bVerticalSync); return true; }//SetWindow
UCHAR IsLegal(UCHAR time[]) { UINT daynum; if (StrToNum(_HOUR, time) >= 24) return 0; daynum = StrToNum(_DAY, time); switch (StrToNum(_MONTH, time)) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (daynum > 31) return 0; break; case 4: case 6: case 9: case 11: if (daynum > 30) return 0; break; case 2: if (IsLeapYear(StrToNum(_YEAR, time))) if (daynum > 29) return 0; if (daynum > 28) return 0; break; default: return 0; } return 1; }
void increase(UCHAR time[]) { UCHAR i; UINT quantity; bit Carry = 0; //若发生进位,则Carry为1,否则为0 for (i=0; i<7; i++) //i=0~6分别代表秒、分、时、星期、日、月、年 { quantity = StrToNum(i, time); if (quantity > 9999) { time[0] = 'E'; time[1] = 'r'; time[2] = 'r'; break; } quantity++; Carry = NumToStr(i, quantity, time); if (i == 3) //若是星期数增加了,则日也要增加 continue; if (Carry == 0) break; } }
DerelictType StrToDerelictType(char *str) { return StrToNum(derelicttypeinfo,str); }
DWORD_PTR ConvertStrToAddress(CString Address) { CStringArray chuncks; if ( SplitString( Address, "+", chuncks ) == 0 ) chuncks.Add( Address ); DWORD_PTR Final = 0; for ( UINT i=0; i < ( UINT )chuncks.GetCount( ); i++) { CString a = chuncks[i]; a.MakeLower(); a.Trim(); bool bPointer = false; bool bMod = false; if (a[0] == '*') { bPointer = true; a = a.Mid(1); } if (a[0] == '&') { bMod = true; a = a.Mid(1); } DWORD_PTR curadd = 0; if (bMod) { for (UINT i=0; i < MemMapModule.size( ); i++ ) { CString ModName = MemMapModule[i].Name; ModName.MakeLower(); if (StrStr( ModName, a ) != NULL) { curadd = MemMapModule[i].Start; bMod = true; break; } } } else { curadd = (__int64)StrToNum( a.GetBuffer( ), a.GetLength( ), 16 ); //printf( "Final [%p] %d\n", curadd, a.GetLength( ) ); } Final += curadd; if ( bPointer ) { //printf( "here2\n" ); if ( !ReadProcessMemory( hProcess, ( PVOID )Final, &Final, sizeof( Final ), NULL ) ) { printf( "[!] Failed to read memory (stdafx.cpp) GetLastError( ) = %p\n", GetLastError( ) ); } } } return Final; }
ObjType StrToObjType(char *str) { return StrToNum(objtypeinfo, str); }
MissileType StrToMissileType(char *str) { return StrToNum(missiletypeinfo,str); }
SalvagePointType StrToSalvagePointType(char *str) { return StrToNum(salvagepointtypeinfo,str); }
GunSoundType StrToGunSoundType(char *str) { return StrToNum(gunsoundtypeinfo,str); }
ShipRace StrToShipRace(char *str) { return StrToNum(shipraceinfo,str); }
ShipClass StrToShipClass(char *str) { return StrToNum(shipclassinfo,str); }
ShipRace StrToNisRace(char *string) { return((ShipRace)StrToNum(nisraceinfo, string)); }
TacticsType StrToTacticsType(char *str) { return StrToNum(tacticsinfo,str); }
EffectType StrToExplosionType(char *str) { return StrToNum(explosiontypeinfo,str); }
SpecialEffectType StrToEffectNum(char *str) { return StrToNum(SpecialEffectinfo,str); }
GunType StrToGunType(char *str) { return StrToNum(guntypeinfo,str); }
ShipType StrToShipType(char *str) { return StrToNum(shiptypeinfo,str); }
DockPointType StrToDockPointType(char *str) { return StrToNum(dockpointtypeinfo,str); }
AsteroidType StrToAsteroidType(char *str) { return StrToNum(asteroidtypeinfo,str); }
BulletType StrToBulletType(char *str) { return StrToNum(bullettypeinfo,str); }
DustCloudType StrToDustCloudType(char *str) { return StrToNum(dustcloudtypeinfo, str); }
NAVLightType StrToNAVLightType(char *str) { return StrToNum(navlighttypeinfo, str); }
GasCloudType StrToGasCloudType(char *str) { return StrToNum(gascloudtypeinfo, str); }
int bluetooth_receiveInt() { if(!BTCommCheck(0)){return 0;} int out = StrToNum(BTReceiveMessage(0, 0, true)); return out; }
NebulaType StrToNebulaType(char *str) { return StrToNum(nebulatypeinfo, str); }
TechnologyType StrToTechType(char *tech) { return (StrToNum(techtypeinfo, tech)); }
static bit NumToStr(UCHAR kind, UINT quantity, UCHAR time[]) { switch (kind) { case _SECOND: if (quantity == 60) { time[14] = '0'; time[13] = '0'; return 1; } else { time[14] = ((UCHAR)(quantity%10) + '0'); time[13] = ((UCHAR)(quantity/10) + '0'); return 0; } case _MINUTE: if (quantity == 60) { time[12] = '0'; time[11] = '0'; return 1; } else { time[12] = ((UCHAR)(quantity%10) + '0'); time[11] = ((UCHAR)(quantity/10) + '0'); return 0; } case _HOUR: if (quantity == 24) { time[10] = '0'; time[9] = '0'; return 1; } else { time[10] = ((UCHAR)(quantity%10) + '0'); time[19] = ((UCHAR)(quantity/10) + '0'); return 0; } case _WEEK: if (quantity == 8) { time[8] = '1'; return 1; } else { time[8] = ((UCHAR)(quantity) + '0'); return 0; } case _DAY: switch (StrToNum(_MONTH, time)) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (quantity == 32) { time[7] = '0'; time[6] = '0'; return 1; } else { time[7] = ((UCHAR)(quantity%10) + '0'); time[6] = ((UCHAR)(quantity/10) + '0'); return 0; } case 4: case 6: case 9: case 11: if (quantity == 31) { time[7] = '0'; time[6] = '0'; return 1; } else { time[7] = ((UCHAR)(quantity%10) + '0'); time[6] = ((UCHAR)(quantity/10) + '0'); return 0; } case 2: //2月 if (IsLeapYear(StrToNum(_YEAR, time))) if (quantity == 30) { time[7] = '0'; time[6] = '0'; return 1; } else { time[7] = ((UCHAR)(quantity%10) + '0'); time[6] = ((UCHAR)(quantity/10) + '0'); return 0; } else if (quantity == 29) { time[7] = '0'; time[6] = '0'; return 1; } else { time[7] = ((UCHAR)(quantity%10) + '0'); time[6] = ((UCHAR)(quantity/10) + '0'); return 0; } default: time[0] = 'E'; time[1] = 'r'; time[2] = 'r'; break; } case _MONTH: if (quantity == 13) { time[5] = '1'; time[4] = '0'; return 1; } else { time[5] = ((UCHAR)(quantity%10) + '0'); time[4] = ((UCHAR)(quantity/10) + '0'); return 0; } case _YEAR: if (quantity == 10000) { time[0] = '0'; time[1] = '0'; time[2] = '0'; time[3] = '0'; return 1; } else { time[0] = ((UCHAR)(quantity/1000) + '0'); time[1] = ((UCHAR)((quantity/100)%10) + '0'); time[2] = ((UCHAR)((quantity/10)%10) + '0'); time[3] = ((UCHAR)(quantity%10) + '0'); return 0; } default: time[0] = 'E'; time[1] = 'r'; time[2] = 'r'; return 0; } }