From 77e2c1aa5697858ddaabc24b5337ea1738be848a Mon Sep 17 00:00:00 2001 From: dgrfactory Date: Wed, 5 Feb 2025 01:06:33 +0900 Subject: [PATCH] refs ignore SPCCMD.EXE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FreePascal 3.2.2 対応 --- spccmd.exe/spccmd.dpr | 99 +++++++++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 27 deletions(-) diff --git a/spccmd.exe/spccmd.dpr b/spccmd.exe/spccmd.dpr index 1a2cfa1..595a547 100644 --- a/spccmd.exe/spccmd.dpr +++ b/spccmd.exe/spccmd.dpr @@ -53,31 +53,20 @@ program spccmd; {$ASSERTIONS OFF} // ƒ\[ƒXƒR[ƒh‚̃AƒT[ƒg : –³Œø {$BOOLEVAL OFF} // Š®‘S˜_—Ž®•]‰¿ : –³Œø {$DEBUGINFO OFF} // ƒfƒoƒbƒOî•ñ : –³Œø -{$DEFINITIONINFO OFF} // ƒVƒ“ƒ{ƒ‹éŒ¾‚ÆŽQÆî•ñ : –³Œø {$DENYPACKAGEUNIT ON} // UNIT •sŽg—p : —LŒø -{$DESIGNONLY OFF} // IDE Žg—p : –³Œø {$EXTENDEDSYNTAX ON} // ŠÖ”‚Ì–ß‚è’l‚𖳎‹‰Â”\ : —LŒø -{$EXTENSION exe} // Šg’£ŽqÝ’è : EXE -{$HINTS ON} // ƒqƒ“ƒg¶¬ : —LŒø +{$EXTENSION 'exe'} // Šg’£ŽqÝ’è : EXE {$IMAGEBASE $00400000} // ƒCƒ[ƒWƒx[ƒXƒAƒhƒŒƒX : 0x00400000 -{$IMPLICITBUILD ON} // ƒrƒ‹ƒh‚Ì‚½‚Ñ‚ÉăRƒ“ƒpƒCƒ‹ : —LŒø {$IMPORTEDDATA OFF} // •ÊƒpƒbƒP[ƒW‚̃ƒ‚ƒŠŽQÆ : –³Œø {$IOCHECKS OFF} // I/O ƒ`ƒFƒbƒN : –³Œø -{$LOCALSYMBOLS OFF} // ƒ[ƒJƒ‹ƒVƒ“ƒ{ƒ‹î•ñ : –³Œø {$LONGSTRINGS ON} // AnsiString Žg—p : —LŒø {$MAXSTACKSIZE $00100000} // Å‘åƒXƒ^ƒbƒNÝ’è : 0x00100000 {$MINENUMSIZE 1} // —ñ‹“Œ^‚ÌÅ‘åƒTƒCƒY (x256) : 1 (256) {$MINSTACKSIZE $00004000} // ŬƒXƒ^ƒbƒNÝ’è : 0x00004000 -{$OBJEXPORTALL OFF} // ƒVƒ“ƒ{ƒ‹‚̃GƒNƒXƒ|[ƒg : –³Œø {$OPENSTRINGS OFF} // ƒI[ƒvƒ“•¶Žš—ñƒpƒ‰ƒ[ƒ^ : –³Œø -{$OPTIMIZATION ON} // Å“K‰»ƒRƒ“ƒpƒCƒ‹ : —LŒø {$OVERFLOWCHECKS OFF} // ƒI[ƒo[ƒtƒ[ƒ`ƒFƒbƒN : –³Œø {$RANGECHECKS OFF} // ”͈̓`ƒFƒbƒN : –³Œø -{$REALCOMPATIBILITY OFF} // Real48 ŒÝŠ· : –³Œø -{$REFERENCEINFO OFF} // Š®‘S‚ÈŽQÆî•ñ‚̶¬ : –³Œø {$R 'spccmd.res' 'spccmd.rc'} // ƒŠƒ\[ƒX : spccmd.res <- spccmd.rc -{$RUNONLY OFF} // ŽÀsŽž‚̂݃Rƒ“ƒpƒCƒ‹ : –³Œø -{$SAFEDIVIDE OFF} // ‰Šú Pentium FDIV ƒoƒO‰ñ”ð : –³Œø {$STACKFRAMES OFF} // Š®‘SƒXƒ^ƒbƒNƒtƒŒ[ƒ€¶¬ : –³Œø {$TYPEDADDRESS OFF} // ƒ|ƒCƒ“ƒ^‚ÌŒ^ƒ`ƒFƒbƒN : –³Œø {$TYPEINFO OFF} // ŽÀsŽžŒ^î•ñ : –³Œø @@ -86,6 +75,31 @@ program spccmd; {$WEAKPACKAGEUNIT OFF} // Žã‚¢ƒpƒbƒP[ƒW‰» : –³Œø {$WRITEABLECONST OFF} // ’蔑‚«Š·‚¦ : –³Œø +{$IFDEF FREEPASCAL} // for Free Pascal 3.2+ +{$CALLING STDCALL} // CALL ƒXƒ^ƒbƒN•ûŽ® : STDCALL +{$CHECKPOINTER OFF} // ƒ|ƒCƒ“ƒ^ƒ`ƒFƒbƒN : –³Œø +// {$CODEPAGE CP932} // •¶ŽšƒR[ƒh : CP932 +{$FPUTYPE x87} // •‚“®¬”‰‰ŽZ–½—ß : x87 +{$HINTS OFF} // ƒqƒ“ƒg¶¬ : –³Œø +{$IEEEERRORS OFF} // •‚“®¬”ƒGƒ‰[ƒ`ƒFƒbƒN : –³Œø +{$MODE DELPHI} // Œ¾Œêƒ‚[ƒh : DELPHI +{$OPTIMIZATION LEVEL3,USEEBP} // Å“K‰»ƒRƒ“ƒpƒCƒ‹ : Lv3, EBP ƒŒƒWƒXƒ^Žg—p +{$POINTERMATH ON} // ƒ|ƒCƒ“ƒ^‰‰ŽZ : —LŒø +{$SAFEFPUEXCEPTIONS OFF} // FPU ƒGƒ‰[‘¦Žž•ñ : –³Œø +{$ELSE} // for Boland Delphi 6+ +{$DEFINITIONINFO OFF} // ƒVƒ“ƒ{ƒ‹éŒ¾‚ÆŽQÆî•ñ : –³Œø +{$DESIGNONLY OFF} // IDE Žg—p : –³Œø +{$HINTS ON} // ƒqƒ“ƒg¶¬ : —LŒø +{$IMPLICITBUILD ON} // ƒrƒ‹ƒh‚Ì‚½‚Ñ‚ÉăRƒ“ƒpƒCƒ‹ : —LŒø +{$LOCALSYMBOLS OFF} // ƒ[ƒJƒ‹ƒVƒ“ƒ{ƒ‹î•ñ : –³Œø +{$OBJEXPORTALL OFF} // ƒVƒ“ƒ{ƒ‹‚̃GƒNƒXƒ|[ƒg : –³Œø +{$OPTIMIZATION ON} // Å“K‰»ƒRƒ“ƒpƒCƒ‹ : —LŒø +{$REALCOMPATIBILITY OFF} // Real48 ŒÝŠ· : –³Œø +{$REFERENCEINFO OFF} // Š®‘S‚ÈŽQÆî•ñ‚̶¬ : –³Œø +{$RUNONLY OFF} // ŽÀsŽž‚̂݃Rƒ“ƒpƒCƒ‹ : –³Œø +{$SAFEDIVIDE OFF} // ‰Šú Pentium FDIV ƒoƒO‰ñ”ð : –³Œø +{$ENDIF} + // ************************************************************************************************************************************************************* // ŠO•”ƒNƒ‰ƒX‚Ì錾 @@ -158,7 +172,7 @@ const BUFFER_LENGTH = 13; BUFFER_START = BUFFER_LENGTH + 1; BUFFER_LANGUAGE: string = 'LANGUAGE 1 : '; - LIST_FILE: string = 'spcplay.stk'; + // LIST_FILE: string = 'spcplay.stk'; LIST_FILE_HEADER_A: string = 'SSDLabo Spcplay ListFile v1.0'; LIST_FILE_HEADER_A_LEN = 29; LIST_FILE_HEADER_B: string = 'SPCPLAY PLAYLIST'; @@ -602,6 +616,19 @@ begin for I := 1 to J do if IsPathSeparator(S, I) then result := I; end; +// ================================================================================ +// ChrToStr - ƒLƒƒƒ‰ƒNƒ^‚Ì“®“I”z—ñ‚𕶎š—ñ‚É•ÏŠ· +// ================================================================================ +function ChrToStr(var C: array of char): string; overload; +var + S: string; +begin + // NOTE: Free Pascal ‚Ìê‡Achar Œ^‚Ì“®“I”z—ñ‚ð string ‚ɃLƒƒƒXƒg‚·‚邽‚ß‚É‚ÍA + // SetString ‚ðŽg—p‚µ‚È‚¢‚ÆA•¶Žš—ñ‚ª³‚µ‚­Œ‹‡‚³‚ê‚È‚¢‚È‚Ç‚Ì•s‹ï‡‚ª”­¶‚·‚é + SetString(S, pchar(@C[0]), GetSize(@C[0], SizeOf(C))); + result := S; +end; + // ================================================================================ // StrToInt - •¶Žš—ñ‚ð”’l‚É•ÏŠ· // ================================================================================ @@ -1253,13 +1280,13 @@ begin // bootcode ‚ðƒRƒs[ write(output, 'Boot Code ‚̃AƒhƒŒƒX = '); IntToHex(StrData, bootptr, 4); - write(output, Copy(String(StrData.cData), 1, 4)); + write(output, Copy(ChrToStr(StrData.cData), 1, 4)); write(output, '`'); IntToHex(StrData, bootptr + count - 1, 4); - write(output, Copy(String(StrData.cData), 1, 4)); + write(output, Copy(ChrToStr(StrData.cData), 1, 4)); write(output, ' (STEP '); IntToHex(StrData, step, 1); - write(output, Copy(String(StrData.cData), 1, 1)); + write(output, Copy(ChrToStr(StrData.cData), 1, 1)); writeln(output, ')'); if step >= 3 then writeln(output, '¦ŽÀ‹@‚Å‚Í–`“ª‚ŃmƒCƒY‚ª”­¶‚·‚éꇂª‚ ‚è‚Ü‚·B'); for X := 0 to count - 1 do SPCBuffer.Ram[(bootptr + X) and $FFFF] := bootcode[X]; @@ -1391,7 +1418,7 @@ begin ApuWrite(3, SPCBuffer.Ram[$F7]); // I—¹ writeln(output, STR_DONE[dwLanguage]); - writeln(output, Concat('TIME = ', IntToStr(API_timeGetTime() - ms), ' [ms]')); + writeln(output, Concat('TIME = ', IntToStr(longword(API_timeGetTime() - ms)), ' [ms]')); finally if not longbool(result) then API_SendMessage(hWnd, WM_COMMAND, MENU_FILE_PLAY, NULL); // play if longbool(hWnd) then API_SendMessage(hWnd, WM_APP_MESSAGE, WM_APP_EMU_DEBUG, NULL); @@ -1515,7 +1542,7 @@ begin // Script700 ‚ðŽg—p‚µ‚Ä‚¢‚È‚¢ê‡‚ÍI—¹ if hScript700File = INVALID_HANDLE_VALUE then begin writeln(output, STR_DONE[dwLanguage]); - writeln(output, Concat('TIME = ', IntToStr(API_timeGetTime() - ms), ' [ms]')); + writeln(output, Concat('TIME = ', IntToStr(longword(API_timeGetTime() - ms)), ' [ms]')); exit; end; // ƒXƒŠ[ƒv @@ -1525,7 +1552,7 @@ begin dwHigh := StopTransmitSPC(); writeln(output, Concat('StopTransmitSPC = ', IntToStr(dwHigh))); writeln(output, STR_DONE[dwLanguage]); - writeln(output, Concat('TIME = ', IntToStr(API_timeGetTime() - ms), ' [ms]')); + writeln(output, Concat('TIME = ', IntToStr(longword(API_timeGetTime() - ms)), ' [ms]')); finally if not longbool(result) then API_SendMessage(hWnd, WM_COMMAND, MENU_FILE_PLAY, NULL); // play if longbool(hWnd) then API_SendMessage(hWnd, WM_APP_MESSAGE, WM_APP_EMU_DEBUG, NULL); @@ -1577,14 +1604,14 @@ begin end else if (sParam = '/hex') or (sParam = '--hex') then begin IntToHex(StrData, dwValue, 8); write(output, '$'); - writeln(output, String(StrData.cData)); + writeln(output, ChrToStr(StrData.cData)); end else if (sParam = '/dec') or (sParam = '--dec') then begin writeln(output, IntToStr(dwValue)); end else begin IntToHex(StrData, dwValue, 8); write(output, STR_RESULT[dwLanguage]); write(output, ' = $'); - write(output, String(StrData.cData)); + write(output, ChrToStr(StrData.cData)); write(output, ' ('); write(output, IntToStr(dwValue)); writeln(output, ')'); @@ -1630,7 +1657,7 @@ begin end else if (sParam = '/hex') or (sParam = '--hex') then begin IntToHex(StrData, dwValue, 8); write(output, '$'); - writeln(output, String(StrData.cData)); + writeln(output, ChrToStr(StrData.cData)); end else if (sParam = '/dec') or (sParam = '--dec') then begin writeln(output, IntToStr(dwValue)); end else if (sParam = '/ch') or (sParam = '--ch') then begin @@ -1661,7 +1688,7 @@ begin if not longbool(X and $F) then begin writeln(output, ''); IntToHex(StrData, X, 4); - write(output, Copy(String(StrData.cData), 1, 4)); + write(output, Copy(ChrToStr(StrData.cData), 1, 4)); write(output, ' : '); end; if not longbool(X and $7) then begin @@ -1679,7 +1706,13 @@ begin cBuffer[$7] := StrData.cData[$3]; cBuffer[$9] := StrData.cData[$0]; cBuffer[$A] := StrData.cData[$1]; - write(output, String(cBuffer)); +{$IFDEF FREEPASCAL} + write(output, ChrToStr(cBuffer)); +{$ELSE} + // NOTE: Boland Delphi ‚Ìê‡Achar ‚Ì“®“I”z—ñ‚ð string ‚ɃLƒƒƒXƒg‚·‚éꇂÍA + // ’¼Ú string() ‚ðŽg—p‚·‚é + write(output, string(cBuffer)); +{$ENDIF} end; end; writeln(output, ''); @@ -1717,9 +1750,9 @@ begin API_MoveMemory(@cListHeaderA[0], @cBuffer[0], LIST_FILE_HEADER_A_LEN); API_MoveMemory(@cListHeaderB[0], @cBuffer[0], LIST_FILE_HEADER_B_LEN); // ƒtƒ@ƒCƒ‹‚ÌŽí—Þ‚ðŽæ“¾ - if string(cSPCHeader) = SPC_FILE_HEADER then result := FILE_TYPE_SPC; - if string(cListHeaderA) = LIST_FILE_HEADER_A then result := FILE_TYPE_LIST_A; - if string(cListHeaderB) = LIST_FILE_HEADER_B then result := FILE_TYPE_LIST_B; + if ChrToStr(cSPCHeader) = SPC_FILE_HEADER then result := FILE_TYPE_SPC; + if ChrToStr(cListHeaderA) = LIST_FILE_HEADER_A then result := FILE_TYPE_LIST_A; + if ChrToStr(cListHeaderB) = LIST_FILE_HEADER_B then result := FILE_TYPE_LIST_B; // ƒtƒ@ƒCƒ‹‚ðƒNƒ[ƒY API_CloseHandle(hFile); until true; @@ -1879,7 +1912,13 @@ begin // ƒvƒŒƒCƒŠƒXƒg‚ɒljÁ SetLength(cBuffer, dwSizeFile); API_MoveMemory(@cBuffer[0], lpListFile, dwSizeFile); +{$IFDEF FREEPASCAL} + sSPCFiles[I] := ChrToStr(cBuffer); +{$ELSE} + // NOTE: Boland Delphi ‚Ìê‡Achar ‚Ì“®“I”z—ñ‚ð string ‚ɃLƒƒƒXƒg‚·‚éꇂÍA + // ’¼Ú string() ‚ðŽg—p‚·‚é sSPCFiles[I] := string(cBuffer); +{$ENDIF} end; // ƒoƒbƒtƒ@‚ð‰ð•ú FreeMem(lpListFile, 1024); @@ -1983,7 +2022,13 @@ begin J := GetSize(lpBuffer, 1024); SetLength(cBuffer, J); API_MoveMemory(@cBuffer[0], lpBuffer, J); +{$IFDEF FREEPASCAL} + sBuffer := ChrToStr(cBuffer); +{$ELSE} + // NOTE: Boland Delphi ‚Ìê‡Achar ‚Ì“®“I”z—ñ‚ð string ‚ɃLƒƒƒXƒg‚·‚éꇂÍA + // ’¼Ú string() ‚ðŽg—p‚·‚é sBuffer := string(cBuffer); +{$ENDIF} // ƒpƒ‰ƒ[ƒ^‚ðŽæ“¾ I := 1; sEXEPath := GetParameter(I, J, false);