// returns the number of free clusters in 'count' } BYTE Cmd100::ExecGetFree(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: ExecGetFree(%1)").arg(x,2,16,QChar('0'))); index++; count = fdd.GetFreeDiskSpace(); return opstatus; }
void Cprinter::raise() { paperWidget->updated = true; AddLog(LOG_TEMP,"RAISE"); CPObject::raise(); }
bool Cpc2021::run(void) { Get_Connector(); #if 1 // Try to introduce a latency quint64 deltastate = 0; if (run_oldstate == -1) run_oldstate = pTIMER->state; deltastate = pTIMER->state - run_oldstate; if (deltastate < PC2021LATENCY ) return true; run_oldstate = pTIMER->state; #endif quint8 c = pCONNECTOR->Get_values(); if (c>0) { AddLog(LOG_PRINTER,QString("Recieve:%1 = (%2)").arg(c,2,16,QChar('0')).arg(QChar(c))); SET_PIN(9,1); Printer(c); } pCONNECTOR_value = pCONNECTOR->Get_values(); Set_Connector(); return true; }
BYTE Cmd100::ReturnCountLo(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: ReturnCountLo(%1)").arg(x,2,16,QChar('0'))); Q_UNUSED(x); index++; bufindex = 0; return (count&0xff); }
bool UserCmd_DropTag(uint iClientID, const wstring &wscCmd, const wstring &wscParam, const wchar_t *usage) { if (set_bCharnameTags) { // Indicate an error if the command does not appear to be formatted correctly // and stop processing but tell FLHook that we processed the command. if (wscParam.size()==0) { PrintUserCmdText(iClientID, L"ERR Invalid parameters"); PrintUserCmdText(iClientID, usage); return true; } wstring wscCharname = (const wchar_t*)Players.GetActiveCharacterName(iClientID); wstring tag = GetParam(wscParam, ' ', 0); wstring pass = GetParam(wscParam, ' ', 1); // If this tag is in use then reject the request. for (std::map<wstring, TAG_DATA>::iterator i = mapTagToPassword.begin(); i != mapTagToPassword.end(); ++i) { if (tag == i->second.tag && pass == i->second.master_password) { mapTagToPassword.erase(tag); SaveSettings(); PrintUserCmdText(iClientID, L"OK Tag dropped"); AddLog("NOTICE: Tag %s dropped by %s (%s)", wstos(tag).c_str(), wstos(wscCharname).c_str(), wstos(HkGetAccountIDByClientID(iClientID)).c_str()); return true; } } PrintUserCmdText(iClientID, L"ERR tag or master password are invalid"); return true; } return false; }
BYTE Cmd100::ExecReadFile(BYTE x) { // + return the number of data bytes, LSB } AddLog(LOG_PRINTER,tr("MD-100 Function: ExecReadFile(%1)").arg(x,2,16,QChar('0'))); qint32 file_handle, position; index++; file_handle = buffer[1] & 0x0F; if (cmdcode == 0x21) { position = buffer[2] + (buffer[3] << 8); if (position == 0) position = 1; fdd.SeekAbsDiskFile(file_handle, position - 1); } count = fdd.ReadDiskFile (file_handle,(char*)&buffer[1]); // pointer to the data buffer fdd.SeekRelDiskFile (file_handle, 1); if (fdd.DosStatus == CcasioDOS::dsNoError) { if (fdd.IsEndOfDiskFile (file_handle)) { // for the last record skip the trailing zeros and the trailing Ctrl-Z while ((count > 0) && (buffer[count] == 0)) count--; if ((count > 0) && (buffer[count] == 0x1A)) count--; opstatus = mdEndOfFile; } } else opstatus = CnvStatus(fdd.DosStatus); count++; buffer[0] = opstatus; bufindex = 0; return (count & 0xff); }
HRESULT CDebug::AddText3D( int _no, D3DXVECTOR3 _pos, LPTSTR _str, bool _isUpdate) { HFONT hFontOld; hFontOld = (HFONT)SelectObject(m_hdc, m_hFont); if( _no >= LOG_COUNT || _no < 0 ) { //로그 최대 갯수안에 들어오지 않거나 0보다 작으면 반환; /*if( m_Text3dCount >= LOG_COUNT ) m_Text3dCount = 0; _no = m_Text3dCount ;*/ AddLog(-1, _T("3D문자열 추가 실패 : %s"), _str); return E_FAIL; } m_Text3dPos[_no] = _pos; if( _no >= m_Text3dCount || _isUpdate ) { if (D3DXCreateText( m_pDevice, m_hdc, _str, 0.5f, 0.4f, &m_Text3D[_no++], NULL, NULL) != D3D_OK) assert(false); m_Text3dCount = _no; } SelectObject(m_hdc, hFontOld); return S_OK; }
void LogCheater(uint client, const wstring &reason) { CAccount *acc = Players.FindAccountFromClientID(client); if (!HkIsValidClientID(client) || !acc) { AddLog("ERROR: invalid parameter in log cheater, clientid=%u acc=%08x reason=%s", client, acc, wstos(reason).c_str()); return; } //internal log string scText = wstos(reason); Logging("%s", scText.c_str()); // Set the kick timer to kick this player. We do this to break potential // stack corruption. HkDelayedKick(client, 1); // Ban the account. flstr *flStr = CreateWString(acc->wszAccID); Players.BanAccount(*flStr, true); FreeWString(flStr); // Overwrite the ban file so that it contains the ban reason wstring wscDir; HkGetAccountDirName(acc, wscDir); string scBanPath = scAcctPath + wstos(wscDir) + "\\banned"; FILE *file = fopen(scBanPath.c_str(), "wb"); if (file) { fprintf(file, "Autobanned by Marketfucker\n"); fclose(file); } }
BYTE Cmd100::AcceptCountLo(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: AcceptCountLo(%1)").arg(x,2,16,QChar('0'))); index++; count = x; bufindex = 0; return opstatus; }
BYTE Cmd100::SwitchCmd(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: SwitchCmd(%1)").arg(x,2,16,QChar('0'))); cmdcode = x; opstatus = mdNoData; // disk not inserted } index = 0; // 'cmdtab' entry point } if (isdisk) { opstatus = mdOK; switch (x) { case 0x00: case 0x01: case 0x02: index = 1; break; // read directory entry case 0x10: case 0x11: index = 43; break; // write to file case 0x20: case 0x21: index = 14; break; // read from file case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: index = 7; break; // open file case 0x40: index = 5; break; // close file } case 0x50: index = 25; break; // delete file } case 0x60: index = 32; break; // rename file } case 0x70: index = 39; break; // write sector } case 0x80: index = 21; break; // read sector } case 0x90: if (! fdd.FormatDisk()) opstatus = mdNoData; break; case 0xC0: index = 50; break; // get file size } case 0xD0: index = 55; break; // get number of free clusters default: opstatus = mdInvalidCommand; // unknown command } } } return opstatus; }
bool Ce500::Chk_Adr(DWORD *d,DWORD data) { #if (TEST_MEMORY_MAPPING) quint32 tmp = *d; MemMirror(d); if ( (tmp>=0x40000) && (tmp<=0xBFFFF) && (pCPU->fp_log)) fprintf(pCPU->fp_log,"\nRAM WRITE: [%06X] -> [%06X]=%02X\n",tmp,*d,data); #endif if ( (*d>=0x00000) && (*d<=0x3FFFF)) { // if((*d&0x3000)==0x1000){ // *d&=0x103f; pRP5C01->write(*d&31,data); // return((*d&0x10)==0); /* CLOCK (010xx) */ // } if((*d&0x6000)==0x2000){ *d&=0x200f; disp(*d&15,data);//lcdc.access=1; lcdc.lcdcadr=*d&15; return(1-(*d&1)); /* LCDC (0200x) */ } return 1; } #if (TEST_MEMORY_MAPPING) if ( (*d>=0x40000) && (*d<=0x4FFFF)) return (ext_MemSlot1->ExtArray[ID_CE210M]->IsChecked || ext_MemSlot1->ExtArray[ID_CE211M]->IsChecked || ext_MemSlot1->ExtArray[ID_CE212M]->IsChecked || ext_MemSlot1->ExtArray[ID_CE2H16M]->IsChecked || ext_MemSlot1->ExtArray[ID_CE2H32M]->IsChecked || ext_MemSlot1->ExtArray[ID_CE2H64M]->IsChecked); if ( (*d>=0x80000) && (*d<=0xB7FFF)) { AddLog(LOG_RAM,QString("adr;%1").arg(*d,6,16,QChar('0'))); } if ( (*d>=0xB8000) && (*d<=0xBFFFF)) return 1; #endif if ( (*d>=0x40000) && (*d<=0xBFFFF)) return 1; if ( (*d>=0xC0000) && (*d<=0xFFFFF)) return 0; // if(*d>0xbffff) return(0); /* ROM area(c0000-fffff) S3: */ // if(*d>0x7ffff) return(1); /* RAM area(80000-bffff) S1: */ // if(*d>0x3ffff) return(1); /* RAM area(40000-7ffff) S2: */ #if 0 if(*d>0x1ffff){ // if(sc.e6) return(0); /* ROM area(20000-3ffff) ->E650/U6000 */ // else{ // *d=BASE_128[GetBank()]+(*d&0x1ffff); // return(1-(sc.emsmode>>4)); /* RAM area(20000-3ffff) EMS */ // } } if(*d>0x0ffff){ *d=BASE_64[GetBank()]+(*d&0xffff); return(1-(sc.emsmode>>4)); /* RAM area(10000-1ffff) EMS */ }
void Cmd100::printerDataPort(BYTE value) { if (value != 0xff) { AddLog(LOG_PRINTER,tr("PRINTER data : %1").arg(value,2,16,QChar('0'))); if (mainwindow->dialoganalogic) mainwindow->dialoganalogic->setMarker(7); printerDATA = value; } }
// expects file handle in buffer[0], returns file size in 'count' } BYTE Cmd100::ExecGetSize(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: ExecGetSize(%1)").arg(x,2,16,QChar('0'))); count = fdd.SizeOfDiskFile (buffer[0]); if (count == 0) opstatus = mdFileNotOpened; else if ( (fdd.GetDiskFileTag(buffer[0]) & 0x01) != 0) count--; return opstatus; }
BYTE Cmd100::ReturnBlock(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: ReturnBlock(%1)").arg(x,2,16,QChar('0'))); Q_UNUSED(x); BYTE ret=buffer[bufindex]; if (bufindex < (BUFSIZE - 1)) bufindex++; count--; if (count <= 0) index++; return ret; }
bool KEYBMAPParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs ) { QString desc = ""; QString modifier=""; int scancode,masterscancode,delay,x,y,w,h; View view=FRONTview; bool ok = false; scancode=masterscancode=delay=x=y=w=h=0; if( inKeyboard && name == "KEY" ) { for( int i=0; i<attrs.count(); i++ ) { if( attrs.localName( i ) == "description" ) desc = attrs.value( i ); else if( attrs.localName( i ) == "scancode" ) scancode = attrs.value( i ).toInt(&ok,16); else if( attrs.localName( i ) == "left" ) x = attrs.value( i ).toInt(&ok,10); else if( attrs.localName( i ) == "top" ) y = attrs.value( i ).toInt(&ok,10); else if( attrs.localName( i ) == "width" ) w = attrs.value( i ).toInt(&ok,10); else if( attrs.localName( i ) == "height" ) h = attrs.value( i ).toInt(&ok,10); else if( attrs.localName( i ) == "masterscancode" ) masterscancode = attrs.value( i ).toInt(&ok,16); else if( attrs.localName( i ) == "delay" ) { delay = attrs.value( i ).toInt(&ok,10); qWarning()<<"delay="<<delay; } else if( attrs.localName( i ) == "modifier" ) modifier = attrs.value( i ); else if( attrs.localName( i ) == "view" ) { if (attrs.value( i ) == "FRONT") view = FRONTview; if (attrs.value( i ) == "TOP") view = TOPview; if (attrs.value( i ) == "LEFT") view = LEFTview; if (attrs.value( i ) == "RIGHT") view = RIGHTview; if (attrs.value( i ) == "BACK") view = BACKview; if (attrs.value( i ) == "BOTTOM") view = BOTTOMview; } } Parent->Keys.append(CKey(scancode,desc,QRect(x,y,w,h),masterscancode,modifier,view,delay)); AddLog(LOG_KEYBOARD,mainwindow->tr("XML Read key : %1, scan=0x%2 , Rect=(%3,%4,%5,%6), mscan=0x%7, mod=%8"). arg(desc). arg(scancode,2,16,QChar('0')). arg(x).arg(y).arg(w).arg(h). arg(masterscancode,2,16,QChar('0')). arg(modifier)); } else if( name == "Keyboard" ) inKeyboard = true; return true; }
bool Crlp9001::LoadSession_File(QXmlStreamReader *xmlIn) { if (xmlIn->name()=="session") { bool rot = xmlIn->attributes().value("rotate").toString().toInt(0,16); if (rotate != rot) Rotate(); if (xmlIn->readNextStartElement() && xmlIn->name() == "memory" ) { AddLog(LOG_MASTER,"Load Memory"); for (int s=0; s<SlotList.size(); s++) // Save Memory { if (SlotList[s].getType() == RAM) { AddLog(LOG_MASTER," Load Slot"+SlotList[s].getLabel()); Mem_Load(xmlIn,s); } } } } return true; }
void CHD61102::cmd_setX(qint16 cmd) { BYTE newXadr = cmd & 0x07; if (newXadr != info.Xadr) { info.Xadr = newXadr; updated = true; AddLog(LOG_DISPLAY,tr("UPDATED setX")); } }
BYTE Cmd100::ExecWriteFile(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: ExecWriteFile(%1)").arg(x,2,16,QChar('0'))); qint32 file_handle, position, i; if (bufindex < BUFSIZE) { buffer[bufindex] = x; bufindex++; } count--; if (count <= 0) { // last record index++; if (cmdcode == 0) { file_handle = buffer[1] & 0x0F; if (fdd.IsEndOfDiskFile (file_handle) && (bufindex < BUFSIZE - 1)) { buffer[bufindex] = 0x1A; bufindex++; } memset((char*)&buffer[bufindex],0x00,BUFSIZE - bufindex); i = 2; while (i < bufindex) { if (fdd.WriteDiskFile (file_handle, (char*)&buffer[i]) != SIZE_RECORD) break; i+= SIZE_RECORD; if (i <= bufindex) fdd.SeekRelDiskFile (file_handle, 1); } if (opstatus == mdOK) opstatus = CnvStatus (fdd.DosStatus); } buffer[0] = opstatus; count = 1; } else { // not the last record if ((cmdcode == 0) && (bufindex == SIZE_RECORD + 2)) { bufindex = 2; file_handle = buffer[1] & 0x0F; if (fdd.WriteDiskFile (file_handle,(char*)&buffer[2]) != SIZE_RECORD) { if (opstatus == mdOK) opstatus = CnvStatus (fdd.DosStatus); } fdd.SeekRelDiskFile (file_handle, 1); } else if ((cmdcode == 0x10) && (bufindex == 2)) { cmdcode = 0; } else if ((cmdcode == 0x11) && (bufindex == 4)) { cmdcode = 0; bufindex = 2; file_handle = buffer[1] & 0x0F; position = buffer[2] + (buffer[3] << 8); if (position == 0) position = 1; fdd.SeekAbsDiskFile (file_handle, position - 1); } } return mdOK; }
void Cmd100::FddOpen(void) { AddLog(LOG_PRINTER,tr("MD-100 Function: FddOpen")); index = 0; cmdcode = 0; opstatus = 0; count = 1; bufindex = 0; deindex = 0; isdisk = fdd.DosInit(); }
void CHD61102::cmd_on_off(qint16 cmd) { BYTE newon_off = cmd & 0x01; if (newon_off != info.on_off) { info.on_off = newon_off; updated = true; AddLog(LOG_DISPLAY,tr("UPDATED on_off")); } // if (pPC->fp_log) fprintf(pPC->fp_log,"LCD :%s\n",on_off?"on":"off"); }
void CHD61102::cmd_setY(qint16 cmd) { BYTE newYadr = cmd & 0x3f; if (newYadr != info.Yadr) { info.Yadr = newYadr; updated = true; AddLog(LOG_DISPLAY,tr("UPDATED setY")); } // if (pPC->fp_log) fprintf(pPC->fp_log,"LCD Y:%i\n",Yadr); }
// accept 'count' bytes and store them in the 'buffer' } BYTE Cmd100::AcceptBlock(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: AcceptBlock(%1)").arg(x,2,16,QChar('0'))); if (bufindex < BUFSIZE) { buffer[bufindex] = x; bufindex++; } count--; if (count <= 0) index++; return opstatus; }
BYTE Cmd100::AcceptCountHi(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: AcceptCountHi(%1)").arg(x,2,16,QChar('0'))); index++; count += (x << 8); if (count == 0) { opstatus = mdInvalidCommand; index = 0; } return opstatus; }
void SHVTestResult::AddLog(const SHVTChar* s, ...) { SHVString str; SHVVA_LIST args; SHVVA_START(args, s); str.FormatList(s,args); AddLog(str); SHVVA_END(args); }
SSMODULEDECLSPEC int SSMODULECALL SSModule_StartSaving(HWND hwndParent, char *pchHomeDirectory, int bPreviewMode) { // This is called when we should start the saving. // Return error if already running, start the saver thread otherwise! if (bRunning) return SSMODULE_ERROR_ALREADYRUNNING; readConfig(pchHomeDirectory); iSaverThreadState = STATE_UNKNOWN; bOnlyPreviewMode = bPreviewMode; tidSaverThread = _beginthread(fnSaverThread, 0, 1024*1024, (void *) hwndParent); if (tidSaverThread == 0) { #ifdef DEBUG_LOGGING AddLog("[SSModule_StartSaving] : Error creating screensaver thread!\n"); #endif // Error creating screensaver thread! return SSMODULE_ERROR_INTERNALERROR; } // Wait for saver thread to start up! while (iSaverThreadState==STATE_UNKNOWN) DosSleep(32); if (iSaverThreadState!=STATE_RUNNING) { #ifdef DEBUG_LOGGING AddLog("[SSModule_StartSaving] : Something went wrong in screensaver thread!\n"); #endif // Something wrong in saver thread! DosWaitThread(&tidSaverThread, DCWW_WAIT); return SSMODULE_ERROR_INTERNALERROR; } // Fine, screen saver started and running! bRunning = TRUE; return SSMODULE_NOERROR; }
// it is allowed to close unopened files, // actually the command always returns with opstatus = mdOK } BYTE Cmd100::ExecCloseFile(BYTE x) { AddLog(LOG_PRINTER,tr("MD-100 Function: ExecCloseFile(%1)").arg(x,2,16,QChar('0'))); index++; fdd.CloseDiskFile(x); if (fdd.DosStatus == CcasioDOS::dsFileNotOpened) opstatus = mdOK; else opstatus = CnvStatus(fdd.DosStatus); return opstatus; }
bool Ckeyb::CheckKon() { Kon = FALSE; if ( (LastKey == K_BRK) ) { Kon = TRUE; AddLog(2,"Kon TRUE"); LastKey = 0; } return (Kon); }
bool Ccemem::LoadSession_File(QXmlStreamReader *xmlIn) { if (xmlIn->name()=="session") { if (xmlIn->readNextStartElement() && xmlIn->name() == "memory" ) { AddLog(LOG_MASTER,"Load Memory"); for (int s=0; s<SlotList.size(); s++) // Save Memory { switch (SlotList[s].getType()) { case CSlot::RAM: case CSlot::CUSTOM_ROM: AddLog(LOG_MASTER," Load Slot"+SlotList[s].getLabel()); Mem_Load(xmlIn,s); break; default: break; } } } } return true; }
bool Crlp9001::init(void) { AddLog(LOG_MASTER,"RL-P9001 initializing..."); CPObject::init(); pMAINCONNECTOR = new Cconnector(this,44,0, Cconnector::Panasonic_44, "44 pins conector", true, QPoint(30,72), Cconnector::WEST); publish(pMAINCONNECTOR); Power = false; AddLog(LOG_MASTER,"done.\n"); return true; }
BYTE CHD61102::get8(qint16 adr) { if (adr >= 0x200) { // ERROR AddLog(LOG_TEMP,tr("LCD : ERROR adr [%1] out of range").arg(adr,4,16,QChar('0'))); if (pPC->fp_log) fprintf(pPC->fp_log,"LCD : ERROR adr [%04x] out of range [0,200h]\n",adr); return 0; } return info.imem[adr]; }