From f898199da57745cefd647f664bb5fac821731ba9 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sat, 14 Oct 2023 14:13:21 +0300 Subject: [PATCH 01/42] fill eeprom backup filename --- base/eeprom-main.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/base/eeprom-main.c b/base/eeprom-main.c index 8594341..6a7197d 100644 --- a/base/eeprom-main.c +++ b/base/eeprom-main.c @@ -329,7 +329,7 @@ void MenuEEPROM(void) "H-chassis (DTL-H500xx)"}; unsigned char done; short int choice, chassis; - char filename[32]; + char filename[256]; done = 0; do @@ -383,14 +383,36 @@ void MenuEEPROM(void) }; break; case 2: - printf("Enter dump filename: "); - if (fgets(filename, sizeof(filename), stdin)) + { + char useDefault; + char default_filename[256]; + u32 serial = 0; + u8 emcs = 0; + + if (EEPROMInitSerial() == 0) + EEPROMGetSerial(&serial, &emcs); + + const char *model = EEPROMGetModelName(); + + // Format the filename + sprintf(default_filename, "%s_%07u.bin", model, serial); + + printf("Default filename: %s\n", default_filename); + printf("Do you want to use the default filename? (Y/N): "); + scanf(" %c", &useDefault); + + if (useDefault == 'Y' || useDefault == 'y') + strcpy(filename, default_filename); + else { - filename[strlen(filename) - 1] = '\0'; - // gets(filename); - printf("Dump %s.\n", DumpEEPROM(filename) == 0 ? "completed" : "failed"); + printf("Enter dump filename: "); + if (fgets(filename, sizeof(filename), stdin)) + filename[strlen(filename) - 1] = '\0'; } - break; + + printf("Dump %s.\n", DumpEEPROM(filename) == 0 ? "completed" : "failed"); + } + break; case 3: printf("Enter dump filename: "); if (fgets(filename, sizeof(filename), stdin)) From 0d0f9857457e5b8774a0ef045d5919a4f98203d0 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sat, 14 Oct 2023 21:09:25 +0300 Subject: [PATCH 02/42] Add timestamp into log files --- PMAP/platform.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/PMAP/platform.c b/PMAP/platform.c index cb8e56b..56b6cef 100644 --- a/PMAP/platform.c +++ b/PMAP/platform.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "platform.h" #include "mecha.h" @@ -135,7 +136,22 @@ void PlatShowMessageB(const char *format, ...) void PlatDebugInit(void) { - DebugOutputFile = fopen("pmap.log", "w"); + // Get the current time + time_t rawtime; + struct tm *timeinfo; + char timestamp[20]; // Adjust the size according to your needs + + time(&rawtime); + timeinfo = localtime(&rawtime); + + // Format the timestamp (e.g., "2023-10-14_12-34-56") + strftime(timestamp, sizeof(timestamp), "%Y-%m-%d_%H-%M-%S", timeinfo); + + // Create the filename with timestamp + char filename[256]; // Adjust the size according to your needs + sprintf(filename, "pmap_%s.log", timestamp); + + DebugOutputFile = fopen(filename, "w"); } void PlatDebugDeinit(void) From 2d9826137d0fe176c312baf6ca346f506f6de5fd Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sat, 14 Oct 2023 21:17:24 +0300 Subject: [PATCH 03/42] Add cfd and cfc into filename --- base/eeprom-main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/eeprom-main.c b/base/eeprom-main.c index 6a7197d..1fece1b 100644 --- a/base/eeprom-main.c +++ b/base/eeprom-main.c @@ -394,8 +394,11 @@ void MenuEEPROM(void) const char *model = EEPROMGetModelName(); + const struct MechaIdentRaw *RawData; + RawData = MechaGetRawIdent(); + // Format the filename - sprintf(default_filename, "%s_%07u.bin", model, serial); + sprintf(default_filename, "%s_%07u_%s_%#08x.bin", model, serial, RawData->cfd, RawData->cfc); printf("Default filename: %s\n", default_filename); printf("Do you want to use the default filename? (Y/N): "); From 502baee291f0c1c02d9dc26be1832137cd6ceef1 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sat, 14 Oct 2023 22:22:59 +0300 Subject: [PATCH 04/42] Added macos test build --- .github/workflows/compilation.yml | 19 ++++ PMAP-macos/Makefile | 13 +++ PMAP-macos/platform-macos.c | 182 ++++++++++++++++++++++++++++++ PMAP-macos/platform.h | 20 ++++ 4 files changed, 234 insertions(+) create mode 100644 PMAP-macos/Makefile create mode 100644 PMAP-macos/platform-macos.c create mode 100644 PMAP-macos/platform.h diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index ac4d894..c286373 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -47,6 +47,25 @@ jobs: title: PMAP-${{ github.ref }} files: Release/PMAP.exe + build-macos: + name: PMAP macos compilation + runs-on: macos-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Build + run: | + cd PMAP-macos + make + tar -zcvf PMAP-macos.tar.gz pmap + + - uses: actions/upload-artifact@v3 + with: + name: PMAP-macos + path: PMAP-macos/PMAP-macos.tar.gz + # build-linux: # name: PMAP linux compilation # runs-on: ubuntu-latest diff --git a/PMAP-macos/Makefile b/PMAP-macos/Makefile new file mode 100644 index 0000000..807371b --- /dev/null +++ b/PMAP-macos/Makefile @@ -0,0 +1,13 @@ +VPATH = ./:../base/ + +ELF = pmap +CFLAGS = -O2 -I. +OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-macos.o +OBJS += ../PMAP/main.o +# OBJS += eeprom-id.o id-main.o + +$(ELF): $(OBJS) + $(CC) -o $(ELF) $(OBJS) + +clean: + rm -f $(ELF) $(OBJS) diff --git a/PMAP-macos/platform-macos.c b/PMAP-macos/platform-macos.c new file mode 100644 index 0000000..0ea785d --- /dev/null +++ b/PMAP-macos/platform-macos.c @@ -0,0 +1,182 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "platform.h" +#include "../base/mecha.h" + +static int ComPortHandle = -1; +static unsigned short RxTimeout; +static FILE *DebugOutputFile = NULL; + +int PlatOpenCOMPort(const char *device) +{ + struct termios options; + int result; + + if (ComPortHandle == -1) + { + ComPortHandle = open(device, O_RDWR | O_NOCTTY | O_NDELAY); + if (ComPortHandle != -1) + { + fcntl(ComPortHandle, F_SETFL, 0); + tcgetattr(ComPortHandle, &options); + cfsetispeed(&options, B57600); + cfsetospeed(&options, B57600); + options.c_cflag &= ~PARENB; // No parity + options.c_cflag &= ~CSTOPB; // 1 stop bit + options.c_cflag &= ~CSIZE; + options.c_cflag |= CS8; // 8 data bits + options.c_cflag &= ~CRTSCTS; // No hardware flow control + options.c_iflag &= ~(IXON | IXOFF | IXANY); // No software flow control + options.c_lflag = 0; + options.c_oflag = 0; + tcsetattr(ComPortHandle, TCSANOW, &options); + tcflush(ComPortHandle, TCIOFLUSH); + RxTimeout = MECHA_TASK_NORMAL_TO; + result = 0; + } + else + { + result = errno; + } + } + else + { + result = EMFILE; + } + + return result; +} + +int PlatReadCOMPort(char *data, int n, unsigned short timeout) +{ + struct timespec ts; + int result; + + if (RxTimeout != timeout) + RxTimeout = timeout; + + ts.tv_sec = timeout / 1000; + ts.tv_nsec = (timeout % 1000) * 1000000; + + if (pselect(ComPortHandle + 1, (fd_set *)NULL, (fd_set *)NULL, (fd_set *)NULL, &ts, (const sigset_t *)NULL) > 0) + result = read(ComPortHandle, data, n); + else + result = -EIO; + + return result; +} + +int PlatWriteCOMPort(const char *data) +{ + int result = write(ComPortHandle, data, strlen(data)); + + return result; +} + +void PlatCloseCOMPort(void) +{ + close(ComPortHandle); + ComPortHandle = -1; +} + +void PlatSleep(unsigned short int msec) +{ + usleep((useconds_t)msec * 1000); +} + +void PlatShowEMessage(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + va_end(args); +} + +void PlatShowMessage(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + va_end(args); +} + +void PlatShowMessageB(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + + // Block until the user presses ENTER + while (getchar() != '\n') + { + }; + + va_end(args); +} + +void PlatDebugInit(void) +{ + // Get the current time + time_t rawtime; + struct tm *timeinfo; + char timestamp[20]; // Adjust the size according to your needs + + time(&rawtime); + timeinfo = localtime(&rawtime); + + // Format the timestamp (e.g., "2023-10-14_12-34-56") + strftime(timestamp, sizeof(timestamp), "%Y-%m-%d_%H-%M-%S", timeinfo); + + // Create the filename with timestamp + char filename[256]; // Adjust the size according to your needs + snprintf(filename, sizeof(filename), "pmap_%s.log", timestamp); + + DebugOutputFile = fopen(filename, "w"); +} + +void PlatDebugDeinit(void) +{ + if (DebugOutputFile != NULL) + { + fclose(DebugOutputFile); + DebugOutputFile = NULL; + } +} + +void PlatDPrintf(const char *format, ...) +{ + va_list args; + + va_start(args, format); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + va_end(args); +} + +int pstricmp(const char *s1, const char *s2) +{ + return strcasecmp(s1, s2); +} + +int pstrincmp(const char *s1, const char *s2, int n) +{ + return strncasecmp(s1, s2, (size_t)n); +} diff --git a/PMAP-macos/platform.h b/PMAP-macos/platform.h new file mode 100644 index 0000000..b82cacf --- /dev/null +++ b/PMAP-macos/platform.h @@ -0,0 +1,20 @@ +typedef unsigned char u8; +typedef unsigned short int u16; +typedef unsigned int u32; + +int PlatOpenCOMPort(const char *device); +int PlatReadCOMPort(char *data, int n, unsigned short timeout); +int PlatWriteCOMPort(const char *data); +void PlatCloseCOMPort(void); +void PlatSleep(unsigned short int msec); +void PlatShowEMessage(const char *format, ...); +void PlatShowMessage(const char *format, ...); +void PlatShowMessageB(const char *format, ...); + +void PlatDebugInit(void); +void PlatDebugDeinit(void); +void PlatDPrintf(const char *format, ...); + +// If necessary, provide these functions, otherwise define them to their equivalents +int pstricmp(const char *s1, const char *s2); +int pstrincmp(const char *s1, const char *s2, int len); From e780913e7fc25b4bad1f39fe7fdac218684df83c Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:07:12 +0300 Subject: [PATCH 05/42] Skip some errors on slim models --- base/elect.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/base/elect.c b/base/elect.c index d8beaa0..a8e7481 100644 --- a/base/elect.c +++ b/base/elect.c @@ -672,7 +672,7 @@ static int ElectJudgeCDTELoopGain(const char *result, int len) else { PlatShowEMessage("CD TE LOOP GAIN NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -791,7 +791,7 @@ static int ElectJudgeDVDSLTELoopGain(const char *result, int len) else { PlatShowEMessage("DVD-SL TE LOOP GAIN NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -906,7 +906,7 @@ static int ElectJudgeDVDDLL0TELoopGain(const char *result, int len) else { PlatShowEMessage("DVD-DL-L0 TE LOOP GAIN NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -970,7 +970,7 @@ static int ElectJudgeDVDDLL1TELoopGain(const char *result, int len) else { PlatShowEMessage("DVD-DL-L1 TE LOOP GAIN NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -1168,7 +1168,7 @@ static int ElectJudgeCDRFDCLevel(const char *data, int len) else { PlatShowEMessage("CD RFDC level NG: %d\n", result); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -1192,7 +1192,7 @@ static int ElectJudgeDVDSLRFDCLevel(const char *data, int len) else { PlatShowEMessage("DVD-SL RFDC level NG: %d\n", result); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -1216,7 +1216,7 @@ static int ElectJudgeDVDDLL0RFDCLevel(const char *data, int len) else { PlatShowEMessage("DVD-DL-L0 RFDC level NG: %d\n", result); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -1240,7 +1240,7 @@ static int ElectJudgeDVDDLL1RFDCLevel(const char *data, int len) else { PlatShowEMessage("DVD-DL-L1 RFDC level NG: %d\n, result"); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -1250,13 +1250,21 @@ static int ElectJudgeCDTPP(const char *data, int len) unsigned short int value1, value2, value3; int sub32, Tbal; + // example data 0995F7D + // Extract the first two characters from the data (99) strncpy(number, &data[1], 2); number[2] = '\0'; value1 = (unsigned short int)strtoul(number, NULL, 16); + + // Extract the next two characters from the data (5F) strncpy(number, &data[3], 2); number[2] = '\0'; value2 = (unsigned short int)strtoul(number, NULL, 16); + + // Extract the last two characters from the data (7D) value3 = (unsigned short int)strtoul(&data[5], NULL, 16); + + // Subtract value2 from value1 (3A) value1 -= value2; if (value1 >= 0x35 && value1 <= 0x7E) // TPP check @@ -1274,13 +1282,13 @@ static int ElectJudgeCDTPP(const char *data, int len) else { PlatShowEMessage("CD TPP Tbal NG: %ld\n", Tbal); - return 1; + return (ConSlim == 1) ? 0 : 1; } } else { PlatShowEMessage("CD TPP NG: %d\n", value1); - return 1; + return (ConSlim == 1) ? 0 : 1; } } From 46a71996d622efedd0862d1f223a6b75890939ad Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:15:25 +0300 Subject: [PATCH 06/42] Initial ID support --- .github/workflows/compilation.yml | 25 ++- PMAP-macos/Makefile | 6 +- PMAP-macos/pmap | Bin 0 -> 144288 bytes PMAP/PMAP.vcxproj | 5 + base/eeprom-id.c | 343 ++++++++++++++++++++++++++++++ base/eeprom-id.h | 9 + base/id-main.c | 327 ++++++++++++++++++++++++++++ 7 files changed, 713 insertions(+), 2 deletions(-) create mode 100755 PMAP-macos/pmap create mode 100644 base/eeprom-id.c create mode 100644 base/eeprom-id.h create mode 100644 base/id-main.c diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index c286373..8139f65 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: PMAP.exe + name: PMAP-win path: Release/PMAP.exe - uses: actions/upload-artifact@v3 @@ -29,6 +29,17 @@ jobs: name: PMAP-win.exe path: Release/PMAP-win.exe + - name: Clean + run: msbuild /t:Clean + + - name: Build id + run: msbuild /p:PlatformToolset=v142 /p:Configuration=Release /p:PreprocessorDefinitions=ID_MANAGEMENT=1;%(PreprocessorDefinitions) + + - uses: actions/upload-artifact@v3 + with: + name: PMAP-win-id + path: Release/PMAP.exe + - name: Create release if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' uses: marvinpinto/action-automatic-releases@latest @@ -61,11 +72,23 @@ jobs: make tar -zcvf PMAP-macos.tar.gz pmap + - name: Build id + run: | + cd PMAP-macos + make clean + make ID_MANAGEMENT=1 + tar -zcvf PMAP-macos-id.tar.gz pmap + - uses: actions/upload-artifact@v3 with: name: PMAP-macos path: PMAP-macos/PMAP-macos.tar.gz + - uses: actions/upload-artifact@v3 + with: + name: PMAP-macos-id + path: PMAP-macos/PMAP-macos-id.tar.gz + # build-linux: # name: PMAP linux compilation # runs-on: ubuntu-latest diff --git a/PMAP-macos/Makefile b/PMAP-macos/Makefile index 807371b..9ea1dd5 100644 --- a/PMAP-macos/Makefile +++ b/PMAP-macos/Makefile @@ -4,7 +4,11 @@ ELF = pmap CFLAGS = -O2 -I. OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-macos.o OBJS += ../PMAP/main.o -# OBJS += eeprom-id.o id-main.o +# Add -DID_MANAGEMENT when ID_MANAGEMENT is defined +ifdef ID_MANAGEMENT +CFLAGS += -DID_MANAGEMENT +OBJS += eeprom-id.o id-main.o +endif $(ELF): $(OBJS) $(CC) -o $(ELF) $(OBJS) diff --git a/PMAP-macos/pmap b/PMAP-macos/pmap new file mode 100755 index 0000000000000000000000000000000000000000..cb7293ce54c2c11f55a3702332cc046d0d8f3ba6 GIT binary patch literal 144288 zcmeFad0-Sp^Z30RvXB5_!YLjIBDabJjfxOuA;F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QD1+}K1Z0Un~sGWL`YN*Z- zh^IB^5D>aVkWpaORO2F@5fT{X-4bl3 zx?XRs4U%S>&{f5Na#dTc4b73)>z6R(MGP8 z2pA+5`PJtxCQ8~$ajU1+Mo70)^-CV7im8Dop{t5rRWf9Z0)rD%vy8011`aQ{irFe| zIW64U`hMm)!5vx*FI*^J2=8r?v`!v zVMa%vihZpnPX0P7*V}Z2+M!$LdP|je8qP2G=e-y$Is{z`J~A7ZcYhnlmtsmx1TJ}E zF3{a%qJU~+u0{O^OYzn$opR<}WG&&`^laM9yQj1{(EyaWGBZgBz7oaBHK`2~_2G-* z25I3mx|8|{&4NMw>lrmP5t3W-9+M9r2s^x8AtoSNvtT6h^R7C~B^ z-7=ZnsV$ZGqzEs%g}U|&=cp$*shzrOQt{>+|azHr3GvcZXDkUs!i9) z-CCN} + + + @@ -94,6 +97,8 @@ + + diff --git a/base/eeprom-id.c b/base/eeprom-id.c new file mode 100644 index 0000000..d828356 --- /dev/null +++ b/base/eeprom-id.c @@ -0,0 +1,343 @@ +#include +#include +#include +#include +#include + +#include "platform.h" +#include "mecha.h" +#include "eeprom.h" +#include "eeprom-id.h" + +u8 iLinkID[8], ConsoleID[8]; +extern char ConModelName[17]; +extern unsigned char ConMD; + +static int EEPROMIDSaveiLinkID(const char *data, int len, int offset) +{ + u16 word; + + word = (u16)strtoul(&data[5], NULL, 16); + iLinkID[offset + 1] = word >> 8 & 0xFF; + iLinkID[offset] = word & 0xFF; + return 0; +} + +static int EEPROMIDSaveConsoleID(const char *data, int len, int offset) +{ + u16 word; + + word = (u16)strtoul(&data[5], NULL, 16); + ConsoleID[offset + 1] = word >> 8 & 0xFF; + ConsoleID[offset] = word & 0xFF; + return 0; +} + +static int EEPROMIDRxHandler(MechaTask_t *task, const char *result, short int len) +{ + switch (result[0]) + { + case '0': // Rx-OK + switch (task->tag) + { + case MECHA_CMD_TAG_INIT_ID_ILINK_ID_0: + return EEPROMIDSaveiLinkID(result, len, 0); + case MECHA_CMD_TAG_INIT_ID_ILINK_ID_1: + return EEPROMIDSaveiLinkID(result, len, 2); + case MECHA_CMD_TAG_INIT_ID_ILINK_ID_2: + return EEPROMIDSaveiLinkID(result, len, 4); + case MECHA_CMD_TAG_INIT_ID_ILINK_ID_3: + return EEPROMIDSaveiLinkID(result, len, 6); + case MECHA_CMD_TAG_INIT_ID_CON_ID_0: + return EEPROMIDSaveConsoleID(result, len, 0); + case MECHA_CMD_TAG_INIT_ID_CON_ID_1: + return EEPROMIDSaveConsoleID(result, len, 2); + case MECHA_CMD_TAG_INIT_ID_CON_ID_2: + return EEPROMIDSaveConsoleID(result, len, 4); + case MECHA_CMD_TAG_INIT_ID_CON_ID_3: + return EEPROMIDSaveConsoleID(result, len, 6); + default: + return 0; + } + break; + case '1': // Rx-NGErr + switch (task->tag) + { + default: + return MechaDefaultHandleRes1(task, result, len); + } + break; + case '2': // Rx-NGBadCmd + switch (task->tag) + { + default: + return MechaDefaultHandleRes2(task, result, len); + } + default: + return MechaDefaultHandleResUnknown(task, result, len); + } +} + +struct RegionData +{ + u8 region, vmode; +}; + +int MechaInitMechacon(int model, int IsDex) +{ + const struct RegionData CEXregions[] = { + {0, 0}, // 00 Japan + {1, 0}, // 01 USA + {3, 1}, // 02 Australia + {2, 1}, // 03 Great Britian + {2, 1}, // 04 Europe + {4, 0}, // 05 Korea + {4, 0}, // 06 Hong Kong + {4, 0}, // 07 Taiwan + {5, 1}, // 08 Russia + {6, 0}, // 09 Mainland China + {1, 0}, // 10 Canada (PAL or NTSC ??) + {7, 0}, // 11 Mexico + }; + const struct RegionData DEXregions[] = { + {0, 0}, // 00 + {1, 0}, // 01 + {1, 1}, // 02 + {0, 0}, // 05 + {0, 0}, // 06 + {1, 1}, // 08 + {6, 0}, // 09 + }; + time_t TimeNow; + struct tm *tm; + const struct RegionData *region; + char data[26]; + unsigned char id; + + region = IsDex ? &DEXregions[model] : &CEXregions[model]; + id = 1; + MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); + /* if(MechaIdentRaw.cfc == 0x00000000) //Check that the MECHACON ID is 0. Not sure why it's necessary (may be either a safety check for their UI, or might be to prevent reassignments from taking place). + { */ + if (IsDex) + { + MechaCommandAdd(MECHA_CMD_INIT_MECHACON, "0001", id++, 0, 6000, "WR INIT DEX"); + MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); + } + + time(&TimeNow); + srand((unsigned int)TimeNow); + tm = localtime(&TimeNow); + // Format: RRYYMMDDHHMMSSrrrr, where R = MagicGate region, Y = Year (from 2000), M = Month (1-12), D = Day of month (1-31), H = Hour (0-23), M = minute (0-59), S = second (0-59), r = random number (first 4 digits from the right). + // The time and date format is made with Ctime::Format %y%m%d%H%M%S + sprintf(data, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); + printf("Shimuke: %s (%ul)\n", data, strlen(data)); + MechaCommandAdd(MECHA_CMD_INIT_SHIMUKE, data, id++, 0, 6000, "WR INIT SHIMUKE"); + MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); + // } + MechaCommandAdd(MECHA_CMD_CLEAR_CONF, "00", id++, 0, 6000, "WR INIT ALL DEFAULT"); + MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); + if (region->vmode == 0) + MechaCommandAdd(MECHA_CMD_SETUP_OSD, "00", id++, 0, 6000, "WR INIT NTSC"); + else + MechaCommandAdd(MECHA_CMD_SETUP_OSD, "01", id++, 0, 6000, "WR INIT PAL"); + MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); + + return MechaCommandExecuteList(NULL, &EEPROMIDRxHandler); +} + +int EEPROMNTSCPALDefaults(int vmode) +{ + u8 id; + + id = 1; + if (vmode == 0) + MechaCommandAdd(MECHA_CMD_SETUP_OSD, "00", id++, 0, 6000, "WR INIT NTSC"); + else + MechaCommandAdd(MECHA_CMD_SETUP_OSD, "01", id++, 0, 6000, "WR INIT PAL"); + + return MechaCommandExecuteList(NULL, &EEPROMIDRxHandler); +} + +int EEPROMInitID(void) +{ + char address[5]; + unsigned char id; + + memset(iLinkID, 0, sizeof(iLinkID)); + memset(ConsoleID, 0, sizeof(ConsoleID)); + + id = 1; + if (ConMD == 40) + { + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_0); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_0, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_1); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_1, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_2); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_2, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_3); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_3, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_0); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_0, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_1); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_1, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_2); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_2, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_3); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_3, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + } + else + { + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_0); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_0, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_1); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_1, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_2); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_2, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_3); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_3, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_0); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_0, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_1); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_1, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_2); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_2, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + sprintf(address, "%04x", EEPROM_MAP_CON_ID_3); + MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_3, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); + } + + return MechaCommandExecuteList(NULL, &EEPROMIDRxHandler); +} + +void EEPROMGetiLinkID(u8 *id) +{ + memcpy(id, iLinkID, sizeof(iLinkID)); +} + +void EEPROMGetConsoleID(u8 *id) +{ + memcpy(id, ConsoleID, sizeof(ConsoleID)); +} + +int EEPROMSetiLinkID(const u8 *NewiLinkID) +{ + char arg[9]; + unsigned char id; + + memcpy(iLinkID, NewiLinkID, sizeof(iLinkID)); + + id = 1; + if (ConMD == 40) + { + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_0, iLinkID[1], iLinkID[0]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_1, iLinkID[3], iLinkID[2]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_2, iLinkID[5], iLinkID[4]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_3, iLinkID[7], iLinkID[6]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + } + else + { + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_0, iLinkID[1], iLinkID[0]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_1, iLinkID[3], iLinkID[2]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_2, iLinkID[5], iLinkID[4]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_3, iLinkID[7], iLinkID[6]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); + } + MechaAddPostEEPROMWrCmds(id); + + return MechaCommandExecuteList(NULL, &EEPROMIDRxHandler); +} + +int EEPROMSetConsoleID(const u8 *NewConID) +{ + char arg[9]; + unsigned char id; + + memcpy(ConsoleID, NewConID, sizeof(ConsoleID)); + + id = 1; + if (ConMD == 40) + { + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_0, ConsoleID[1], ConsoleID[0]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_1, ConsoleID[3], ConsoleID[2]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_2, ConsoleID[5], ConsoleID[4]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_3, ConsoleID[7], ConsoleID[6]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + } + else + { + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_0, ConsoleID[1], ConsoleID[0]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_1, ConsoleID[3], ConsoleID[2]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_2, ConsoleID[5], ConsoleID[4]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_3, ConsoleID[7], ConsoleID[6]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); + } + MechaAddPostEEPROMWrCmds(id); + + return MechaCommandExecuteList(NULL, &EEPROMIDRxHandler); +} + +int EEPROMSetModelName(const char *ModelName) +{ + char arg[9]; + unsigned char id; + + memset(ConModelName, 0, sizeof(ConModelName)); + strncpy(ConModelName, ModelName, sizeof(ConModelName) - 1); + + id = 1; + if (ConMD == 40) + { + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_0, ConModelName[1], ConModelName[0]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_1, ConModelName[3], ConModelName[2]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_2, ConModelName[5], ConModelName[4]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_3, ConModelName[7], ConModelName[6]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_4, ConModelName[9], ConModelName[8]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_5, ConModelName[11], ConModelName[10]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_6, ConModelName[13], ConModelName[12]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_7, ConModelName[15], ConModelName[14]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + } + else + { + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_0, ConModelName[1], ConModelName[0]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_1, ConModelName[3], ConModelName[2]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_2, ConModelName[5], ConModelName[4]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_3, ConModelName[7], ConModelName[6]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_4, ConModelName[9], ConModelName[8]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_5, ConModelName[11], ConModelName[10]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_6, ConModelName[13], ConModelName[12]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_7, ConModelName[15], ConModelName[14]); + MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); + } + MechaAddPostEEPROMWrCmds(id); + + return MechaCommandExecuteList(NULL, &EEPROMIDRxHandler); +} diff --git a/base/eeprom-id.h b/base/eeprom-id.h new file mode 100644 index 0000000..5bc9a28 --- /dev/null +++ b/base/eeprom-id.h @@ -0,0 +1,9 @@ +int EEPROMInitID(void); +int MechaInitMechacon(int model, int IsDex); +int EEPROMNTSCPALDefaults(int vmode); + +void EEPROMGetiLinkID(u8 *id); +void EEPROMGetConsoleID(u8 *id); +int EEPROMSetiLinkID(const u8 *NewiLinkID); +int EEPROMSetConsoleID(const u8 *NewConID); +int EEPROMSetModelName(const char *ModelName); diff --git a/base/id-main.c b/base/id-main.c new file mode 100644 index 0000000..768e36d --- /dev/null +++ b/base/id-main.c @@ -0,0 +1,327 @@ +#include +#include +#include +#include + +#include "platform.h" +#include "mecha.h" +#include "eeprom.h" +#include "eeprom-id.h" +#include "main.h" + +extern unsigned char ConType; + +static void InitMechacon(void) +{ + int choice, done, dex, NumChoices; + + if (ConType == MECHA_TYPE_40) + { + done = 0; + while (!done) + { + do + { + printf("MECHACON initialization for H/I-chassis\n" + "Select type:\n" + "\t1. CEX\n" + "\t2. DEX\n" + "\t3. Quit\n" + "Your choice: "); + choice = 0; + if (scanf("%d", &choice) > 0) + while (getchar() != '\n') + { + }; + } while (choice < 1 || choice > 3); + + switch (choice) + { + case 1: + dex = 0; + break; + case 2: + dex = 1; + break; + case 3: + done = 1; + } + + if (!done) + { + do + { + if (!dex) + { + printf("Select model Name:\n" + "\t1. SCPH-xx000 (Japan)\n" + "\t2. SCPH-xx001 (USA)\n" + "\t3. SCPH-xx002 (Australia)\n" + "\t4. SCPH-xx003 (Great Britian)\n" + "\t5. SCPH-xx004 (Europe)\n" + "\t6. SCPH-xx005 (Korea)\n" + "\t7. SCPH-xx006 (Hong Kong)\n" + "\t8. SCPH-xx007 (Taiwan)\n" + "\t9. SCPH-xx008 (Russia)\n" + "\t10. SCPH-50009 (China)\n" + "\t11. SCPH-xx010 (SCPH-50010: Canada, Slims: Mexico)\n" + "\t12. SCPH-x0011 (SCPH-50011: Mexico, SCPH-70011: USA)\n" + "\t13. SCPH-70012 (Canada)\n" + "\t14. Quit\n" + "Your choice: "); + NumChoices = 12; + } + else + { + printf("Select model Name:\n" + "\t1. DTL-H50000\n" + "\t2. DTL-H50001\n" + "\t3. DTL-H50002\n" + "\t4. DTL-H50005\n" + "\t5. DTL-H50006\n" + "\t6. DTL-H50008\n" + "\t7. DTL-H50009\n" + "\t8. Quit\n" + "Your choice: "); + NumChoices = 8; + } + choice = 0; + if (scanf("%d", &choice) > 0) + while (getchar() != '\n') + { + }; + } while (choice < 1 || choice > NumChoices); + if (!dex) + { + switch (choice) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + printf("MechaInit: %s\n", MechaInitMechacon(choice, 0) == 0 ? "done" : "failed"); + break; + case 14: + done = 1; + } + } + else + { + switch (choice) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + printf("MechaInit: %s\n", MechaInitMechacon(choice, 1) == 0 ? "done" : "failed"); + break; + case 8: + done = 1; + } + } + } + } + } + else + printf("MechaInit: Unsupported chassis.\n"); +} + +static void WriteiLinkID(void) +{ + u8 iLinkID[8]; + unsigned char i; + unsigned short int NewiLinkIDInput[8]; + + EEPROMGetiLinkID(iLinkID); + printf("Current i.Link ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" + "Enter new ID:\t\t", + iLinkID[0], iLinkID[1], iLinkID[2], iLinkID[3], iLinkID[4], iLinkID[5], iLinkID[6], iLinkID[7]); + if (scanf("%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", + &NewiLinkIDInput[0], &NewiLinkIDInput[1], &NewiLinkIDInput[2], &NewiLinkIDInput[3], &NewiLinkIDInput[4], + &NewiLinkIDInput[5], &NewiLinkIDInput[6], &NewiLinkIDInput[7]) == 8) + { + for (i = 0; i < 8; i++) + iLinkID[i] = (u8)NewiLinkIDInput[i]; + printf("iLink ID update %s\n", (EEPROMSetiLinkID(iLinkID) == 0) ? "completed" : "failed"); + } + else + { + printf("Operation aborted.\n"); + } + + while (getchar() != '\n') + { + }; +} + +static void WriteConsoleID(void) +{ + u8 ConsoleID[8]; + unsigned char i; + unsigned short int NewConsoleIDInput[8]; + + EEPROMGetConsoleID(ConsoleID); + printf("Current console ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" + "Enter new ID:\t\t", + ConsoleID[0], ConsoleID[1], ConsoleID[2], ConsoleID[3], ConsoleID[4], ConsoleID[5], ConsoleID[6], ConsoleID[7]); + if (scanf("%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", + &NewConsoleIDInput[0], &NewConsoleIDInput[1], &NewConsoleIDInput[2], &NewConsoleIDInput[3], &NewConsoleIDInput[4], + &NewConsoleIDInput[5], &NewConsoleIDInput[6], &NewConsoleIDInput[7]) == 8) + { + for (i = 0; i < 8; i++) + ConsoleID[i] = (u8)NewConsoleIDInput[i]; + printf("Console ID update %s\n", (EEPROMSetConsoleID(ConsoleID) == 0) ? "completed" : "failed"); + } + else + { + printf("Operation aborted.\n"); + } + + while (getchar() != '\n') + { + }; +} + +static void WriteModelName(void) +{ + const char *ModelName; + char NewModelName[32]; // Maximum of 16 characters for the model name. Anything longer will be truncated. + + switch (ConType) + { + case MECHA_TYPE_36: + printf("This model does not support a model name.\n"); + return; + } + + ModelName = EEPROMGetModelName(); + printf("Current model name:\t%s\n" + "Maximum length is 16\n" + "Enter new name:\t\t", + ModelName[0] == 0x00 ? "" : ModelName); + if (fgets(NewModelName, sizeof(NewModelName), stdin)) + { + NewModelName[16] = '\0'; + printf("Model name update %s\n", (EEPROMSetModelName(NewModelName) == 0) ? "completed" : "failed"); + } +} + +static void DisplayIDInfo(void) +{ + u8 iLinkID[8], ConsoleID[8]; + + EEPROMGetiLinkID(iLinkID); + EEPROMGetConsoleID(ConsoleID); + printf("i.Link ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" + "Console ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n", + iLinkID[0], iLinkID[1], iLinkID[2], iLinkID[3], iLinkID[4], iLinkID[5], iLinkID[6], iLinkID[7], + ConsoleID[0], ConsoleID[1], ConsoleID[2], ConsoleID[3], ConsoleID[4], ConsoleID[5], ConsoleID[6], ConsoleID[7]); +} + +static void InitNTSCPALDefaults(void) +{ + int choice; + + do + { + printf("NTSC/PAL selection:\n" + "\t1. NTSC\n" + "\t2. PAL\n" + "\t3. Quit\n" + "Your choice: "); + choice = 0; + if (scanf("%d", &choice) > 0) + while (getchar() != '\n') + { + }; + } while (choice < 1 || choice > 3); + + switch (choice) + { + case 1: + printf("Init NTSC defaults: %s\n", EEPROMNTSCPALDefaults(0) == 0 ? "completed" : "failed"); + break; + case 2: + printf("Init PAL defaults: %s\n", EEPROMNTSCPALDefaults(1) == 0 ? "completed" : "failed"); + break; + } +} + +void MenuID(void) +{ + char done; + int choice; + + if (MechaInitModel() != 0 || EEPROMInitID() != 0) + { + DisplayConnHelp(); + return; + } + + done = 0; + do + { + do + { + DisplayCommonConsoleInfo(); + DisplayIDInfo(); + printf("ID Managenent:\n" + "\t1. Write i.Link ID\n" + "\t2. Write console ID\n" + "\t3. Write model name (AB-chassis and later only)\n" + "\t4. Initialize NTSC/PAL defaults (B-chassis DEX and later only)\n" + "\t5. Initialize MECHACON (H/I-chassis only)\n" + "\t6. Quit\n" + "Your choice: "); + choice = 0; + scanf("%d", &choice); + while (getchar() != '\n') + { + }; + } while (choice < 1 || choice > 6); + putchar('\n'); + + switch (choice) + { + case 1: + WriteiLinkID(); + if (EEPROMInitID() != 0) + { + DisplayConnHelp(); + return; + } + break; + case 2: + WriteConsoleID(); + if (EEPROMInitID() != 0) + { + DisplayConnHelp(); + return; + } + break; + case 3: + WriteModelName(); + break; + case 4: + InitNTSCPALDefaults(); + break; + case 5: + InitMechacon(); + break; + default: + done = 1; + } + } while (!done); +} From 7c5985272ff2b85de21490df2c471372fa4809bd Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:44:40 +0300 Subject: [PATCH 07/42] Fix windows build, hardcode Id_Mangament for now --- .github/workflows/compilation.yml | 11 ----------- PMAP/PMAP.vcxproj | 10 +++++----- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 8139f65..dc493b8 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -29,17 +29,6 @@ jobs: name: PMAP-win.exe path: Release/PMAP-win.exe - - name: Clean - run: msbuild /t:Clean - - - name: Build id - run: msbuild /p:PlatformToolset=v142 /p:Configuration=Release /p:PreprocessorDefinitions=ID_MANAGEMENT=1;%(PreprocessorDefinitions) - - - uses: actions/upload-artifact@v3 - with: - name: PMAP-win-id - path: Release/PMAP.exe - - name: Create release if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' uses: marvinpinto/action-automatic-releases@latest diff --git a/PMAP/PMAP.vcxproj b/PMAP/PMAP.vcxproj index 29080cf..f871b09 100644 --- a/PMAP/PMAP.vcxproj +++ b/PMAP/PMAP.vcxproj @@ -51,7 +51,7 @@ Level3 Disabled - WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ID_MANAGEMENT=1;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\base;.; @@ -67,7 +67,7 @@ MaxSpeed true true - WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ID_MANAGEMENT=1;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\base;.; @@ -86,8 +86,8 @@ - - + + @@ -98,7 +98,7 @@ - + From b7c15a9e75cd53633d15fb6150bcc4ef45d1ef38 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 29 Oct 2023 21:17:25 +0200 Subject: [PATCH 08/42] MacOS fixed and working now --- .gitignore | 2 + PMAP-macos/platform-macos.c | 118 ++++++++++++++++++++++++++++++++---- 2 files changed, 107 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 54b2550..261fb14 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ .vs Debug Release +PMAP-macos/pmap +PMAP-linux/pmap !.github !.editorconfig diff --git a/PMAP-macos/platform-macos.c b/PMAP-macos/platform-macos.c index 0ea785d..d1f376a 100644 --- a/PMAP-macos/platform-macos.c +++ b/PMAP-macos/platform-macos.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -23,11 +24,41 @@ int PlatOpenCOMPort(const char *device) if (ComPortHandle == -1) { + // List available serial devices + printf("Available serial devices in /dev/:\n"); + DIR *dir; + struct dirent *entry; + + dir = opendir("/dev"); + if (dir != NULL) + { + while ((entry = readdir(dir))) + { + if (strncmp(entry->d_name, "cu.", 3) == 0) + { + printf("/dev/%s\n", entry->d_name); + } + } + closedir(dir); + } + + printf("Opening COM port: %s\n", device); + ComPortHandle = open(device, O_RDWR | O_NOCTTY | O_NDELAY); + if (ComPortHandle != -1) { + printf("COM port opened successfully.\n"); + fcntl(ComPortHandle, F_SETFL, 0); - tcgetattr(ComPortHandle, &options); + if (tcgetattr(ComPortHandle, &options) == -1) + { + printf("Failed to get terminal attributes. Error code: %d\n", errno); + close(ComPortHandle); + ComPortHandle = -1; + return errno; + } + cfsetispeed(&options, B57600); cfsetospeed(&options, B57600); options.c_cflag &= ~PARENB; // No parity @@ -38,18 +69,37 @@ int PlatOpenCOMPort(const char *device) options.c_iflag &= ~(IXON | IXOFF | IXANY); // No software flow control options.c_lflag = 0; options.c_oflag = 0; - tcsetattr(ComPortHandle, TCSANOW, &options); - tcflush(ComPortHandle, TCIOFLUSH); + + if (tcsetattr(ComPortHandle, TCSANOW, &options) == -1) + { + printf("Failed to set terminal attributes. Error code: %d\n", errno); + close(ComPortHandle); + ComPortHandle = -1; + return errno; + } + + if (tcflush(ComPortHandle, TCIOFLUSH) == -1) + { + printf("Failed to flush terminal I/O. Error code: %d\n", errno); + close(ComPortHandle); + ComPortHandle = -1; + return errno; + } + RxTimeout = MECHA_TASK_NORMAL_TO; - result = 0; + + printf("COM port configuration set.\n"); + result = 0; } else { result = errno; + printf("Failed to open COM port. Error code: %d\n", result); } } else { + printf("COM port is already open.\n"); result = EMFILE; } @@ -58,19 +108,45 @@ int PlatOpenCOMPort(const char *device) int PlatReadCOMPort(char *data, int n, unsigned short timeout) { - struct timespec ts; int result; - if (RxTimeout != timeout) - RxTimeout = timeout; + if (ComPortHandle == -1) + { + printf("COM port is not open.\n"); + return -1; // Return an error code indicating that the COM port is not open. + } - ts.tv_sec = timeout / 1000; - ts.tv_nsec = (timeout % 1000) * 1000000; + fd_set readfds; + struct timeval tv; - if (pselect(ComPortHandle + 1, (fd_set *)NULL, (fd_set *)NULL, (fd_set *)NULL, &ts, (const sigset_t *)NULL) > 0) + FD_ZERO(&readfds); + FD_SET(ComPortHandle, &readfds); + + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + + result = select(ComPortHandle + 1, &readfds, NULL, NULL, &tv); + + if (result > 0) + { + // Data is available, read it result = read(ComPortHandle, data, n); + + if (result < 0) + { + printf("Read from COM port failed.\n"); + } + } + else if (result == 0) + { + // Timeout + printf("Read from COM port timed out.\n"); + } else - result = -EIO; + { + // Error + printf("Select function error.\n"); + } return result; } @@ -78,16 +154,32 @@ int PlatReadCOMPort(char *data, int n, unsigned short timeout) int PlatWriteCOMPort(const char *data) { int result = write(ComPortHandle, data, strlen(data)); + tcdrain(ComPortHandle); + + if (result < 0) + { + printf("Write to COM port failed.\n"); + } return result; } void PlatCloseCOMPort(void) { - close(ComPortHandle); - ComPortHandle = -1; + if (ComPortHandle != -1) + { + printf("Closing COM port...\n"); + close(ComPortHandle); + ComPortHandle = -1; + printf("COM port closed.\n"); + } + else + { + printf("COM port is already closed.\n"); + } } + void PlatSleep(unsigned short int msec) { usleep((useconds_t)msec * 1000); From 711b27a4732d79cb924697742d313b600ae332be Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 29 Oct 2023 22:27:43 +0200 Subject: [PATCH 09/42] test linux --- .github/workflows/compilation.yml | 48 +++++++++++++++++++----------- PMAP-macos/pmap | Bin 144288 -> 0 bytes 2 files changed, 30 insertions(+), 18 deletions(-) delete mode 100755 PMAP-macos/pmap diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index dc493b8..88f5411 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -78,21 +78,33 @@ jobs: name: PMAP-macos-id path: PMAP-macos/PMAP-macos-id.tar.gz - # build-linux: - # name: PMAP linux compilation - # runs-on: ubuntu-latest - - # steps: - # - name: Checkout Repository - # uses: actions/checkout@v3 - - # - name: Build - # run: | - # cd PMAP-linux - # make - # tar -zcvf pmap.tar.gz pmap - - # - uses: actions/upload-artifact@v3 - # with: - # name: PMAP - # path: linux/pmap.tar.gz + build-linux: + name: PMAP linux compilation + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Build + run: | + cd PMAP-macos + make + tar -zcvf PMAP-linux.tar.gz pmap + + - name: Build id + run: | + cd PMAP-macos + make clean + make ID_MANAGEMENT=1 + tar -zcvf PMAP-linux-id.tar.gz pmap + + - uses: actions/upload-artifact@v3 + with: + name: PMAP-linux + path: PMAP-macos/PMAP-linux.tar.gz + + - uses: actions/upload-artifact@v3 + with: + name: PMAP-linux-id + path: PMAP-macos/PMAP-linux-id.tar.gz diff --git a/PMAP-macos/pmap b/PMAP-macos/pmap deleted file mode 100755 index cb7293ce54c2c11f55a3702332cc046d0d8f3ba6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal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K zt3E|W3d~*?BO|`@(=QV9^f${86j#xVqolV|q&gzMNTVQD1+}K1Z0Un~sGWL`YN*Z- zh^IB^5D>aVkWpaORO2F@5fT{X-4bl3 zx?XRs4U%S>&{f5Na#dTc4b73)>z6R(MGP8 z2pA+5`PJtxCQ8~$ajU1+Mo70)^-CV7im8Dop{t5rRWf9Z0)rD%vy8011`aQ{irFe| zIW64U`hMm)!5vx*FI*^J2=8r?v`!v zVMa%vihZpnPX0P7*V}Z2+M!$LdP|je8qP2G=e-y$Is{z`J~A7ZcYhnlmtsmx1TJ}E zF3{a%qJU~+u0{O^OYzn$opR<}WG&&`^laM9yQj1{(EyaWGBZgBz7oaBHK`2~_2G-* z25I3mx|8|{&4NMw>lrmP5t3W-9+M9r2s^x8AtoSNvtT6h^R7C~B^ z-7=ZnsV$ZGqzEs%g}U|&=cp$*shzrOQt{>+|azHr3GvcZXDkUs!i9) z-CCN} Date: Mon, 30 Oct 2023 12:19:03 +0200 Subject: [PATCH 10/42] small warnings fixed --- base/eeprom-id.c | 2 +- base/eeprom-main.c | 6 +++++- base/elect.c | 4 ++-- base/id-main.c | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/base/eeprom-id.c b/base/eeprom-id.c index d828356..9ea4b0b 100644 --- a/base/eeprom-id.c +++ b/base/eeprom-id.c @@ -131,7 +131,7 @@ int MechaInitMechacon(int model, int IsDex) // Format: RRYYMMDDHHMMSSrrrr, where R = MagicGate region, Y = Year (from 2000), M = Month (1-12), D = Day of month (1-31), H = Hour (0-23), M = minute (0-59), S = second (0-59), r = random number (first 4 digits from the right). // The time and date format is made with Ctime::Format %y%m%d%H%M%S sprintf(data, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); - printf("Shimuke: %s (%ul)\n", data, strlen(data)); + printf("Shimuke: %s (%zu)\n", data, strlen(data)); MechaCommandAdd(MECHA_CMD_INIT_SHIMUKE, data, id++, 0, 6000, "WR INIT SHIMUKE"); MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); // } diff --git a/base/eeprom-main.c b/base/eeprom-main.c index 1fece1b..0261bb1 100644 --- a/base/eeprom-main.c +++ b/base/eeprom-main.c @@ -402,7 +402,11 @@ void MenuEEPROM(void) printf("Default filename: %s\n", default_filename); printf("Do you want to use the default filename? (Y/N): "); - scanf(" %c", &useDefault); + + if (scanf(" %c", &useDefault) > 0) + while (getchar() != '\n') + { + }; if (useDefault == 'Y' || useDefault == 'y') strcpy(filename, default_filename); diff --git a/base/elect.c b/base/elect.c index a8e7481..df10a64 100644 --- a/base/elect.c +++ b/base/elect.c @@ -1343,9 +1343,9 @@ static int JudgeDVDSLDeFocusOffset(const char *data, int len) offset = (unsigned int)strtoul(&data[5], NULL, 16); if (offset == 0x100) - offset = -(~offset & 0xFF); + offset = -((int)((~offset) & 0xFF)); else - offset &= 0xFF; + offset = (int)(offset & 0xFF); result = offset / (ConFocusOffset << 2) * 100.0f; diff --git a/base/id-main.c b/base/id-main.c index 768e36d..7e000b4 100644 --- a/base/id-main.c +++ b/base/id-main.c @@ -286,10 +286,10 @@ void MenuID(void) "\t6. Quit\n" "Your choice: "); choice = 0; - scanf("%d", &choice); - while (getchar() != '\n') - { - }; + if (scanf("%d", &choice) > 0) + while (getchar() != '\n') + { + }; } while (choice < 1 || choice > 6); putchar('\n'); From b122fca99e077c62e9aefe4056b0dc2ccbd87826 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:10:29 +0200 Subject: [PATCH 11/42] Moved pmap main into common files --- PMAP-linux/Makefile | 2 +- PMAP-macos/Makefile | 2 +- PMAP/PMAP.vcxproj | 2 +- {PMAP => base}/main.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) rename {PMAP => base}/main.c (97%) diff --git a/PMAP-linux/Makefile b/PMAP-linux/Makefile index 2b4df9f..2643483 100644 --- a/PMAP-linux/Makefile +++ b/PMAP-linux/Makefile @@ -3,7 +3,7 @@ VPATH = ./:../base/ ELF = pmap CFLAGS = -O2 -I. OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-linux.o -OBJS += ../PMAP/main.o +OBJS += main.o # OBJS += eeprom-id.o id-main.o $(ELF): $(OBJS) diff --git a/PMAP-macos/Makefile b/PMAP-macos/Makefile index 9ea1dd5..6351798 100644 --- a/PMAP-macos/Makefile +++ b/PMAP-macos/Makefile @@ -3,7 +3,7 @@ VPATH = ./:../base/ ELF = pmap CFLAGS = -O2 -I. OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-macos.o -OBJS += ../PMAP/main.o +OBJS += main.o # Add -DID_MANAGEMENT when ID_MANAGEMENT is defined ifdef ID_MANAGEMENT CFLAGS += -DID_MANAGEMENT diff --git a/PMAP/PMAP.vcxproj b/PMAP/PMAP.vcxproj index f871b09..7f58899 100644 --- a/PMAP/PMAP.vcxproj +++ b/PMAP/PMAP.vcxproj @@ -88,7 +88,7 @@ - + diff --git a/PMAP/main.c b/base/main.c similarity index 97% rename from PMAP/main.c rename to base/main.c index 5516d7e..6cb71b7 100644 --- a/PMAP/main.c +++ b/base/main.c @@ -5,9 +5,9 @@ #include #include "platform.h" -#include "../base/main.h" -#include "../base/mecha.h" -#include "../base/eeprom.h" +#include "main.h" +#include "mecha.h" +#include "eeprom.h" void DisplayRawIdentData(void) { From 2fdf8ee0aaaecdcb0db54aea8bddc7f512831b32 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:16:24 +0200 Subject: [PATCH 12/42] create unified unix structure --- .github/workflows/compilation.yml | 16 ++++++++-------- .gitignore | 2 +- {PMAP-macos => PMAP-unix}/Makefile | 4 ++-- .../platform-unix.c | 0 {PMAP-macos => PMAP-unix}/platform.h | 0 5 files changed, 11 insertions(+), 11 deletions(-) rename {PMAP-macos => PMAP-unix}/Makefile (79%) rename PMAP-macos/platform-macos.c => PMAP-unix/platform-unix.c (100%) rename {PMAP-macos => PMAP-unix}/platform.h (100%) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 88f5411..bf32d2a 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -57,13 +57,13 @@ jobs: - name: Build run: | - cd PMAP-macos + cd PMAP-unix make tar -zcvf PMAP-macos.tar.gz pmap - name: Build id run: | - cd PMAP-macos + cd PMAP-unix make clean make ID_MANAGEMENT=1 tar -zcvf PMAP-macos-id.tar.gz pmap @@ -71,12 +71,12 @@ jobs: - uses: actions/upload-artifact@v3 with: name: PMAP-macos - path: PMAP-macos/PMAP-macos.tar.gz + path: PMAP-unix/PMAP-macos.tar.gz - uses: actions/upload-artifact@v3 with: name: PMAP-macos-id - path: PMAP-macos/PMAP-macos-id.tar.gz + path: PMAP-unix/PMAP-macos-id.tar.gz build-linux: name: PMAP linux compilation @@ -88,13 +88,13 @@ jobs: - name: Build run: | - cd PMAP-macos + cd PMAP-unix make tar -zcvf PMAP-linux.tar.gz pmap - name: Build id run: | - cd PMAP-macos + cd PMAP-unix make clean make ID_MANAGEMENT=1 tar -zcvf PMAP-linux-id.tar.gz pmap @@ -102,9 +102,9 @@ jobs: - uses: actions/upload-artifact@v3 with: name: PMAP-linux - path: PMAP-macos/PMAP-linux.tar.gz + path: PMAP-unix/PMAP-linux.tar.gz - uses: actions/upload-artifact@v3 with: name: PMAP-linux-id - path: PMAP-macos/PMAP-linux-id.tar.gz + path: PMAP-unix/PMAP-linux-id.tar.gz diff --git a/.gitignore b/.gitignore index 261fb14..fc71d71 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ .vs Debug Release -PMAP-macos/pmap +PMAP-unix/pmap PMAP-linux/pmap !.github diff --git a/PMAP-macos/Makefile b/PMAP-unix/Makefile similarity index 79% rename from PMAP-macos/Makefile rename to PMAP-unix/Makefile index 6351798..44ec43a 100644 --- a/PMAP-macos/Makefile +++ b/PMAP-unix/Makefile @@ -2,7 +2,7 @@ VPATH = ./:../base/ ELF = pmap CFLAGS = -O2 -I. -OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-macos.o +OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-unix.o OBJS += main.o # Add -DID_MANAGEMENT when ID_MANAGEMENT is defined ifdef ID_MANAGEMENT @@ -14,4 +14,4 @@ $(ELF): $(OBJS) $(CC) -o $(ELF) $(OBJS) clean: - rm -f $(ELF) $(OBJS) + rm -f $(ELF) $(OBJS) eeprom-id.o id-main.o diff --git a/PMAP-macos/platform-macos.c b/PMAP-unix/platform-unix.c similarity index 100% rename from PMAP-macos/platform-macos.c rename to PMAP-unix/platform-unix.c diff --git a/PMAP-macos/platform.h b/PMAP-unix/platform.h similarity index 100% rename from PMAP-macos/platform.h rename to PMAP-unix/platform.h From ede67e69eac5fb80c6396af843541c7bcc60fbcf Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:34:37 +0200 Subject: [PATCH 13/42] rename win build --- .github/workflows/compilation.yml | 4 ++-- {PMAP => PMAP-wincli}/PMAP.vcxproj | 0 {PMAP => PMAP-wincli}/platform.c | 0 {PMAP => PMAP-wincli}/platform.h | 0 PMAP.sln | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename {PMAP => PMAP-wincli}/PMAP.vcxproj (100%) rename {PMAP => PMAP-wincli}/platform.c (100%) rename {PMAP => PMAP-wincli}/platform.h (100%) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index bf32d2a..11b8683 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -21,12 +21,12 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: PMAP-win + name: PMAP-wincli path: Release/PMAP.exe - uses: actions/upload-artifact@v3 with: - name: PMAP-win.exe + name: PMAP-wingui path: Release/PMAP-win.exe - name: Create release diff --git a/PMAP/PMAP.vcxproj b/PMAP-wincli/PMAP.vcxproj similarity index 100% rename from PMAP/PMAP.vcxproj rename to PMAP-wincli/PMAP.vcxproj diff --git a/PMAP/platform.c b/PMAP-wincli/platform.c similarity index 100% rename from PMAP/platform.c rename to PMAP-wincli/platform.c diff --git a/PMAP/platform.h b/PMAP-wincli/platform.h similarity index 100% rename from PMAP/platform.h rename to PMAP-wincli/platform.h diff --git a/PMAP.sln b/PMAP.sln index 5967546..c21a1c8 100644 --- a/PMAP.sln +++ b/PMAP.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PMAP", "PMAP\PMAP.vcxproj", "{0E04D283-E9CF-4B50-AB74-887A62600457}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PMAP", "PMAP-wincli\PMAP.vcxproj", "{0E04D283-E9CF-4B50-AB74-887A62600457}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PMAP-win", "PMAP-win\PMAP-win.vcxproj", "{3346DB95-2EEB-4496-89B2-F2B9936B075D}" EndProject From 663d11d6ea80dfca882e31e485e894138d94ac9e Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:28:52 +0200 Subject: [PATCH 14/42] rename gui folder --- {PMAP-win => PMAP-wingui}/PMAP-win.vcxproj | 0 {PMAP-win => PMAP-wingui}/dialogs.rc | 0 {PMAP-win => PMAP-wingui}/eeprom-main.c | 0 {PMAP-win => PMAP-wingui}/elect-main.c | 0 {PMAP-win => PMAP-wingui}/id-main.c | 0 {PMAP-win => PMAP-wingui}/mecha-main.c | 0 {PMAP-win => PMAP-wingui}/platform.c | 0 {PMAP-win => PMAP-wingui}/platform.h | 0 {PMAP-win => PMAP-wingui}/resource.h | Bin {PMAP-win => PMAP-wingui}/winmain.c | 0 PMAP.sln | 2 +- 11 files changed, 1 insertion(+), 1 deletion(-) rename {PMAP-win => PMAP-wingui}/PMAP-win.vcxproj (100%) rename {PMAP-win => PMAP-wingui}/dialogs.rc (100%) rename {PMAP-win => PMAP-wingui}/eeprom-main.c (100%) rename {PMAP-win => PMAP-wingui}/elect-main.c (100%) rename {PMAP-win => PMAP-wingui}/id-main.c (100%) rename {PMAP-win => PMAP-wingui}/mecha-main.c (100%) rename {PMAP-win => PMAP-wingui}/platform.c (100%) rename {PMAP-win => PMAP-wingui}/platform.h (100%) rename {PMAP-win => PMAP-wingui}/resource.h (100%) rename {PMAP-win => PMAP-wingui}/winmain.c (100%) diff --git a/PMAP-win/PMAP-win.vcxproj b/PMAP-wingui/PMAP-win.vcxproj similarity index 100% rename from PMAP-win/PMAP-win.vcxproj rename to PMAP-wingui/PMAP-win.vcxproj diff --git a/PMAP-win/dialogs.rc b/PMAP-wingui/dialogs.rc similarity index 100% rename from PMAP-win/dialogs.rc rename to PMAP-wingui/dialogs.rc diff --git a/PMAP-win/eeprom-main.c b/PMAP-wingui/eeprom-main.c similarity index 100% rename from PMAP-win/eeprom-main.c rename to PMAP-wingui/eeprom-main.c diff --git a/PMAP-win/elect-main.c b/PMAP-wingui/elect-main.c similarity index 100% rename from PMAP-win/elect-main.c rename to PMAP-wingui/elect-main.c diff --git a/PMAP-win/id-main.c b/PMAP-wingui/id-main.c similarity index 100% rename from PMAP-win/id-main.c rename to PMAP-wingui/id-main.c diff --git a/PMAP-win/mecha-main.c b/PMAP-wingui/mecha-main.c similarity index 100% rename from PMAP-win/mecha-main.c rename to PMAP-wingui/mecha-main.c diff --git a/PMAP-win/platform.c b/PMAP-wingui/platform.c similarity index 100% rename from PMAP-win/platform.c rename to PMAP-wingui/platform.c diff --git a/PMAP-win/platform.h b/PMAP-wingui/platform.h similarity index 100% rename from PMAP-win/platform.h rename to PMAP-wingui/platform.h diff --git a/PMAP-win/resource.h b/PMAP-wingui/resource.h similarity index 100% rename from PMAP-win/resource.h rename to PMAP-wingui/resource.h diff --git a/PMAP-win/winmain.c b/PMAP-wingui/winmain.c similarity index 100% rename from PMAP-win/winmain.c rename to PMAP-wingui/winmain.c diff --git a/PMAP.sln b/PMAP.sln index c21a1c8..fb84f93 100644 --- a/PMAP.sln +++ b/PMAP.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PMAP", "PMAP-wincli\PMAP.vcxproj", "{0E04D283-E9CF-4B50-AB74-887A62600457}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PMAP-win", "PMAP-win\PMAP-win.vcxproj", "{3346DB95-2EEB-4496-89B2-F2B9936B075D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PMAP-win", "PMAP-wingui\PMAP-win.vcxproj", "{3346DB95-2EEB-4496-89B2-F2B9936B075D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From c83237082339b9083f7a73404655c399f4bb8f42 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:34:34 +0200 Subject: [PATCH 15/42] add com port list for win build --- PMAP-unix/platform-unix.c | 31 +++++++++++++++++++++++--- PMAP-wincli/platform.c | 46 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/PMAP-unix/platform-unix.c b/PMAP-unix/platform-unix.c index d1f376a..f6dd524 100644 --- a/PMAP-unix/platform-unix.c +++ b/PMAP-unix/platform-unix.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "platform.h" #include "../base/mecha.h" @@ -265,10 +266,34 @@ void PlatDPrintf(const char *format, ...) int pstricmp(const char *s1, const char *s2) { - return strcasecmp(s1, s2); + char s1char, s2char; + + for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0'; s1++, s2++, s1char = *s1, s2char = *s2) + { + if (isalpha(s1char)) + s1char = toupper(s1char); + if (isalpha(s2char)) + s2char = toupper(s2char); + if (s1char != s2char) + break; + } + + return (s1char - s2char); } -int pstrincmp(const char *s1, const char *s2, int n) +int pstrincmp(const char *s1, const char *s2, int len) { - return strncasecmp(s1, s2, (size_t)n); + char s1char, s2char; + + for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0' && len > 0; s1++, s2++, s1char = *s1, s2char = *s2, len--) + { + if (isalpha(s1char)) + s1char = toupper(s1char); + if (isalpha(s2char)) + s2char = toupper(s2char); + if (s1char != s2char) + break; + } + + return ((len == 0) ? 0 : s1char - s2char); } diff --git a/PMAP-wincli/platform.c b/PMAP-wincli/platform.c index 56b6cef..bd48766 100644 --- a/PMAP-wincli/platform.c +++ b/PMAP-wincli/platform.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "platform.h" #include "mecha.h" @@ -12,8 +13,30 @@ static HANDLE ComPortHandle = INVALID_HANDLE_VALUE; static unsigned short RxTimeout; static FILE *DebugOutputFile = NULL; +void ListSerialDevices() +{ + WIN32_FIND_DATA findFileData; + HANDLE hFind = FindFirstFile("COM*", &findFileData); + + if (hFind == INVALID_HANDLE_VALUE) + { + printf("No COM ports found.\n"); + return; + } + + printf("Available serial devices:\n"); + + do + { + printf("COM%s\n", findFileData.cFileName); + } while (FindNextFile(hFind, &findFileData) != 0); + + FindClose(hFind); +} + int PlatOpenCOMPort(const char *device) { + ListSerialDevices(); COMMTIMEOUTS CommTimeout; DCB DeviceControlBlock; int result; @@ -45,6 +68,9 @@ int PlatOpenCOMPort(const char *device) else result = EMFILE; + if (result != 0) + PlatCloseCOMPort(); + return result; } @@ -81,13 +107,27 @@ int PlatWriteCOMPort(const char *data) else result = -EIO; + if (result < 0) + { + printf("Write to COM port failed.\n"); + } + return result; } void PlatCloseCOMPort(void) { - CloseHandle(ComPortHandle); - ComPortHandle = INVALID_HANDLE_VALUE; + if (ComPortHandle != INVALID_HANDLE_VALUE) + { + printf("Closing COM port...\n"); + CloseHandle(ComPortHandle); + ComPortHandle = INVALID_HANDLE_VALUE; + printf("COM port closed.\n"); + } + else + { + printf("COM port is already closed.\n"); + } } void PlatSleep(unsigned short int msec) @@ -149,7 +189,7 @@ void PlatDebugInit(void) // Create the filename with timestamp char filename[256]; // Adjust the size according to your needs - sprintf(filename, "pmap_%s.log", timestamp); + snprintf(filename, sizeof(filename), "pmap_%s.log", timestamp); DebugOutputFile = fopen(filename, "w"); } From 119af77eaccc991652192ea8ff1c030d2218914c Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:51:14 +0200 Subject: [PATCH 16/42] warning fix --- PMAP-wincli/platform.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PMAP-wincli/platform.c b/PMAP-wincli/platform.c index bd48766..2b73564 100644 --- a/PMAP-wincli/platform.c +++ b/PMAP-wincli/platform.c @@ -16,7 +16,7 @@ static FILE *DebugOutputFile = NULL; void ListSerialDevices() { WIN32_FIND_DATA findFileData; - HANDLE hFind = FindFirstFile("COM*", &findFileData); + HANDLE hFind = FindFirstFile(L"COM*", &findFileData); // Use the wide-character version of FindFirstFile if (hFind == INVALID_HANDLE_VALUE) { @@ -28,7 +28,9 @@ void ListSerialDevices() do { - printf("COM%s\n", findFileData.cFileName); + char comPortName[MAX_PATH]; + WideCharToMultiByte(CP_ACP, 0, findFileData.cFileName, -1, comPortName, sizeof(comPortName), NULL, NULL); // Convert from wide to ANSI/ASCII + printf("COM%s\n", comPortName); } while (FindNextFile(hFind, &findFileData) != 0); FindClose(hFind); From e883701ae2058065a8287aa7a8e14768033237e8 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:44:59 +0200 Subject: [PATCH 17/42] more unified codebase --- PMAP-linux/platform.h | 19 ------------------- PMAP-unix/platform-unix.c | 3 +-- PMAP-wincli/PMAP.vcxproj | 4 ++-- PMAP-wincli/{platform.c => platform-win.c} | 0 PMAP-wincli/platform.h | 20 -------------------- PMAP-wingui/PMAP-win.vcxproj | 2 +- {PMAP-unix => base}/platform.h | 0 7 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 PMAP-linux/platform.h rename PMAP-wincli/{platform.c => platform-win.c} (100%) delete mode 100644 PMAP-wincli/platform.h rename {PMAP-unix => base}/platform.h (100%) diff --git a/PMAP-linux/platform.h b/PMAP-linux/platform.h deleted file mode 100644 index ea1b00c..0000000 --- a/PMAP-linux/platform.h +++ /dev/null @@ -1,19 +0,0 @@ -typedef unsigned char u8; -typedef unsigned short int u16; -typedef unsigned int u32; - -int PlatOpenCOMPort(const char *device); -int PlatReadCOMPort(char *data, int n, unsigned short timeout); -int PlatWriteCOMPort(const char *data); -void PlatCloseCOMPort(void); -void PlatSleep(unsigned short int msec); -void PlatShowEMessage(const char *format, ...); -// Block until the user acknowledges. -// void PlatShowMessage(const char *format, ...); -#define PlatShowMessage PlatShowEMessage -#define PlatDPrintf PlatShowEMessage -void PlatShowMessageB(const char *format, ...); - -// If necessary, provide these functions, otherwise define them to their equivalents -int pstricmp(const char *s1, const char *s2); -int pstrincmp(const char *s1, const char *s2, int len); diff --git a/PMAP-unix/platform-unix.c b/PMAP-unix/platform-unix.c index f6dd524..7c52c28 100644 --- a/PMAP-unix/platform-unix.c +++ b/PMAP-unix/platform-unix.c @@ -11,7 +11,7 @@ #include #include -#include "platform.h" +#include "../base/platform.h" #include "../base/mecha.h" static int ComPortHandle = -1; @@ -180,7 +180,6 @@ void PlatCloseCOMPort(void) } } - void PlatSleep(unsigned short int msec) { usleep((useconds_t)msec * 1000); diff --git a/PMAP-wincli/PMAP.vcxproj b/PMAP-wincli/PMAP.vcxproj index 7f58899..9b53b4d 100644 --- a/PMAP-wincli/PMAP.vcxproj +++ b/PMAP-wincli/PMAP.vcxproj @@ -89,7 +89,7 @@ - + @@ -99,7 +99,7 @@ - + diff --git a/PMAP-wincli/platform.c b/PMAP-wincli/platform-win.c similarity index 100% rename from PMAP-wincli/platform.c rename to PMAP-wincli/platform-win.c diff --git a/PMAP-wincli/platform.h b/PMAP-wincli/platform.h deleted file mode 100644 index b82cacf..0000000 --- a/PMAP-wincli/platform.h +++ /dev/null @@ -1,20 +0,0 @@ -typedef unsigned char u8; -typedef unsigned short int u16; -typedef unsigned int u32; - -int PlatOpenCOMPort(const char *device); -int PlatReadCOMPort(char *data, int n, unsigned short timeout); -int PlatWriteCOMPort(const char *data); -void PlatCloseCOMPort(void); -void PlatSleep(unsigned short int msec); -void PlatShowEMessage(const char *format, ...); -void PlatShowMessage(const char *format, ...); -void PlatShowMessageB(const char *format, ...); - -void PlatDebugInit(void); -void PlatDebugDeinit(void); -void PlatDPrintf(const char *format, ...); - -// If necessary, provide these functions, otherwise define them to their equivalents -int pstricmp(const char *s1, const char *s2); -int pstrincmp(const char *s1, const char *s2, int len); diff --git a/PMAP-wingui/PMAP-win.vcxproj b/PMAP-wingui/PMAP-win.vcxproj index 7f1a7f7..4d7e886 100644 --- a/PMAP-wingui/PMAP-win.vcxproj +++ b/PMAP-wingui/PMAP-win.vcxproj @@ -94,7 +94,7 @@ - + diff --git a/PMAP-unix/platform.h b/base/platform.h similarity index 100% rename from PMAP-unix/platform.h rename to base/platform.h From 41e5005bcc63a16204bd14b0ba59b70ef627f202 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:57:08 +0200 Subject: [PATCH 18/42] fix win gui build --- PMAP-wingui/PMAP-win.vcxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PMAP-wingui/PMAP-win.vcxproj b/PMAP-wingui/PMAP-win.vcxproj index 4d7e886..c2aef7a 100644 --- a/PMAP-wingui/PMAP-win.vcxproj +++ b/PMAP-wingui/PMAP-win.vcxproj @@ -52,7 +52,7 @@ Level3 Disabled WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\base;.; + ..\PMAP-wincli;..\base;.; Windows @@ -68,7 +68,7 @@ true true WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\base;.; + ..\PMAP-wincli;..\base;.; Windows @@ -85,7 +85,7 @@ - + From bf289b4a0a40ce11692a8f20942f02efa842f4a2 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:05:44 +0200 Subject: [PATCH 19/42] fix com port list --- PMAP-wincli/platform-win.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/PMAP-wincli/platform-win.c b/PMAP-wincli/platform-win.c index 2b73564..89de6d0 100644 --- a/PMAP-wincli/platform-win.c +++ b/PMAP-wincli/platform-win.c @@ -15,25 +15,24 @@ static FILE *DebugOutputFile = NULL; void ListSerialDevices() { - WIN32_FIND_DATA findFileData; - HANDLE hFind = FindFirstFile(L"COM*", &findFileData); // Use the wide-character version of FindFirstFile + int portNum = 0; + char portName[8]; - if (hFind == INVALID_HANDLE_VALUE) + // Loop through COM ports (COM1 to COM256) + for (portNum = 1; portNum <= 256; portNum++) { - printf("No COM ports found.\n"); - return; - } - - printf("Available serial devices:\n"); + sprintf(portName, "COM%d", portNum); - do - { - char comPortName[MAX_PATH]; - WideCharToMultiByte(CP_ACP, 0, findFileData.cFileName, -1, comPortName, sizeof(comPortName), NULL, NULL); // Convert from wide to ANSI/ASCII - printf("COM%s\n", comPortName); - } while (FindNextFile(hFind, &findFileData) != 0); + // Attempt to open the COM port + HANDLE hPort = CreateFile(portName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); - FindClose(hFind); + if (hPort != INVALID_HANDLE_VALUE) + { + // The port exists, so print its name + printf("Found COM Port: %s\n", portName); + CloseHandle(hPort); + } + } } int PlatOpenCOMPort(const char *device) From c2b638ba5698535a570e09d432fd4f534e621d52 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:13:41 +0200 Subject: [PATCH 20/42] attempt 2 to fix com port listing --- PMAP-wincli/platform-win.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/PMAP-wincli/platform-win.c b/PMAP-wincli/platform-win.c index 89de6d0..dbd065b 100644 --- a/PMAP-wincli/platform-win.c +++ b/PMAP-wincli/platform-win.c @@ -15,22 +15,18 @@ static FILE *DebugOutputFile = NULL; void ListSerialDevices() { - int portNum = 0; - char portName[8]; + char targetPath[256]; + char dosDeviceName[256]; + char comPortName[] = "COM"; - // Loop through COM ports (COM1 to COM256) - for (portNum = 1; portNum <= 256; portNum++) + for (int portNum = 1; portNum <= 256; portNum++) { - sprintf(portName, "COM%d", portNum); + sprintf(dosDeviceName, "%s%d", comPortName, portNum); - // Attempt to open the COM port - HANDLE hPort = CreateFile(portName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); - - if (hPort != INVALID_HANDLE_VALUE) + if (QueryDosDevice(dosDeviceName, targetPath, sizeof(targetPath)) != 0) { - // The port exists, so print its name - printf("Found COM Port: %s\n", portName); - CloseHandle(hPort); + printf("Found COM Port: %s\n", dosDeviceName); + printf("Target Path: %s\n", targetPath); } } } From dc135a9df8be58128f329de9be8028d48dd83cb5 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:08:43 +0200 Subject: [PATCH 21/42] Somu gui improvements --- PMAP-wingui/dialogs.rc | 72 +++++++++++++++++++++--------------------- PMAP-wingui/winmain.c | 4 +-- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/PMAP-wingui/dialogs.rc b/PMAP-wingui/dialogs.rc index 1772049..7dc6ced 100644 --- a/PMAP-wingui/dialogs.rc +++ b/PMAP-wingui/dialogs.rc @@ -58,42 +58,42 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "PMAP" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Connect",IDC_BUTTON_CONNECT,312,27,50,14 - PUSHBUTTON "Disconnect",IDC_BUTTON_DISCONNECT,312,44,50,14,WS_DISABLED - COMBOBOX IDC_COMBO_PORT,259,28,48,98,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Port",IDC_STATIC_CONN,249,16,120,48 - GROUPBOX "Console Information",IDC_STATIC_INFO,22,16,238,99 - PUSHBUTTON "Mechanism Adjustment",IDC_BUTTON_MECHA_ADJ,172,119,68,32,BS_MULTILINE | WS_DISABLED - PUSHBUTTON "EEPROM Management",IDC_BUTTON_EEP_MAN,28,119,68,32,BS_MULTILINE | WS_DISABLED - PUSHBUTTON "Electrical Adjustment",IDC_BUTTON_ELECT_ADJ,100,119,68,32,BS_MULTILINE | WS_DISABLED - LTEXT "PMAP",IDC_STATIC_VERSION,135,157,102,8 + GROUPBOX "Console Information",IDC_STATIC_INFO,22,16,218,99 LTEXT "Model name:",IDC_STATIC_LBL_MODEL_NAME,31,30,42,8 - LTEXT "Unknown",IDC_STATIC_MODEL_NAME,85,31,30,8 - LTEXT "Serial:",IDC_STATIC_LBL_SERIAL,142,58,21,8 - LTEXT "Unknown",IDC_STATIC_SERIAL,192,58,30,8 - LTEXT "OP type:",IDC_STATIC_LBL_OP_TYPE,31,67,30,8 - LTEXT "Unknown",IDC_STATIC_OP_TYPE,85,67,30,8 - LTEXT "Lens type:",IDC_STATIC_LBL_LENS_TYPE,31,80,35,8 - LTEXT "Unknown",IDC_STATIC_LENS_TYPE,85,80,30,8 - LTEXT "EMCS ID:",IDC_STATIC_LBL_EMCS_ID,142,81,31,8 - LTEXT "Unknown",IDC_STATIC_EMCS_ID,192,81,30,8 + LTEXT "Unknown",IDC_STATIC_MODEL_NAME,85,30,40,8 LTEXT "MECHACON:",IDC_STATIC_LBL_MECHACON,31,42,42,8 - LTEXT "Unknown",IDC_STATIC_MECHACON,85,42,30,8 + LTEXT "Unknown",IDC_STATIC_MECHACON,85,42,40,8 + LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,31,54,39,8 + LTEXT "Unknown",IDC_STATIC_MD_VER,85,54,40,8 + LTEXT "OP type:",IDC_STATIC_LBL_OP_TYPE,31,67,40,8 + LTEXT "Unknown",IDC_STATIC_OP_TYPE,85,67,40,8 + LTEXT "Lens type:",IDC_STATIC_LBL_LENS_TYPE,31,80,35,8 + LTEXT "Unknown",IDC_STATIC_LENS_TYPE,85,80,40,8 LTEXT "RTC type:",IDC_STATIC_LBL_RTC_TYPE,31,94,34,8 - LTEXT "Unknown",IDC_STATIC_RTC_TYPE,85,94,30,8 + LTEXT "Unknown",IDC_STATIC_RTC_TYPE,85,94,40,8 + LTEXT "Unknown",IDC_STATIC_CEXDEX,192,32,40,8 PUSHBUTTON "ID Management",IDC_BUTTON_ID_MAN,139,41,80,14,WS_DISABLED - LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,31,54,39,8 - LTEXT "Unknown",IDC_STATIC_MD_VER,85,54,30,8 - PUSHBUTTON "Show MECHA Version",IDC_BUTTON_SHOW_VER,29,154,102,14,WS_DISABLED + LTEXT "Serial:",IDC_STATIC_LBL_SERIAL,142,58,21,8 + LTEXT "Unknown",IDC_STATIC_SERIAL,192,58,40,8 + LTEXT "MODEL ID:",IDC_STATIC_LBL_MODELID,142,70,36,8 + LTEXT "Unknown",IDC_STATIC_MODEL_ID,192,70,40,8 + LTEXT "EMCS ID:",IDC_STATIC_LBL_EMCS_ID,142,81,31,8 + LTEXT "Unknown",IDC_STATIC_EMCS_ID,192,81,40,8 LTEXT "TV System:",IDC_STATIC_LBL_TV_SYS,142,94,37,8 - LTEXT "Unknown",IDC_STATIC_TV_SYS,192,94,30,8 + LTEXT "Unknown",IDC_STATIC_TV_SYS,192,94,40,8 + PUSHBUTTON "EEPROM Management",IDC_BUTTON_EEP_MAN,28,119,68,32,BS_MULTILINE | WS_DISABLED + PUSHBUTTON "Electrical Adjustment",IDC_BUTTON_ELECT_ADJ,100,119,68,32,BS_MULTILINE | WS_DISABLED + PUSHBUTTON "Mechanism Adjustment",IDC_BUTTON_MECHA_ADJ,172,119,68,32,BS_MULTILINE | WS_DISABLED + PUSHBUTTON "Show MECHA Version",IDC_BUTTON_SHOW_VER,28,154,102,14,WS_DISABLED + LTEXT "PMAP",IDC_STATIC_VERSION,135,157,102,8 + GROUPBOX "Port",IDC_STATIC_CONN,249,16,120,48 + COMBOBOX IDC_COMBO_PORT,259,28,48,98,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "Connect",IDC_BUTTON_CONNECT,312,27,50,14 + PUSHBUTTON "Disconnect",IDC_BUTTON_DISCONNECT,312,44,50,14,WS_DISABLED GROUPBOX "Status",IDC_STATIC_STATUS,249,67,121,101 CONTROL "Checksum Error",IDC_CHECK_CHKSUM_ERR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,258,78,66,10 CONTROL "RTC Battery Low",IDC_CHECK_RTC_LOW_BATT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,258,89,70,10 CONTROL "RTC No Battery",IDC_CHECK_RTC_NO_BATT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,258,101,66,10 - LTEXT "MODEL ID:",IDC_STATIC_LBL_MODELID,142,70,36,8 - LTEXT "Unknown",IDC_STATIC_MODEL_ID,192,70,30,8 - LTEXT "Unknown",IDC_STATIC_CEXDEX,141,32,30,8 END IDD_DIALOG_EEP_MAN DIALOGEX 0, 0, 434, 183 @@ -269,15 +269,15 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Console Version" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,131,30,50,14 - LTEXT "CFC:",IDC_STATIC_LBL_CFC,25,23,17,8 - LTEXT "CFD:",IDC_STATIC_LBL_CFD,25,33,17,8 - LTEXT "ADD0x010:",IDC_STATIC_LBL_CON_VER,25,44,38,8 - LTEXT "Unknown",IDC_STATIC_CFC,75,23,30,8 - LTEXT "Unknown",IDC_STATIC_CFD,75,34,30,8 - LTEXT "Unknown",IDC_STATIC_CON_VER,75,45,30,8 - LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,25,13,39,8 - LTEXT "Unknown",IDC_STATIC_MD_VER,75,13,30,8 + LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,25,11,39,8 + LTEXT "Unknown",IDC_STATIC_MD_VER,75,11,50,8 + LTEXT "CFC:",IDC_STATIC_LBL_CFC,25,22,39,8 + LTEXT "Unknown",IDC_STATIC_CFC,75,22,50,8 + LTEXT "CFD:",IDC_STATIC_LBL_CFD,25,33,39,8 + LTEXT "Unknown",IDC_STATIC_CFD,75,33,50,8 + LTEXT "ADD0x010:",IDC_STATIC_LBL_CON_VER,25,44,39,8 + LTEXT "Unknown",IDC_STATIC_CON_VER,75,44,50,8 + // DEFPUSHBUTTON "OK",IDOK,131,30,50,14 END IDD_DIALOG_INIT_MECHA DIALOGEX 0, 0, 295, 181 diff --git a/PMAP-wingui/winmain.c b/PMAP-wingui/winmain.c index bb7bb9a..aa79b7e 100644 --- a/PMAP-wingui/winmain.c +++ b/PMAP-wingui/winmain.c @@ -235,11 +235,11 @@ static INT_PTR CALLBACK MainDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDC_BUTTON_ELECT_ADJ: MenuELECT(); break; -#ifdef ID_MANAGEMENT + // #ifdef ID_MANAGEMENT case IDC_BUTTON_ID_MAN: MenuID(); break; -#endif + // #endif case IDC_BUTTON_SHOW_VER: DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_CON_VER), hwndDlg, &ShowRawConVerInfoDlg); break; From 8d3ecac620865853cd6f76b7b0d43af9cae7b5e3 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:22:45 +0200 Subject: [PATCH 22/42] ffix ID gui --- PMAP-wingui/PMAP-win.vcxproj | 5 +- PMAP-wingui/platform.c | 188 ----------------------------------- PMAP-wingui/platform.h | 21 ---- 3 files changed, 4 insertions(+), 210 deletions(-) delete mode 100644 PMAP-wingui/platform.c delete mode 100644 PMAP-wingui/platform.h diff --git a/PMAP-wingui/PMAP-win.vcxproj b/PMAP-wingui/PMAP-win.vcxproj index c2aef7a..0b22965 100644 --- a/PMAP-wingui/PMAP-win.vcxproj +++ b/PMAP-wingui/PMAP-win.vcxproj @@ -82,18 +82,21 @@ + + + - + diff --git a/PMAP-wingui/platform.c b/PMAP-wingui/platform.c deleted file mode 100644 index e46a5b6..0000000 --- a/PMAP-wingui/platform.c +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include -#include -#include -#include - -#include "platform.h" -#include "mecha.h" - -extern HWND g_mainWin; - -static HANDLE ComPortHandle = INVALID_HANDLE_VALUE; -static unsigned short RxTimeout; -static FILE *DebugOutputFile = NULL; - -int PlatOpenCOMPort(const char *device) -{ - COMMTIMEOUTS CommTimeout; - DCB DeviceControlBlock; - int result; - - if (ComPortHandle == INVALID_HANDLE_VALUE) - { - if ((ComPortHandle = CreateFileA(device, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) - { - memset(&DeviceControlBlock, 0, sizeof(DeviceControlBlock)); - DeviceControlBlock.DCBlength = sizeof(DCB); - GetCommState(ComPortHandle, &DeviceControlBlock); - DeviceControlBlock.BaudRate = CBR_57600; - DeviceControlBlock.ByteSize = 8; - DeviceControlBlock.fParity = FALSE; - DeviceControlBlock.StopBits = ONESTOPBIT; - SetCommState(ComPortHandle, &DeviceControlBlock); - CommTimeout.ReadIntervalTimeout = 0; - CommTimeout.ReadTotalTimeoutMultiplier = 0; - CommTimeout.ReadTotalTimeoutConstant = RxTimeout = MECHA_TASK_NORMAL_TO; - CommTimeout.WriteTotalTimeoutConstant = 0; - CommTimeout.WriteTotalTimeoutMultiplier = 0; - SetCommTimeouts(ComPortHandle, &CommTimeout); - PurgeComm(ComPortHandle, PURGE_RXCLEAR | PURGE_TXCLEAR); - result = 0; - } - else - result = ENXIO; - } - else - result = EMFILE; - - return result; -} - -int PlatReadCOMPort(char *data, int n, unsigned short timeout) -{ - COMMTIMEOUTS CommTimeout; - DWORD BytesRead; - int result; - - if (RxTimeout != timeout) - { - CommTimeout.ReadIntervalTimeout = 0; - CommTimeout.ReadTotalTimeoutMultiplier = 0; - CommTimeout.ReadTotalTimeoutConstant = RxTimeout = timeout; - CommTimeout.WriteTotalTimeoutConstant = 0; - CommTimeout.WriteTotalTimeoutMultiplier = 0; - SetCommTimeouts(ComPortHandle, &CommTimeout); - } - if (ReadFile(ComPortHandle, data, n, &BytesRead, NULL) == TRUE) - result = BytesRead; - else - result = -EIO; - - return result; -} - -int PlatWriteCOMPort(const char *data) -{ - DWORD BytesWritten; - int result; - - if (WriteFile(ComPortHandle, data, strlen(data), &BytesWritten, NULL) == TRUE) - result = BytesWritten; - else - result = -EIO; - - return result; -} - -void PlatCloseCOMPort(void) -{ - CloseHandle(ComPortHandle); - ComPortHandle = INVALID_HANDLE_VALUE; -} - -void PlatSleep(unsigned short int msec) -{ - Sleep(msec); -} - -void PlatShowEMessage(const char *format, ...) -{ - char buffer[256]; - va_list args; - - va_start(args, format); - vsnprintf(buffer, sizeof(buffer), format, args); - if (DebugOutputFile != NULL) - vfprintf(DebugOutputFile, format, args); - - MessageBoxA(g_mainWin, buffer, - "Error", - MB_OK | MB_ICONERROR); - - va_end(args); -} - -void PlatShowMessage(const char *format, ...) -{ - char buffer[256]; - va_list args; - - va_start(args, format); - vsnprintf(buffer, sizeof(buffer), format, args); - if (DebugOutputFile != NULL) - vfprintf(DebugOutputFile, format, args); - - MessageBoxA(g_mainWin, buffer, - "Information", - MB_OK | MB_ICONINFORMATION); - va_end(args); -} - -void PlatDebugInit(void) -{ - DebugOutputFile = fopen("pmap.log", "w"); -} - -void PlatDebugDeinit(void) -{ - if (DebugOutputFile != NULL) - { - fclose(DebugOutputFile); - DebugOutputFile = NULL; - } -} - -void PlatDPrintf(const char *format, ...) -{ - va_list args; - - va_start(args, format); - if (DebugOutputFile != NULL) - vfprintf(DebugOutputFile, format, args); - va_end(args); -} - -int pstricmp(const char *s1, const char *s2) -{ - char s1char, s2char; - - for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0'; s1++, s2++, s1char = *s1, s2char = *s2) - { - if (isalpha(s1char)) - s1char = toupper(s1char); - if (isalpha(s2char)) - s2char = toupper(s2char); - if (s1char != s2char) - break; - } - - return (s1char - s2char); -} - -int pstrincmp(const char *s1, const char *s2, int len) -{ - char s1char, s2char; - - for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0' && len > 0; s1++, s2++, s1char = *s1, s2char = *s2, len--) - { - if (isalpha(s1char)) - s1char = toupper(s1char); - if (isalpha(s2char)) - s2char = toupper(s2char); - if (s1char != s2char) - break; - } - - return ((len == 0) ? 0 : s1char - s2char); -} diff --git a/PMAP-wingui/platform.h b/PMAP-wingui/platform.h deleted file mode 100644 index e20e254..0000000 --- a/PMAP-wingui/platform.h +++ /dev/null @@ -1,21 +0,0 @@ -typedef unsigned char u8; -typedef unsigned short int u16; -typedef unsigned int u32; - -int PlatOpenCOMPort(const char *device); -int PlatReadCOMPort(char *data, int n, unsigned short timeout); -int PlatWriteCOMPort(const char *data); -void PlatCloseCOMPort(void); -void PlatSleep(unsigned short int msec); -void PlatShowEMessage(const char *format, ...); -void PlatShowMessage(const char *format, ...); -// void PlatShowMessageB(const char *format, ...); -#define PlatShowMessageB PlatShowMessage - -void PlatDebugInit(void); -void PlatDebugDeinit(void); -void PlatDPrintf(const char *format, ...); - -// If necessary, provide these functions, otherwise define them to their equivalents -int pstricmp(const char *s1, const char *s2); -int pstrincmp(const char *s1, const char *s2, int len); From db4db6ca6b1d2ae3e1b2a620837bded13bbf75a5 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:40:41 +0200 Subject: [PATCH 23/42] Csome fixes --- PMAP-wincli/PMAP.vcxproj | 8 ++++---- PMAP-wingui/PMAP-win.vcxproj | 6 +++--- PMAP-wingui/winmain.c | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/PMAP-wincli/PMAP.vcxproj b/PMAP-wincli/PMAP.vcxproj index 9b53b4d..8cba406 100644 --- a/PMAP-wincli/PMAP.vcxproj +++ b/PMAP-wincli/PMAP.vcxproj @@ -78,23 +78,23 @@ - - - + + + + - diff --git a/PMAP-wingui/PMAP-win.vcxproj b/PMAP-wingui/PMAP-win.vcxproj index 0b22965..f272db9 100644 --- a/PMAP-wingui/PMAP-win.vcxproj +++ b/PMAP-wingui/PMAP-win.vcxproj @@ -51,7 +51,7 @@ Level3 Disabled - WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ID_MANAGEMENT=1;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) ..\PMAP-wincli;..\base;.; @@ -67,7 +67,7 @@ MaxSpeed true true - WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ID_MANAGEMENT=1;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) ..\PMAP-wincli;..\base;.; @@ -96,7 +96,7 @@ - + diff --git a/PMAP-wingui/winmain.c b/PMAP-wingui/winmain.c index aa79b7e..ca55b19 100644 --- a/PMAP-wingui/winmain.c +++ b/PMAP-wingui/winmain.c @@ -9,6 +9,7 @@ #include "main.h" #include "mecha.h" #include "eeprom.h" +#include "eeprom-id.h" #include "resource.h" HINSTANCE g_hInstance; @@ -235,11 +236,11 @@ static INT_PTR CALLBACK MainDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDC_BUTTON_ELECT_ADJ: MenuELECT(); break; - // #ifdef ID_MANAGEMENT +#ifdef ID_MANAGEMENT case IDC_BUTTON_ID_MAN: MenuID(); break; - // #endif +#endif case IDC_BUTTON_SHOW_VER: DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_CON_VER), hwndDlg, &ShowRawConVerInfoDlg); break; From 188de671f11ae672aa2c3f844e8498f5c61a6ef0 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:46:42 +0200 Subject: [PATCH 24/42] Minimal changes --- PMAP-wingui/eeprom-main.c | 4 ++-- PMAP-wingui/elect-main.c | 9 +++++---- PMAP-wingui/id-main.c | 34 +++++++++++++++++++--------------- base/eeprom-main.c | 6 +++--- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/PMAP-wingui/eeprom-main.c b/PMAP-wingui/eeprom-main.c index f13a907..1cfd944 100644 --- a/PMAP-wingui/eeprom-main.c +++ b/PMAP-wingui/eeprom-main.c @@ -46,13 +46,13 @@ static void InitWindow(HWND hwnd) L"D-chassis (SCPH-300xx/SCPH-350xx)", L"F-chassis (SCPH-30000/SCPH-300xx R)", L"G-chassis (SCPH-390xx)", - L"H-chassis (SCPH-500xx)", + L"Dragon (SCPH-5x0xx--SCPH-900xx)", L"A-chassis (DTL-H10000)", // A L"A-chassis (DTL-T10000H)", // A2 L"A-chassis (DTL-T10000)", // A3 L"B-chassis (DTL-H30001/2 with Auto-Tilt motor)", L"D-chassis (DTL-H30x0x)", - L"H-chassis (DTL-H500xx)", + L"Dragon (DTL-5x0xx--DTL-900xx)", NULL}; combo = GetDlgItem(hwnd, IDC_CMB_CHASSIS); diff --git a/PMAP-wingui/elect-main.c b/PMAP-wingui/elect-main.c index 8c4cb15..10a9597 100644 --- a/PMAP-wingui/elect-main.c +++ b/PMAP-wingui/elect-main.c @@ -14,7 +14,7 @@ extern HINSTANCE g_hInstance; extern HWND g_mainWin; -extern unsigned char ElectConIsT10K, ConType; +extern unsigned char ElectConIsT10K, ConType, ConSlim; static void ToggleMainDialogControls(HWND hwnd, BOOL enabled) { @@ -54,7 +54,10 @@ static void InitWindow(HWND hwnd) SetWindowText(GetDlgItem(hwnd, IDC_ELECT_MECHACON), L"G: CXP103049 x.3.8.0"); break; case MECHA_TYPE_40: - SetWindowText(GetDlgItem(hwnd, IDC_ELECT_MECHACON), L"Dragons"); + if (ConSlim) + SetWindowText(GetDlgItem(hwnd, IDC_ELECT_MECHACON), L"Slims"); + else + SetWindowText(GetDlgItem(hwnd, IDC_ELECT_MECHACON), L"H,I,J,X: CXR706080"); break; default: SetWindowText(GetDlgItem(hwnd, IDC_ELECT_MECHACON), L"Unknown"); @@ -81,9 +84,7 @@ static INT_PTR CALLBACK ElectDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM { case IDC_BTN_START: if (IsChassisDexA()) - { ElectConIsT10K = (IsDlgButtonChecked(hwndDlg, IDC_CHK_T10K) == BST_CHECKED); - } else ElectConIsT10K = 0; ToggleMainDialogControls(hwndDlg, FALSE); diff --git a/PMAP-wingui/id-main.c b/PMAP-wingui/id-main.c index 794de55..bb35650 100644 --- a/PMAP-wingui/id-main.c +++ b/PMAP-wingui/id-main.c @@ -16,7 +16,7 @@ extern HWND g_mainWin; extern unsigned char ConType, ConCEXDEX; -static void InitMechacon(void) +/* static void InitMechacon(void) { int choice, done, dex, NumChoices; @@ -59,18 +59,20 @@ static void InitMechacon(void) if (!dex) { printf("Select model Name:\n" - "\t1. SCPH-50000\n" - "\t2. SCPH-50001\n" - "\t3. SCPH-50002\n" - "\t4. SCPH-50003\n" - "\t5. SCPH-50004\n" - "\t6. SCPH-50005\n" - "\t7. SCPH-50006\n" - "\t8. SCPH-50007\n" - "\t9. SCPH-50008\n" - "\t10. SCPH-50009\n" - "\t11. SCPH-50010\n" - "\t12. Quit\n" + "\t1. SCPH-xx000 (Japan)\n" + "\t2. SCPH-xx001 (USA)\n" + "\t3. SCPH-xx002 (Australia)\n" + "\t4. SCPH-xx003 (Great Britian)\n" + "\t5. SCPH-xx004 (Europe)\n" + "\t6. SCPH-xx005 (Korea)\n" + "\t7. SCPH-xx006 (Hong Kong)\n" + "\t8. SCPH-xx007 (Taiwan)\n" + "\t9. SCPH-xx008 (Russia)\n" + "\t10. SCPH-50009 (China)\n" + "\t11. SCPH-xx010 (SCPH-50010: Canada, Slims: Mexico)\n" + "\t12. SCPH-x0011 (SCPH-50011: Mexico, SCPH-70011: USA)\n" + "\t13. SCPH-70012 (Canada)\n" + "\t14. Quit\n" "Your choice: "); NumChoices = 12; } @@ -109,9 +111,11 @@ static void InitMechacon(void) case 9: case 10: case 11: + case 12: + case 13: printf("MechaInit: %s\n", MechaInitMechacon(choice, 0) == 0 ? "done" : "failed"); break; - case 12: + case 14: done = 1; } } @@ -166,7 +170,7 @@ static void InitNTSCPALDefaults(void) printf("Init PAL defaults: %s\n", EEPROMNTSCPALDefaults(1) == 0 ? "completed" : "failed"); break; } -} +} */ static INT_PTR CALLBACK InitNTSCPALDefsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { diff --git a/base/eeprom-main.c b/base/eeprom-main.c index 0261bb1..7648797 100644 --- a/base/eeprom-main.c +++ b/base/eeprom-main.c @@ -263,13 +263,13 @@ static int SelectChassis(void) {&IsChassisD, "D-chassis (SCPH-300xx/SCPH-350xx)"}, {&IsChassisF, "F-chassis (SCPH-30000/SCPH-300xx R)"}, {&IsChassisG, "G-chassis (SCPH-390xx)"}, - {&IsChassisDragon, "Dragon (SCPH-500xx--SCPH-900xx)"}, + {&IsChassisDragon, "Dragon (SCPH-5x0xx--SCPH-900xx)"}, {&IsChassisDexA, "A-chassis (DTL-H10000)"}, // A {&IsChassisDexA, "A-chassis (DTL-T10000H)"}, // A2 {&IsChassisDexA, "A-chassis (DTL-T10000)"}, // A3 {&IsChassisDexB, "B-chassis (DTL-H30001/2 with Auto-Tilt motor)"}, - {&IsChassisDexD, "D-chassis (DTL-H30000)"}, - {&IsChassisDragon, "Dragon (DTL-500xx--DTL-900xx)"}}; + {&IsChassisDexD, "D-chassis (DTL-H30x0x)"}, + {&IsChassisDragon, "Dragon (DTL-5x0xx--DTL-900xx)"}}; int SelectCount, LastSelectIndex, i, choice; DisplayCommonConsoleInfo(); From 392cd4b4b8463a422d880cee108ed387beee4b77 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Thu, 2 Nov 2023 21:25:44 +0200 Subject: [PATCH 25/42] GUI: fix aligment and cfd/cfc --- PMAP-wingui/dialogs.rc | 50 +++++++++++++++++++++--------------------- PMAP-wingui/winmain.c | 8 +++---- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/PMAP-wingui/dialogs.rc b/PMAP-wingui/dialogs.rc index 7dc6ced..a13824e 100644 --- a/PMAP-wingui/dialogs.rc +++ b/PMAP-wingui/dialogs.rc @@ -60,27 +60,27 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Console Information",IDC_STATIC_INFO,22,16,218,99 LTEXT "Model name:",IDC_STATIC_LBL_MODEL_NAME,31,30,42,8 - LTEXT "Unknown",IDC_STATIC_MODEL_NAME,85,30,40,8 + LTEXT "Unknown",IDC_STATIC_MODEL_NAME,80,30,55,8 LTEXT "MECHACON:",IDC_STATIC_LBL_MECHACON,31,42,42,8 - LTEXT "Unknown",IDC_STATIC_MECHACON,85,42,40,8 - LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,31,54,39,8 - LTEXT "Unknown",IDC_STATIC_MD_VER,85,54,40,8 - LTEXT "OP type:",IDC_STATIC_LBL_OP_TYPE,31,67,40,8 - LTEXT "Unknown",IDC_STATIC_OP_TYPE,85,67,40,8 - LTEXT "Lens type:",IDC_STATIC_LBL_LENS_TYPE,31,80,35,8 - LTEXT "Unknown",IDC_STATIC_LENS_TYPE,85,80,40,8 - LTEXT "RTC type:",IDC_STATIC_LBL_RTC_TYPE,31,94,34,8 - LTEXT "Unknown",IDC_STATIC_RTC_TYPE,85,94,40,8 - LTEXT "Unknown",IDC_STATIC_CEXDEX,192,32,40,8 - PUSHBUTTON "ID Management",IDC_BUTTON_ID_MAN,139,41,80,14,WS_DISABLED - LTEXT "Serial:",IDC_STATIC_LBL_SERIAL,142,58,21,8 - LTEXT "Unknown",IDC_STATIC_SERIAL,192,58,40,8 - LTEXT "MODEL ID:",IDC_STATIC_LBL_MODELID,142,70,36,8 - LTEXT "Unknown",IDC_STATIC_MODEL_ID,192,70,40,8 - LTEXT "EMCS ID:",IDC_STATIC_LBL_EMCS_ID,142,81,31,8 - LTEXT "Unknown",IDC_STATIC_EMCS_ID,192,81,40,8 - LTEXT "TV System:",IDC_STATIC_LBL_TV_SYS,142,94,37,8 - LTEXT "Unknown",IDC_STATIC_TV_SYS,192,94,40,8 + LTEXT "Unknown",IDC_STATIC_MECHACON,80,42,55,8 + LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,31,54,42,8 + LTEXT "Unknown",IDC_STATIC_MD_VER,80,54,55,8 + LTEXT "OP type:",IDC_STATIC_LBL_OP_TYPE,31,66,42,8 + LTEXT "Unknown",IDC_STATIC_OP_TYPE,80,66,55,8 + LTEXT "Lens type:",IDC_STATIC_LBL_LENS_TYPE,31,78,42,8 + LTEXT "Unknown",IDC_STATIC_LENS_TYPE,80,78,55,8 + LTEXT "RTC type:",IDC_STATIC_LBL_RTC_TYPE,31,90,42,8 + LTEXT "Unknown",IDC_STATIC_RTC_TYPE,80,90,55,8 + // LTEXT "Unknown",IDC_STATIC_CEXDEX,200,32,37,8 + PUSHBUTTON "ID Management",IDC_BUTTON_ID_MAN,150,37,80,14,WS_DISABLED + LTEXT "Serial:",IDC_STATIC_LBL_SERIAL,150,54,37,8 + LTEXT "Unknown",IDC_STATIC_SERIAL,195,54,30,8 + LTEXT "MODEL ID:",IDC_STATIC_LBL_MODELID,150,66,37,8 + LTEXT "Unknown",IDC_STATIC_MODEL_ID,195,66,30,8 + LTEXT "EMCS ID:",IDC_STATIC_LBL_EMCS_ID,150,78,37,8 + LTEXT "Unknown",IDC_STATIC_EMCS_ID,195,78,30,8 + LTEXT "TV System:",IDC_STATIC_LBL_TV_SYS,150,90,37,8 + LTEXT "Unknown",IDC_STATIC_TV_SYS,195,90,30,8 PUSHBUTTON "EEPROM Management",IDC_BUTTON_EEP_MAN,28,119,68,32,BS_MULTILINE | WS_DISABLED PUSHBUTTON "Electrical Adjustment",IDC_BUTTON_ELECT_ADJ,100,119,68,32,BS_MULTILINE | WS_DISABLED PUSHBUTTON "Mechanism Adjustment",IDC_BUTTON_MECHA_ADJ,172,119,68,32,BS_MULTILINE | WS_DISABLED @@ -264,17 +264,17 @@ BEGIN GROUPBOX "Initialize Defaults",IDC_STATIC_INIT_DEFS,26,116,146,46 END -IDD_DIALOG_CON_VER DIALOGEX 0, 0, 210, 72 +IDD_DIALOG_CON_VER DIALOGEX 0, 0, 200, 70 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Console Version" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,25,11,39,8 LTEXT "Unknown",IDC_STATIC_MD_VER,75,11,50,8 - LTEXT "CFC:",IDC_STATIC_LBL_CFC,25,22,39,8 - LTEXT "Unknown",IDC_STATIC_CFC,75,22,50,8 - LTEXT "CFD:",IDC_STATIC_LBL_CFD,25,33,39,8 - LTEXT "Unknown",IDC_STATIC_CFD,75,33,50,8 + LTEXT "CFD:",IDC_STATIC_LBL_CFD,25,22,39,8 + LTEXT "Unknown",IDC_STATIC_CFD,75,22,50,8 + LTEXT "CFC:",IDC_STATIC_LBL_CFC,25,33,39,8 + LTEXT "Unknown",IDC_STATIC_CFC,75,33,50,8 LTEXT "ADD0x010:",IDC_STATIC_LBL_CON_VER,25,44,39,8 LTEXT "Unknown",IDC_STATIC_CON_VER,75,44,50,8 // DEFPUSHBUTTON "OK",IDOK,131,30,50,14 diff --git a/PMAP-wingui/winmain.c b/PMAP-wingui/winmain.c index ca55b19..728482a 100644 --- a/PMAP-wingui/winmain.c +++ b/PMAP-wingui/winmain.c @@ -34,11 +34,11 @@ static void InitRawConVerInfoMenu(HWND hwnd) sprintf(buffer, "TestMode.%d MD1.%d", tm, md); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_MD_VER), buffer); - sprintf(buffer, "0x%08x", RawData->cfc); - SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFC), buffer); - sprintf(buffer, "0x%p", RawData->cfd); + sprintf(buffer, "0x%s", RawData->cfd); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFD), buffer); - sprintf(buffer, "0x%04x", RawData->VersionID); + sprintf(buffer, "0x%#08x", RawData->cfc); + SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFC), buffer); + sprintf(buffer, "0x%#04x", RawData->VersionID); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CON_VER), buffer); } From 03683134ce8854b4e2e1fde11fd823b4e64cf2bd Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Thu, 2 Nov 2023 21:52:49 +0200 Subject: [PATCH 26/42] GUI: fix aligment --- PMAP-wingui/dialogs.rc | 52 +++++++++++++++++++++--------------------- PMAP-wingui/winmain.c | 4 ++-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/PMAP-wingui/dialogs.rc b/PMAP-wingui/dialogs.rc index a13824e..38c6570 100644 --- a/PMAP-wingui/dialogs.rc +++ b/PMAP-wingui/dialogs.rc @@ -59,10 +59,10 @@ CAPTION "PMAP" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Console Information",IDC_STATIC_INFO,22,16,218,99 - LTEXT "Model name:",IDC_STATIC_LBL_MODEL_NAME,31,30,42,8 - LTEXT "Unknown",IDC_STATIC_MODEL_NAME,80,30,55,8 - LTEXT "MECHACON:",IDC_STATIC_LBL_MECHACON,31,42,42,8 - LTEXT "Unknown",IDC_STATIC_MECHACON,80,42,55,8 + LTEXT "MECHACON:",IDC_STATIC_LBL_MECHACON,31,30,42,8 + LTEXT "Unknown",IDC_STATIC_MECHACON,80,30,100,8 + LTEXT "Model name:",IDC_STATIC_LBL_MODEL_NAME,31,42,42,8 + LTEXT "Unknown",IDC_STATIC_MODEL_NAME,80,42,55,8 LTEXT "MD Version:",IDC_STATIC_LBL_MD_VER,31,54,42,8 LTEXT "Unknown",IDC_STATIC_MD_VER,80,54,55,8 LTEXT "OP type:",IDC_STATIC_LBL_OP_TYPE,31,66,42,8 @@ -235,36 +235,36 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "ID Management" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Close",IDOK,230,147,50,14 - PUSHBUTTON "Write ID",IDC_BUTTON_CON_ID_WR,223,24,57,13 - GROUPBOX "Console ID",IDC_STATIC_CON_ID,24,15,266,29 - PUSHBUTTON "Write ID",IDC_BUTTON_ILINK_ID_WR,224,57,57,13 - GROUPBOX "i.Link ID",IDC_STATIC_ILINK_ID,24,47,265,32 - EDITTEXT IDC_EDIT_CON_ID_0,33,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_1,57,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_2,80,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_3,103,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_4,126,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_5,148,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + GROUPBOX "Console ID",IDC_STATIC_CON_ID,24,14,266,29 + PUSHBUTTON "Write ID",IDC_BUTTON_CON_ID_WR,224,24,57,13 + EDITTEXT IDC_EDIT_CON_ID_0,35,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_1,58,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_2,81,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_3,104,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_4,127,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_5,150,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_6,173,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CON_ID_7,196,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + GROUPBOX "i.Link ID",IDC_STATIC_ILINK_ID,24,48,266,32 + PUSHBUTTON "Write ID",IDC_BUTTON_ILINK_ID_WR,224,58,57,13 EDITTEXT IDC_EDIT_ILINK_ID_0,35,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_ILINK_ID_1,59,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_ILINK_ID_1,58,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_ILINK_ID_2,81,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_ILINK_ID_3,104,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_ILINK_ID_4,127,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_ILINK_ID_5,149,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_ILINK_ID_6,171,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_ILINK_ID_7,192,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_6,170,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CON_ID_7,191,24,19,14,ES_UPPERCASE | ES_AUTOHSCROLL - GROUPBOX "Model Name",IDC_STATIC_MODEL_NAME,25,84,263,31 - EDITTEXT IDC_EDIT_MODEL_NAME,35,94,176,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_ILINK_ID_5,150,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_ILINK_ID_6,173,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_ILINK_ID_7,196,58,19,14,ES_UPPERCASE | ES_AUTOHSCROLL + GROUPBOX "Model Name",IDC_STATIC_MODEL_NAME,24,84,266,31 PUSHBUTTON "Write ID",IDC_BUTTON_MODEL_NAME_WR,224,94,57,13 - PUSHBUTTON "Initialize MECHACON",IDC_BUTTON_INIT_MECHA,97,127,50,33,BS_MULTILINE + EDITTEXT IDC_EDIT_MODEL_NAME,35,94,180,14,ES_AUTOHSCROLL + GROUPBOX "Initialize Defaults",IDC_STATIC_INIT_DEFS,24,116,146,46 PUSHBUTTON "Initialize NTSC/PAL defaults",IDC_BUTTON_INIT_NTSCPAL_DEFS,39,126,50,33,BS_MULTILINE - GROUPBOX "Initialize Defaults",IDC_STATIC_INIT_DEFS,26,116,146,46 + PUSHBUTTON "Initialize MECHACON",IDC_BUTTON_INIT_MECHA,97,126,50,33,BS_MULTILINE + DEFPUSHBUTTON "Close",IDOK,230,147,50,13 END -IDD_DIALOG_CON_VER DIALOGEX 0, 0, 200, 70 +IDD_DIALOG_CON_VER DIALOGEX 0, 0, 150, 70 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Console Version" FONT 8, "MS Shell Dlg", 400, 0, 0x1 diff --git a/PMAP-wingui/winmain.c b/PMAP-wingui/winmain.c index 728482a..295aa47 100644 --- a/PMAP-wingui/winmain.c +++ b/PMAP-wingui/winmain.c @@ -36,9 +36,9 @@ static void InitRawConVerInfoMenu(HWND hwnd) SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_MD_VER), buffer); sprintf(buffer, "0x%s", RawData->cfd); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFD), buffer); - sprintf(buffer, "0x%#08x", RawData->cfc); + sprintf(buffer, "%#08x", RawData->cfc); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFC), buffer); - sprintf(buffer, "0x%#04x", RawData->VersionID); + sprintf(buffer, "%#04x", RawData->VersionID); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CON_VER), buffer); } From a2f7a22620d8ae0025cb19ca35ed4f4e8ccc2d93 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Thu, 2 Nov 2023 23:57:53 +0200 Subject: [PATCH 27/42] Fix cancel button --- PMAP-wingui/eeprom-main.c | 2 ++ PMAP-wingui/elect-main.c | 2 ++ PMAP-wingui/mecha-main.c | 2 ++ PMAP-wingui/winmain.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/PMAP-wingui/eeprom-main.c b/PMAP-wingui/eeprom-main.c index 1cfd944..3bb69e2 100644 --- a/PMAP-wingui/eeprom-main.c +++ b/PMAP-wingui/eeprom-main.c @@ -228,6 +228,8 @@ static INT_PTR CALLBACK EepDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case WM_COMMAND: switch (LOWORD(wParam)) { + case IDOK: + case IDCANCEL: case IDCLOSE: EndDialog(hwndDlg, TRUE); break; diff --git a/PMAP-wingui/elect-main.c b/PMAP-wingui/elect-main.c index 10a9597..71b670e 100644 --- a/PMAP-wingui/elect-main.c +++ b/PMAP-wingui/elect-main.c @@ -91,6 +91,8 @@ static INT_PTR CALLBACK ElectDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM ElectAutoAdjust(); ToggleMainDialogControls(hwndDlg, TRUE); break; + case IDOK: + case IDCANCEL: case IDCLOSE: EndDialog(hwndDlg, TRUE); break; diff --git a/PMAP-wingui/mecha-main.c b/PMAP-wingui/mecha-main.c index 6d2d0d2..54c81ad 100644 --- a/PMAP-wingui/mecha-main.c +++ b/PMAP-wingui/mecha-main.c @@ -1665,6 +1665,8 @@ static INT_PTR CALLBACK MechaDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM // Test mechanics // MechaTestMain(); + case IDOK: + case IDCANCEL: case IDCLOSE: EndDialog(hwndDlg, TRUE); break; diff --git a/PMAP-wingui/winmain.c b/PMAP-wingui/winmain.c index 295aa47..2ad8c18 100644 --- a/PMAP-wingui/winmain.c +++ b/PMAP-wingui/winmain.c @@ -244,6 +244,8 @@ static INT_PTR CALLBACK MainDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDC_BUTTON_SHOW_VER: DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_CON_VER), hwndDlg, &ShowRawConVerInfoDlg); break; + case IDOK: + case IDCANCEL: case IDCLOSE: PlatCloseCOMPort(); PlatDebugDeinit(); From f4f81210721401457e9479ab234c4c12f54f2912 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:21:13 +0200 Subject: [PATCH 28/42] few fixes --- PMAP-wingui/dialogs.rc | 62 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/PMAP-wingui/dialogs.rc b/PMAP-wingui/dialogs.rc index 38c6570..88d5fd4 100644 --- a/PMAP-wingui/dialogs.rc +++ b/PMAP-wingui/dialogs.rc @@ -101,47 +101,47 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "EEPROM management" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - PUSHBUTTON "Cancel",IDCANCEL,377,162,50,14 - PUSHBUTTON "DVD-ROM Disc Detect",IDC_BTN_DEFAULT_DISC_DET,18,105,91,14 - PUSHBUTTON "EEGS",IDC_BTN_DEFAULT_EEGS,129,26,72,14 - PUSHBUTTON "OSD (User Data)",IDC_BTN_DEFAULT_OSD,129,41,72,14 - PUSHBUTTON "DVD Video Player",IDC_BTN_DEFAULT_DVDPL,129,103,72,14 - PUSHBUTTON "PS2 ID",IDC_BTN_DEFAULT_PS2ID,129,71,72,14 + GROUPBOX "EEPROM Management",IDC_STATIC,14,15,101,75 PUSHBUTTON "Erase EEPROM",IDC_BTN_ERASE_EEPROM,18,25,91,14 - PUSHBUTTON "DVD-ROM Tilt Motor",IDC_BTN_DEFAULT_TILT_MOTOR,18,137,91,14 - PUSHBUTTON "DVD-ROM Tray",IDC_BTN_DEFAULT_TRAY,18,153,91,14 - GROUPBOX "DVD-ROM Defaults",IDC_STC_DVDROM_DEFAULTS,14,93,98,81 - PUSHBUTTON "Clock (RTC)",IDC_BTN_DEFAULT_CLOCK,129,87,72,14 - PUSHBUTTON "Model Name",IDC_BTN_DEFAULT_MNAME,129,56,72,14 - GROUPBOX "Configuration Defaults",IDC_STATIC,117,15,101,107 - PUSHBUTTON "DVD-ROM Servo",IDC_BTN_DEFAULT_SERVO,18,121,91,14 - PUSHBUTTON "Load MECHACON Defaults",IDC_BTN_MECHA_DEFAULTS,17,40,92,14,BS_MULTILINE - GROUPBOX "EEPROM Management",IDC_STATIC,14,15,97,74 + PUSHBUTTON "Load MECHACON Defaults",IDC_BTN_MECHA_DEFAULTS,18,40,91,14,BS_MULTILINE PUSHBUTTON "Save EEPROM",IDC_BTN_SAVE_EEPROM,18,55,91,14 PUSHBUTTON "Restore EEPROM",IDC_BTN_RESTORE_EEPROM,18,70,91,14 - CONTROL "Disc Detect Area",IDC_CHK_UPD_DISC_DET,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,55,69,10 - CONTROL "EEP-ROM (ECR)",IDC_CHK_UPD_EEP_ECR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,44,67,10 - CONTROL "Servo Area",IDC_CHK_UPD_SERVO,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,67,52,10 - CONTROL "Tilt Motor Area",IDC_CHK_UPD_TILT_MOTOR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,78,63,10 - CONTROL "Battery/OSC Removed",IDC_CHK_EEP_STAT_NO_BATT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,231,24,67,20 - CONTROL "Battery Low Voltage",IDC_CHK_EEP_STAT_LOW_BATT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,232,42,64,20 - CONTROL "RTC-ECR Erased",IDC_CHK_EEP_STAT_RTC_ECR_ERASED,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,232,60,64,20 + GROUPBOX "DVD-ROM Defaults",IDC_STC_DVDROM_DEFAULTS,14,93,101,75 + PUSHBUTTON "DVD-ROM Disc Detect",IDC_BTN_DEFAULT_DISC_DET,18,105,91,14 + PUSHBUTTON "DVD-ROM Servo",IDC_BTN_DEFAULT_SERVO,18,120,91,14 + PUSHBUTTON "DVD-ROM Tilt Motor",IDC_BTN_DEFAULT_TILT_MOTOR,18,135,91,14 + PUSHBUTTON "DVD-ROM Tray",IDC_BTN_DEFAULT_TRAY,18,150,91,14 + GROUPBOX "Configuration Defaults",IDC_STATIC,117,15,101,105 + PUSHBUTTON "EEGS",IDC_BTN_DEFAULT_EEGS,129,25,72,14 + PUSHBUTTON "OSD (User Data)",IDC_BTN_DEFAULT_OSD,129,40,72,14 + PUSHBUTTON "Model Name",IDC_BTN_DEFAULT_MNAME,129,55,72,14 + PUSHBUTTON "PS2 ID",IDC_BTN_DEFAULT_PS2ID,129,70,72,14 + PUSHBUTTON "Clock (RTC)",IDC_BTN_DEFAULT_CLOCK,129,85,72,14 + PUSHBUTTON "DVD Video Player",IDC_BTN_DEFAULT_DVDPL,129,100,72,14 + LTEXT "Chassis:",IDC_STC_LBL_CHASSIS,127,139,28,8 + COMBOBOX IDC_CMB_CHASSIS,158,137,139,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "START",IDC_BTN_START,158,153,50,14 + CONTROL "Replaced MechaCon",IDC_CB_REPLACED_MECHACON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,155,81,10 + GROUPBOX "Status",IDC_STC_STATUS,225,15,78,88 + CONTROL "Battery/OSC Removed",IDC_CHK_EEP_STAT_NO_BATT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,232,24,65,20 + CONTROL "Battery Low Voltage",IDC_CHK_EEP_STAT_LOW_BATT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,232,42,65,20 + CONTROL "RTC-ECR Erased",IDC_CHK_EEP_STAT_RTC_ECR_ERASED,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,232,60,65,20 CONTROL "EEP-ROM Checksum Error",IDC_CHK_EEP_STAT_RTC_ECR_ERASED2, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,232,78,65,20 - GROUPBOX "Status",IDC_STC_STATUS,225,15,78,88 + GROUPBOX "Update Actions",IDC_STC_UPDATE_ACTIONS,309,15,112,145 CONTROL "EEPROM Update Available",IDC_CHK_EEPROM_UPD_AVAILABLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,316,25,86,18 - CONTROL "Tray Area",IDC_CHK_UPD_TRAY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,89,48,10 - CONTROL "EEGS Area",IDC_CHK_UPD_TRAY2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,100,50,10 + CONTROL "EEP-ROM (ECR)",IDC_CHK_UPD_EEP_ECR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,44,69,10 + CONTROL "Disc Detect Area",IDC_CHK_UPD_DISC_DET,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,55,69,10 + CONTROL "Servo Area",IDC_CHK_UPD_SERVO,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,66,69,10 + CONTROL "Tilt Motor Area",IDC_CHK_UPD_TILT_MOTOR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,77,69,10 + CONTROL "Tray Area",IDC_CHK_UPD_TRAY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,88,69,10 + CONTROL "EEGS Area",IDC_CHK_UPD_TRAY2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,328,99,69,10 CONTROL "Load MECHACON Defaults",IDC_CHK_MECHACON_DEFAULTS, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,316,110,86,17 - GROUPBOX "Update Actions",IDC_STC_UPDATE_ACTIONS,309,15,112,145 + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,316,110,86,18 PUSHBUTTON "Update",IDC_BTN_UPDATE,316,134,50,14 - LTEXT "Chassis:",IDC_STC_LBL_CHASSIS,127,139,28,8 - COMBOBOX IDC_CMB_CHASSIS,158,137,139,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "START",IDC_BTN_START,158,153,50,14 CONTROL "Clear OSD2 Init Bit",IDC_CLR_OSD2_INIT_BIT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,370,132,50,18 - CONTROL "Replaced MechaCon",IDC_CB_REPLACED_MECHACON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,155,81,10 + PUSHBUTTON "Cancel",IDCANCEL,377,162,50,14 END IDD_DIALOG_ELECT_ADJ DIALOGEX 0, 0, 316, 89 From 976a8313e36f163598f1b9b3c289263e5d3dca14 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 5 Nov 2023 18:36:33 +0200 Subject: [PATCH 29/42] GUI: Fix message handling. Enable ELEC tool --- PMAP-wingui/PMAP-win.vcxproj | 6 +- PMAP-wingui/elect-main.c | 2 +- PMAP-wingui/platform-wingui.c | 257 ++++++++++++++++++++++++++++++++++ 3 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 PMAP-wingui/platform-wingui.c diff --git a/PMAP-wingui/PMAP-win.vcxproj b/PMAP-wingui/PMAP-win.vcxproj index f272db9..0b5be25 100644 --- a/PMAP-wingui/PMAP-win.vcxproj +++ b/PMAP-wingui/PMAP-win.vcxproj @@ -52,7 +52,7 @@ Level3 Disabled ID_MANAGEMENT=1;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\PMAP-wincli;..\base;.; + ..\base;.; Windows @@ -68,7 +68,7 @@ true true ID_MANAGEMENT=1;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\PMAP-wincli;..\base;.; + ..\base;.; Windows @@ -87,7 +87,7 @@ - + diff --git a/PMAP-wingui/elect-main.c b/PMAP-wingui/elect-main.c index 71b670e..8d2479f 100644 --- a/PMAP-wingui/elect-main.c +++ b/PMAP-wingui/elect-main.c @@ -63,7 +63,7 @@ static void InitWindow(HWND hwnd) SetWindowText(GetDlgItem(hwnd, IDC_ELECT_MECHACON), L"Unknown"); } - ToggleMainDialogControls(hwnd, FALSE); + ToggleMainDialogControls(hwnd, TRUE); } static INT_PTR CALLBACK ElectDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) diff --git a/PMAP-wingui/platform-wingui.c b/PMAP-wingui/platform-wingui.c new file mode 100644 index 0000000..e4c87e9 --- /dev/null +++ b/PMAP-wingui/platform-wingui.c @@ -0,0 +1,257 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "platform.h" +#include "mecha.h" + +extern HWND g_mainWin; + +static HANDLE ComPortHandle = INVALID_HANDLE_VALUE; +static unsigned short RxTimeout; +static FILE *DebugOutputFile = NULL; + +/* void ListSerialDevices() +{ + char targetPath[256]; + char dosDeviceName[256]; + char comPortName[] = "COM"; + + for (int portNum = 1; portNum <= 256; portNum++) + { + sprintf(dosDeviceName, "%s%d", comPortName, portNum); + + if (QueryDosDevice(dosDeviceName, targetPath, sizeof(targetPath)) != 0) + { + printf("Found COM Port: %s\n", dosDeviceName); + printf("Target Path: %s\n", targetPath); + } + } +} */ + +int PlatOpenCOMPort(const char *device) +{ + // ListSerialDevices(); + COMMTIMEOUTS CommTimeout; + DCB DeviceControlBlock; + int result; + + if (ComPortHandle == INVALID_HANDLE_VALUE) + { + if ((ComPortHandle = CreateFileA(device, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) + { + memset(&DeviceControlBlock, 0, sizeof(DeviceControlBlock)); + DeviceControlBlock.DCBlength = sizeof(DCB); + GetCommState(ComPortHandle, &DeviceControlBlock); + DeviceControlBlock.BaudRate = CBR_57600; + DeviceControlBlock.fParity = FALSE; + DeviceControlBlock.ByteSize = 8; + DeviceControlBlock.StopBits = ONESTOPBIT; + SetCommState(ComPortHandle, &DeviceControlBlock); + CommTimeout.ReadIntervalTimeout = 0; + CommTimeout.ReadTotalTimeoutMultiplier = 0; + CommTimeout.ReadTotalTimeoutConstant = RxTimeout = MECHA_TASK_NORMAL_TO; + CommTimeout.WriteTotalTimeoutConstant = 0; + CommTimeout.WriteTotalTimeoutMultiplier = 0; + SetCommTimeouts(ComPortHandle, &CommTimeout); + PurgeComm(ComPortHandle, PURGE_RXCLEAR | PURGE_TXCLEAR); + result = 0; + } + else + result = ENXIO; + } + else + result = EMFILE; + + if (result != 0) + PlatCloseCOMPort(); + + return result; +} + +int PlatReadCOMPort(char *data, int n, unsigned short timeout) +{ + COMMTIMEOUTS CommTimeout; + DWORD BytesRead; + int result; + + if (RxTimeout != timeout) + { + CommTimeout.ReadIntervalTimeout = 0; + CommTimeout.ReadTotalTimeoutMultiplier = 0; + CommTimeout.ReadTotalTimeoutConstant = RxTimeout = timeout; + CommTimeout.WriteTotalTimeoutConstant = 0; + CommTimeout.WriteTotalTimeoutMultiplier = 0; + SetCommTimeouts(ComPortHandle, &CommTimeout); + } + if (ReadFile(ComPortHandle, data, n, &BytesRead, NULL) == TRUE) + result = BytesRead; + else + result = -EIO; + + return result; +} + +int PlatWriteCOMPort(const char *data) +{ + DWORD BytesWritten; + int result; + + if (WriteFile(ComPortHandle, data, strlen(data), &BytesWritten, NULL) == TRUE) + result = BytesWritten; + else + result = -EIO; + + if (result < 0) + { + printf("Write to COM port failed.\n"); + } + + return result; +} + +void PlatCloseCOMPort(void) +{ + if (ComPortHandle != INVALID_HANDLE_VALUE) + { + printf("Closing COM port...\n"); + CloseHandle(ComPortHandle); + ComPortHandle = INVALID_HANDLE_VALUE; + printf("COM port closed.\n"); + } + else + { + printf("COM port is already closed.\n"); + } +} + +void PlatSleep(unsigned short int msec) +{ + Sleep(msec); +} + +void PlatShowEMessage(const char *format, ...) +{ + char buffer[256]; + va_list args; + + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + + MessageBoxA(g_mainWin, (LPCSTR)buffer, + L"Error", + MB_OK | MB_ICONERROR); + + va_end(args); +} + +void PlatShowMessage(const char *format, ...) +{ + char buffer[256]; + va_list args; + + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + + MessageBoxA(g_mainWin, (LPCSTR)buffer, + L"Information", + MB_OK | MB_ICONINFORMATION); + va_end(args); +} + +void PlatShowMessageB(const char *format, ...) +{ + char buffer[256]; + va_list args; + + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + + MessageBoxA(g_mainWin, (LPCSTR)buffer, + L"Information", + MB_OK | MB_ICONINFORMATION); + va_end(args); +} + +void PlatDebugInit(void) +{ + // Get the current time + time_t rawtime; + struct tm *timeinfo; + char timestamp[20]; // Adjust the size according to your needs + + time(&rawtime); + timeinfo = localtime(&rawtime); + + // Format the timestamp (e.g., "2023-10-14_12-34-56") + strftime(timestamp, sizeof(timestamp), "%Y-%m-%d_%H-%M-%S", timeinfo); + + // Create the filename with timestamp + char filename[256]; // Adjust the size according to your needs + snprintf(filename, sizeof(filename), "pmap_%s.log", timestamp); + + DebugOutputFile = fopen(filename, "w"); +} + +void PlatDebugDeinit(void) +{ + if (DebugOutputFile != NULL) + { + fclose(DebugOutputFile); + DebugOutputFile = NULL; + } +} + +void PlatDPrintf(const char *format, ...) +{ + va_list args; + + va_start(args, format); + if (DebugOutputFile != NULL) + vfprintf(DebugOutputFile, format, args); + va_end(args); +} + +int pstricmp(const char *s1, const char *s2) +{ + char s1char, s2char; + + for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0'; s1++, s2++, s1char = *s1, s2char = *s2) + { + if (isalpha(s1char)) + s1char = toupper(s1char); + if (isalpha(s2char)) + s2char = toupper(s2char); + if (s1char != s2char) + break; + } + + return (s1char - s2char); +} + +int pstrincmp(const char *s1, const char *s2, int len) +{ + char s1char, s2char; + + for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0' && len > 0; s1++, s2++, s1char = *s1, s2char = *s2, len--) + { + if (isalpha(s1char)) + s1char = toupper(s1char); + if (isalpha(s2char)) + s2char = toupper(s2char); + if (s1char != s2char) + break; + } + + return ((len == 0) ? 0 : s1char - s2char); +} From 2f1fe6ea0ec731ea14eda17320bc7ff93ec7e21a Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 5 Nov 2023 20:07:34 +0200 Subject: [PATCH 30/42] Some fixes for Auto Elec for slims --- base/elect.c | 56 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/base/elect.c b/base/elect.c index df10a64..89f69d0 100644 --- a/base/elect.c +++ b/base/elect.c @@ -35,7 +35,7 @@ static const ElectMechaTaskPrep_t AutoAdjACommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test CD and press ENTER", NULL}, {6, 0, 6000, MECHA_CMD_TRAY, "CD TRAY CLOSE", "00"}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 15000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 15000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, {9, MECHA_CMD_TAG_ELECT_CD_TYPE, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, // Change to the 12cm YEDS-18 for DTL-T10000/H {10, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_1, "CD AUTO ADJUSTMENT (STAGE 1)", "01"}, {11, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_2, "CD AUTO ADJUSTMENT (STAGE 2)", "01"}, @@ -48,9 +48,9 @@ static const ElectMechaTaskPrep_t AutoAdjACommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-SL and press ENTER", NULL}, {17, 0, 6000, MECHA_CMD_TRAY, "DVD-SL TRAY CLOSE", "00"}, {18, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {19, MECHA_CMD_TAG_ELECT_DVDSL_DETECT_ADJ, 20000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, // If this command succeeds (byte 1 is not a '1'), disable the next 4 commands. + {19, MECHA_CMD_TAG_ELECT_DVDSL_DETECT_ADJ, 20000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, // If this command succeeds (byte 1 is not a '1'), disable the next 4 commands. {20, MECHA_CMD_TAG_ELECT_DVDSL_WR_WORK0_F0, 1000, MECHA_CMD_EEPROM_WRITE, "DVD-SL DETECT WR WORK0=F0", "000a00f0"}, - {21, 0, 20000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJ (DVD-DL)", "02"}, + {21, 0, 20000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJ (DVD-DL) TO EEPROM WR", "02"}, {22, MECHA_CMD_TAG_ELECT_DVDSL_RD_PULL_IN, 1000, MECHA_CMD_EEPROM_READ, "DVD-SL DETECT RD PULL-IN", "0001"}, // Value is acted on by ElectDiscDetectPullIn() {23, MECHA_CMD_TAG_ELECT_DVDSL_WR_WORK0_NEW, 1000, MECHA_CMD_EEPROM_WRITE, "DVD-SL DETECT WR WORK0=NEW", "000axxxx"}, // Use value from ElectDiscDetectPullIn() {24, 0, 1000, MECHA_CMD_DISC_MODE_DVDSL_12, "DISC MODE DVD-SL 12cm", NULL}, @@ -69,7 +69,7 @@ static const ElectMechaTaskPrep_t AutoAdjACommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-DL and press ENTER", NULL}, {37, 0, 6000, MECHA_CMD_TRAY, "DVD-DL TRAY CLOSE", "00"}, {38, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-DL SLED HOME POSITION", NULL}, - {39, 0, 20000, MECHA_CMD_DETECT_ADJ, "DVD-DL DETECT ADJUSTMENT", "02"}, + {39, 0, 20000, MECHA_CMD_DETECT_ADJ, "DVD-DL DETECT ADJUSTMENT TO EEPROM WR", "02"}, {40, MECHA_CMD_TAG_ELECT_DVDDL_DISC_DET_JUDGE, 20000, MECHA_CMD_DISC_DETECT, "DVD-DL DETECT JUDGEMENT", NULL}, {41, 0, 1000, MECHA_CMD_DISC_MODE_DVDDL_12, "DISC MODE DVD-DL 12cm", NULL}, {42, 0, 30000, MECHA_CMD_AUTO_ADJ_ST_1, "DVD-DL AUTO ADJUSTMENT (STAGE 1)", "01"}, @@ -102,7 +102,7 @@ static const ElectMechaTaskPrep_t AutoAdj139Commands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test CD and press ENTER", NULL}, {6, 0, 6000, MECHA_CMD_TRAY, "CD TRAY CLOSE", "00"}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, {9, 0, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, {10, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_1, "CD AUTO ADJUSTMENT (STAGE 1)", "01"}, {11, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_2, "CD AUTO ADJUSTMENT (STAGE 2)", "01"}, @@ -115,7 +115,7 @@ static const ElectMechaTaskPrep_t AutoAdj139Commands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-SL and press ENTER", NULL}, {17, 0, 6000, MECHA_CMD_TRAY, "DVD-SL TRAY CLOSE", "00"}, {18, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {19, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, + {19, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, {20, 0, 1000, MECHA_CMD_DISC_MODE_DVDSL_12, "DISC MODE DVD-SL 12cm", NULL}, {21, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_1, "DVD-SL AUTO ADJUSTMENT (STAGE 1)", "01"}, {22, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_2, "DVD-SL AUTO ADJUSTMENT (STAGE 2)", "01"}, @@ -132,8 +132,8 @@ static const ElectMechaTaskPrep_t AutoAdj139Commands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-DL and press ENTER", NULL}, {33, 0, 6000, MECHA_CMD_TRAY, "DVD-DL TRAY CLOSE", "00"}, {34, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-DL SLED HOME POSITION", NULL}, - {35, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-DL DETECT ADJUSTMENT", "02"}, - {36, 0, 5000, MECHA_CMD_DETECT_ADJ, "DVD-DL DETECT EEPROM WRITE", "03"}, + {35, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-DL DETECT ADJUSTMENT TO EEPROM WR", "02"}, + {36, 0, 5000, MECHA_CMD_DETECT_ADJ, "DVD-DL DETECT EEPROM WRITE TO EEPROM WR", "03"}, {37, MECHA_CMD_TAG_ELECT_DVDDL_DISC_DET_JUDGE, 5000, MECHA_CMD_DISC_DETECT, "DVD-DL DETECT JUDGEMENT", NULL}, {38, 0, 1000, MECHA_CMD_DISC_MODE_DVDDL_12, "DISC MODE DVD-DL 12cm", NULL}, {39, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_1, "DVD-DL AUTO ADJUSTMENT (STAGE 1)", "01"}, @@ -166,7 +166,7 @@ static const ElectMechaTaskPrep_t AutoAdjFCommands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test CD and press ENTER", NULL}, {6, 0, 6000, MECHA_CMD_TRAY, "CD TRAY CLOSE", "00"}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, {9, MECHA_CMD_TAG_ELECT_OP_TYPE_ERROR, 6000, MECHA_CMD_EEPROM_READ, "CD GET CD-MIN (OP TYPE ERR)", "0002"}, {10, 0, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, {11, 0, 20000, MECHA_CMD_AUTO_ADJ_FIX_GAIN, "CD AUTO ADJUSTMENT (FIX GAIN)", "0103"}, @@ -179,7 +179,7 @@ static const ElectMechaTaskPrep_t AutoAdjFCommands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-SL and press ENTER", NULL}, {17, 0, 6000, MECHA_CMD_TRAY, "DVD-SL TRAY CLOSE", "00"}, {18, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {19, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, + {19, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, {20, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMIN_RD, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM-DVDmin RD", "0004"}, {21, MECHA_CMD_TAG_ELECT_DISC_DET_CDMIN_WR, 5000, MECHA_CMD_EEPROM_WRITE, "DISC DETECT EEPROM-CDmin WR", "0002xxxx"}, {22, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMAX_WR, 5000, MECHA_CMD_EEPROM_WRITE, "DISC DETECT EEPROM-DVDmax WR", "0005xxxx"}, @@ -232,7 +232,7 @@ static const ElectMechaTaskPrep_t AutoAdjGCommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test CD and press ENTER", NULL}, {6, 0, 6000, MECHA_CMD_TRAY, "CD TRAY CLOSE", "00"}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, {9, MECHA_CMD_TAG_ELECT_OP_TYPE_ERROR, 6000, MECHA_CMD_EEPROM_READ, "CD GET CD-MAX (OP TYPE ERR)", "0003"}, {10, 0, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, {11, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_1, "CD AUTO ADJUSTMENT (STAGE 1)", "01"}, @@ -246,7 +246,7 @@ static const ElectMechaTaskPrep_t AutoAdjGCommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-SL and press ENTER", NULL}, {18, 0, 6000, MECHA_CMD_TRAY, "DVD-SL TRAY CLOSE", "00"}, {19, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {20, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, + {20, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, {21, 0, 5000, MECHA_CMD_DETECT_ADJ, "DISC DETECT EEPROM WR", "03"}, {22, 0, 5000, MECHA_CMD_UPLOAD_TO_RAM, "COPY EEPROM DATA TO MECHACON", "02"}, {23, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMIN_RD, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM-DVDmin RD", "0004"}, @@ -305,7 +305,7 @@ static const ElectMechaTaskPrep_t AutoAdjG2Commands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test CD and press ENTER", NULL}, {6, 0, 6000, MECHA_CMD_TRAY, "CD TRAY CLOSE", "00"}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 6000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, {9, MECHA_CMD_TAG_ELECT_OP_TYPE_ERROR, 6000, MECHA_CMD_EEPROM_READ, "CD GET CD-MAX (OP TYPE ERR)", "0003"}, {10, 0, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, {11, 0, 20000, MECHA_CMD_AUTO_ADJ_ST_1, "CD AUTO ADJUSTMENT (STAGE 1)", "01"}, @@ -321,7 +321,7 @@ static const ElectMechaTaskPrep_t AutoAdjG2Commands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-SL and press ENTER", NULL}, {20, 0, 6000, MECHA_CMD_TRAY, "DVD-SL TRAY CLOSE", "00"}, {21, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {22, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, + {22, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, {23, 0, 5000, MECHA_CMD_DETECT_ADJ, "DISC DETECT EEPROM WR", "03"}, {24, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMIN_RD, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM-DVDmin RD", "0004"}, {25, MECHA_CMD_TAG_ELECT_DVDSL_DISC_DET_JUDGE, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM-CDmax RD", "0003"}, @@ -384,7 +384,9 @@ static const ElectMechaTaskPrep_t AutoAdj140Commands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test CD and press ENTER", NULL}, {6, 0, 6000, MECHA_CMD_TRAY, "CD TRAY CLOSE", "00"}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 15000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 15000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {10, MECHA_CMD_TAG_ELECT_OP_TYPE_ERROR, 6000, MECHA_CMD_EEPROM_READ, "CD GET CD-MAX (OP TYPE ERR)", "0034"}, {11, 0, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, @@ -404,9 +406,13 @@ static const ElectMechaTaskPrep_t AutoAdj140Commands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Insert test DVD-SL and press ENTER", NULL}, {23, 0, 6000, MECHA_CMD_TRAY, "DVD-SL TRAY CLOSE", "00"}, {24, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {25, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, + {25, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {26, 0, 5000, MECHA_CMD_DETECT_ADJ, "DISC DETECT DATA TO EEPROM WR", "03"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {27, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMIN_RD, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM RD", "0035"}, {28, MECHA_CMD_TAG_ELECT_DVDSL_DISC_DET_JUDGE, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM RD", "0034"}, @@ -428,7 +434,11 @@ static const ElectMechaTaskPrep_t AutoAdj140Commands[] = { // Test CD SCD-2700, {0, 0, 1000, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 1s", NULL}, {43, MECHA_CMD_TAG_ELECT_DVDSL_MIRR, 3000, MECHA_CMD_MIRR_CHECK, "DVD-SL MIRR CHECK", NULL}, {44, MECHA_CMD_TAG_ELECT_DVDSL_MIRR_EEPROM_WR, 6000, MECHA_CMD_EEPROM_WRITE, "DVD-SL EEPROM WR 0x01E-3019", "001e3019"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {45, MECHA_CMD_TAG_ELECT_DVDSL_MIRR_EEPROM_WR, 6000, MECHA_CMD_EEPROM_WRITE, "DVD-SL EEPROM WR 0x01F-3039", "001f3039"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {46, MECHA_CMD_TAG_ELECT_DVDSL_FOCUS_OFFSET, 6000, MECHA_CMD_FE_OFFSET, "DVD-SL FE OFFSET CHECK", "0500"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "DVD-SL FE DE-FOCUS CHECK WAIT 100ms", NULL}, {47, MECHA_CMD_TAG_ELECT_DVDSL_DEFOCUS_OFFSET, 6000, MECHA_CMD_EEPROM_READ, "DVD-SL FE DE-FOCUS CHECK", "004c"}, @@ -475,7 +485,9 @@ static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { // Test CD SCD-2700, {3, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Open lid, insert test CD, close lid and press ENTER", NULL}, {7, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, - {8, 0, 15000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT", "00"}, + {8, 0, 15000, MECHA_CMD_DETECT_ADJ, "CD DETECT ADJUSTMENT TO EEPROM WR", "00"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {10, MECHA_CMD_TAG_ELECT_OP_TYPE_ERROR, 6000, MECHA_CMD_EEPROM_READ, "CD GET CD-MAX (OP TYPE ERR)", "0034"}, {11, 0, 1000, MECHA_CMD_DISC_MODE_CD_8, "CD 8cm DISC MODE", NULL}, @@ -493,14 +505,16 @@ static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { // Test CD SCD-2700, {21, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Open lid, insert test DVD-SL, close lid and press ENTER", NULL}, {24, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-SL SLED HOME POSITION", NULL}, - {25, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT", "01"}, + {25, 0, 10000, MECHA_CMD_DETECT_ADJ, "DVD-SL DETECT ADJUSTMENT TO EEPROM WR", "01"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {26, 0, 5000, MECHA_CMD_DETECT_ADJ, "DISC DETECT DATA TO EEPROM WR", "03"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {27, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMIN_RD, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM RD", "0035"}, {28, MECHA_CMD_TAG_ELECT_DVDSL_DISC_DET_JUDGE, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM RD", "0034"}, {29, 0, 1000, MECHA_CMD_DISC_MODE_DVDSL_12, "DISC MODE DVD-SL 12cm", NULL}, - {30, 0, 30000, MECHA_CMD_AUTO_ADJ_FIX_GAIN, "DVD-SL AUTO ADJUSTMENT (Fix Gain Mode)", "0105"}, + {30, 0, 30000, MECHA_CMD_AUTO_ADJ_FIX_GAIN, "DVD-SL AUTO ADJUSTMENT (Fix Gain Mode)", "0103"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {31, MECHA_CMD_TAG_ELECT_DVDSL_RFDC_LEVEL, 3000, MECHA_CMD_RFDC_LEVEL, "DVD-SL GET RF DC LEVEL", NULL}, {32, MECHA_CMD_TAG_ELECT_DVDSL_FE_LOOP_GAIN, 3000, MECHA_CMD_GAIN, "DVD-SL GET FE LOOP GAIN", "13"}, @@ -517,7 +531,11 @@ static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { // Test CD SCD-2700, {0, 0, 1000, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 1s", NULL}, {43, MECHA_CMD_TAG_ELECT_DVDSL_MIRR, 3000, MECHA_CMD_MIRR_CHECK, "DVD-SL MIRR CHECK", NULL}, {44, MECHA_CMD_TAG_ELECT_DVDSL_MIRR_EEPROM_WR, 6000, MECHA_CMD_EEPROM_WRITE, "DVD-SL EEPROM WR 0x01E-3019", "001e3019"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {45, MECHA_CMD_TAG_ELECT_DVDSL_MIRR_EEPROM_WR, 6000, MECHA_CMD_EEPROM_WRITE, "DVD-SL EEPROM WR 0x01F-3039", "001f3039"}, + {0, 0, 500, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 500ms", NULL}, + {0, 0, 3000, MECHA_CMD_WRITE_CHECKSUM, "ALL EEPROM CHECK SUM WR", "00"}, {46, MECHA_CMD_TAG_ELECT_DVDSL_FOCUS_OFFSET, 6000, MECHA_CMD_FE_OFFSET, "DVD-SL FE OFFSET CHECK", "0500"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "DVD-SL FE DE-FOCUS CHECK WAIT 100ms", NULL}, {47, MECHA_CMD_TAG_ELECT_DVDSL_DEFOCUS_OFFSET, 6000, MECHA_CMD_EEPROM_READ, "DVD-SL FE DE-FOCUS CHECK", "004c"}, From dfed3384e26aa4ab43638400b6cf6b6742847b29 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:29:18 +0200 Subject: [PATCH 31/42] bump action --- .github/workflows/compilation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 11b8683..d27f5de 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v3 - name: Setup msbuild - uses: microsoft/setup-msbuild@v1.1 + uses: microsoft/setup-msbuild@v2 - name: Build run: msbuild /p:PlatformToolset=v142 /p:Configuration=Release From a0f4b2ca4bada6659ce38180ac122008fece68d3 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:29:57 +0200 Subject: [PATCH 32/42] Update compilation.yml --- .github/workflows/compilation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index ac4d894..f55859b 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -3,7 +3,7 @@ name: CI-compile on: push: pull_request: - + jobs: build-win: name: PMAP windows compilation From 4d22f6317fbf6bf7dbb25b90d09638b88e5ff411 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:59:52 +0300 Subject: [PATCH 33/42] Hack for slim models Co-authored-by: fixeria --- base/elect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/elect.c b/base/elect.c index 89f69d0..f1ec60c 100644 --- a/base/elect.c +++ b/base/elect.c @@ -792,7 +792,7 @@ static int ElectJudgeDVDSLFELoopGain(const char *result, int len) else { PlatShowEMessage("DVD-SL FE LOOP GAIN NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -839,7 +839,7 @@ static int ElectJudgeDVDSLJitter256(const char *result, int len) else { PlatShowEMessage("DVD-SL jitter(256) NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -954,7 +954,7 @@ static int ElectJudgeDVDDLL0Jitter256(const char *result, int len) else { PlatShowEMessage("DVD-DL-L0 jitter(256) NG: %d\n", value); - return 1; + return (ConSlim == 1) ? 0 : 1; } } From 5e6adcf1aaf0af31d41b679fee58f7a47c5b3fb8 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:55:54 +0300 Subject: [PATCH 34/42] Update workflow file --- .github/workflows/compilation.yml | 77 ++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 90f0fd2..a2554c3 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -3,7 +3,7 @@ name: CI-compile on: push: pull_request: - + jobs: build-win: name: PMAP windows compilation @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup msbuild uses: microsoft/setup-msbuild@v2 @@ -19,41 +19,23 @@ jobs: - name: Build run: msbuild /p:PlatformToolset=v142 /p:Configuration=Release - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: PMAP-wincli path: Release/PMAP.exe - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: PMAP-wingui path: Release/PMAP-win.exe - - name: Create release - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' - uses: marvinpinto/action-automatic-releases@latest - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - title: "Latest development build" - files: Release/PMAP.exe - - - name: Create release - if: startsWith(github.ref, 'refs/tags/v') - uses: marvinpinto/action-automatic-releases@latest - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: "${{ contains(github.ref, '-rc') }}" - title: PMAP-${{ github.ref }} - files: Release/PMAP.exe - build-macos: name: PMAP macos compilation runs-on: macos-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build run: | @@ -68,12 +50,12 @@ jobs: make ID_MANAGEMENT=1 tar -zcvf PMAP-macos-id.tar.gz pmap - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: PMAP-macos path: PMAP-unix/PMAP-macos.tar.gz - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: PMAP-macos-id path: PMAP-unix/PMAP-macos-id.tar.gz @@ -84,7 +66,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build run: | @@ -99,12 +81,51 @@ jobs: make ID_MANAGEMENT=1 tar -zcvf PMAP-linux-id.tar.gz pmap - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: PMAP-linux path: PMAP-unix/PMAP-linux.tar.gz - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: PMAP-linux-id path: PMAP-unix/PMAP-linux-id.tar.gz + + create-release: + name: Create release + runs-on: ubuntu-latest + needs: [build-win, build-macos, build-linux] + steps: + - uses: actions/download-artifact@v4 + - name: Display structure of downloaded files + run: ls -R + + - name: Create release for master/main + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + title: "Latest development build" + files: | + ./PMAP-wincli/PMAP.exe + ./PMAP-wingui/PMAP-win.exe + ./PMAP-macos/PMAP-macos.tar.gz + ./PMAP-macos-id/PMAP-macos-id.tar.gz + ./PMAP-linux/PMAP-linux.tar.gz + ./PMAP-linux-id/PMAP-linux-id.tar.gz + + - name: Create release for tagged versions + if: startsWith(github.ref, 'refs/tags/v') + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: "${{ contains(github.ref, '-rc') }}" + title: PMAP-${{ github.ref }} + files: | + ./release/win/PMAP.exe + ./release/win/PMAP-win.exe + ./release/macos/PMAP-macos.tar.gz + ./release/macos/PMAP-macos-id.tar.gz + ./release/linux/PMAP-linux.tar.gz + ./release/linux/PMAP-linux-id.tar.gz From ea827a3538d4a5df2f25a504aafaf065d1b9ca05 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:30:46 +0300 Subject: [PATCH 35/42] revert experimental value --- base/elect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/elect.c b/base/elect.c index f1ec60c..e57f443 100644 --- a/base/elect.c +++ b/base/elect.c @@ -514,7 +514,7 @@ static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { // Test CD SCD-2700, {27, MECHA_CMD_TAG_ELECT_DISC_DET_DVDMIN_RD, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM RD", "0035"}, {28, MECHA_CMD_TAG_ELECT_DVDSL_DISC_DET_JUDGE, 5000, MECHA_CMD_EEPROM_READ, "DISC DETECT EEPROM RD", "0034"}, {29, 0, 1000, MECHA_CMD_DISC_MODE_DVDSL_12, "DISC MODE DVD-SL 12cm", NULL}, - {30, 0, 30000, MECHA_CMD_AUTO_ADJ_FIX_GAIN, "DVD-SL AUTO ADJUSTMENT (Fix Gain Mode)", "0103"}, + {30, 0, 30000, MECHA_CMD_AUTO_ADJ_FIX_GAIN, "DVD-SL AUTO ADJUSTMENT (Fix Gain Mode)", "0105"}, {0, 0, 100, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 100ms", NULL}, {31, MECHA_CMD_TAG_ELECT_DVDSL_RFDC_LEVEL, 3000, MECHA_CMD_RFDC_LEVEL, "DVD-SL GET RF DC LEVEL", NULL}, {32, MECHA_CMD_TAG_ELECT_DVDSL_FE_LOOP_GAIN, 3000, MECHA_CMD_GAIN, "DVD-SL GET FE LOOP GAIN", "13"}, From ff6d49f330e1f5f6de46c6f4323963dde7c9895f Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:31:28 +0300 Subject: [PATCH 36/42] remove linux folder, now linux and macos compiles from unix folder --- PMAP-linux/Makefile | 13 ---- PMAP-linux/platform-linux.c | 135 ------------------------------------ 2 files changed, 148 deletions(-) delete mode 100644 PMAP-linux/Makefile delete mode 100644 PMAP-linux/platform-linux.c diff --git a/PMAP-linux/Makefile b/PMAP-linux/Makefile deleted file mode 100644 index 2643483..0000000 --- a/PMAP-linux/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -VPATH = ./:../base/ - -ELF = pmap -CFLAGS = -O2 -I. -OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-linux.o -OBJS += main.o -# OBJS += eeprom-id.o id-main.o - -$(ELF): $(OBJS) - $(CC) -o $(ELF) $(OBJS) - -clean: - rm -f $(ELF) $(OBJS) diff --git a/PMAP-linux/platform-linux.c b/PMAP-linux/platform-linux.c deleted file mode 100644 index b9a0bd7..0000000 --- a/PMAP-linux/platform-linux.c +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "platform.h" -#include "../base/mecha.h" - -static int ComPortFD = -1; -// static unsigned short RxTimeout; -static struct termios OldTio; - -int PlatOpenCOMPort(const char *device) -{ - struct termios tio; - int result; - - if (ComPortFD < 0) - { - if ((ComPortFD = open(device, O_RDWR | O_NOCTTY)) >= 0) - { - tcgetattr(ComPortFD, &OldTio); - memset(&tio, 0, sizeof(tio)); - - tio.c_cflag = B57600 | CS8 | CLOCAL | CREAD; - tio.c_lflag = ICANON; - - tcflush(ComPortFD, TCIFLUSH); - tcsetattr(ComPortFD, TCSANOW, &tio); - result = 0; - } - else - result = ComPortFD; - } - else - result = EMFILE; - - return result; -} - -int PlatReadCOMPort(char *data, int n, unsigned short timeout) -{ - struct timeval SelTimeout; - fd_set RdSet; - - FD_ZERO(&RdSet); - FD_SET(ComPortFD, &RdSet); - SelTimeout.tv_sec = 0; - SelTimeout.tv_usec = timeout * 1000; - if (select(ComPortFD + 1, &RdSet, NULL, NULL, &SelTimeout) == 1) - return read(ComPortFD, data, n); - else - return -1; -} - -int PlatWriteCOMPort(const char *data) -{ - return write(ComPortFD, data, strlen(data)); -} - -void PlatCloseCOMPort(void) -{ - tcsetattr(ComPortFD, TCSANOW, &OldTio); - close(ComPortFD); - ComPortFD = -1; -} - -void PlatSleep(unsigned short int msec) -{ - usleep((unsigned int)msec * 1000); -} - -void PlatShowEMessage(const char *format, ...) -{ - va_list args; - - va_start(args, format); - vprintf(format, args); - va_end(args); -} - -void PlatShowMessageB(const char *format, ...) -{ - va_list args; - - va_start(args, format); - vprintf(format, args); - - // Block until the user presses ENTER - while (getchar() != '\n') - { - }; - - va_end(args); -} - - -int pstricmp(const char *s1, const char *s2) -{ - char s1char, s2char; - - for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0'; s1++, s2++, s1char = *s1, s2char = *s2) - { - if (isalpha(s1char)) - s1char = toupper(s1char); - if (isalpha(s2char)) - s2char = toupper(s2char); - if (s1char != s2char) - break; - } - - return (s1char - s2char); -} - -int pstrincmp(const char *s1, const char *s2, int len) -{ - char s1char, s2char; - - for (s1char = *s1, s2char = *s2; *s1 != '\0' && *s2 != '\0' && len > 0; s1++, s2++, s1char = *s1, s2char = *s2, len--) - { - if (isalpha(s1char)) - s1char = toupper(s1char); - if (isalpha(s2char)) - s2char = toupper(s2char); - if (s1char != s2char) - break; - } - - return ((len == 0) ? 0 : s1char - s2char); -} From 2d9f09b6eea929930ba92d03f0154596131ae315 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:51:50 +0300 Subject: [PATCH 37/42] some code fixes --- PMAP-unix/platform-unix.c | 2 +- base/eeprom-id.c | 99 ++++++++++++++++++++------------------- base/eeprom-main.c | 4 +- base/elect.c | 50 +++++++++++++------- 4 files changed, 85 insertions(+), 70 deletions(-) diff --git a/PMAP-unix/platform-unix.c b/PMAP-unix/platform-unix.c index 7c52c28..bf746b9 100644 --- a/PMAP-unix/platform-unix.c +++ b/PMAP-unix/platform-unix.c @@ -28,7 +28,7 @@ int PlatOpenCOMPort(const char *device) // List available serial devices printf("Available serial devices in /dev/:\n"); DIR *dir; - struct dirent *entry; + const struct dirent *entry; dir = opendir("/dev"); if (dir != NULL) diff --git a/base/eeprom-id.c b/base/eeprom-id.c index 9ea4b0b..9d37de5 100644 --- a/base/eeprom-id.c +++ b/base/eeprom-id.c @@ -130,7 +130,8 @@ int MechaInitMechacon(int model, int IsDex) tm = localtime(&TimeNow); // Format: RRYYMMDDHHMMSSrrrr, where R = MagicGate region, Y = Year (from 2000), M = Month (1-12), D = Day of month (1-31), H = Hour (0-23), M = minute (0-59), S = second (0-59), r = random number (first 4 digits from the right). // The time and date format is made with Ctime::Format %y%m%d%H%M%S - sprintf(data, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); + // sprintf(data, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); + snprintf(data, 19, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); printf("Shimuke: %s (%zu)\n", data, strlen(data)); MechaCommandAdd(MECHA_CMD_INIT_SHIMUKE, data, id++, 0, 6000, "WR INIT SHIMUKE"); MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); @@ -170,40 +171,40 @@ int EEPROMInitID(void) id = 1; if (ConMD == 40) { - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_0); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_NEW_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_0, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_1); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_NEW_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_1, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_2); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_NEW_2); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_2, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_NEW_3); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_NEW_3); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_3, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_0); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_NEW_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_0, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_1); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_NEW_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_1, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_2); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_NEW_2); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_2, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_NEW_3); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_NEW_3); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_3, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); } else { - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_0); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_0, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_1); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_1, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_2); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_2); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_2, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_ILINK_ID_3); + snprintf(address, 5, "%04x", EEPROM_MAP_ILINK_ID_3); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_ILINK_ID_3, MECHA_TASK_NORMAL_TO, "i.Link ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_0); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_0, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_1); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_1, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_2); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_2); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_2, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); - sprintf(address, "%04x", EEPROM_MAP_CON_ID_3); + snprintf(address, 5, "%04x", EEPROM_MAP_CON_ID_3); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_INIT_ID_CON_ID_3, MECHA_TASK_NORMAL_TO, "CONSOLE ID READ"); } @@ -230,24 +231,24 @@ int EEPROMSetiLinkID(const u8 *NewiLinkID) id = 1; if (ConMD == 40) { - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_0, iLinkID[1], iLinkID[0]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_0, iLinkID[1], iLinkID[0]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_1, iLinkID[3], iLinkID[2]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_1, iLinkID[3], iLinkID[2]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_2, iLinkID[5], iLinkID[4]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_2, iLinkID[5], iLinkID[4]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_3, iLinkID[7], iLinkID[6]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_NEW_3, iLinkID[7], iLinkID[6]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); } else { - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_0, iLinkID[1], iLinkID[0]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_0, iLinkID[1], iLinkID[0]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_1, iLinkID[3], iLinkID[2]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_1, iLinkID[3], iLinkID[2]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_2, iLinkID[5], iLinkID[4]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_2, iLinkID[5], iLinkID[4]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_3, iLinkID[7], iLinkID[6]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_ILINK_ID_3, iLinkID[7], iLinkID[6]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "i.Link ID WRITE"); } MechaAddPostEEPROMWrCmds(id); @@ -265,24 +266,24 @@ int EEPROMSetConsoleID(const u8 *NewConID) id = 1; if (ConMD == 40) { - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_0, ConsoleID[1], ConsoleID[0]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_0, ConsoleID[1], ConsoleID[0]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_1, ConsoleID[3], ConsoleID[2]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_1, ConsoleID[3], ConsoleID[2]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_2, ConsoleID[5], ConsoleID[4]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_2, ConsoleID[5], ConsoleID[4]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_3, ConsoleID[7], ConsoleID[6]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_NEW_3, ConsoleID[7], ConsoleID[6]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); } else { - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_0, ConsoleID[1], ConsoleID[0]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_0, ConsoleID[1], ConsoleID[0]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_1, ConsoleID[3], ConsoleID[2]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_1, ConsoleID[3], ConsoleID[2]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_2, ConsoleID[5], ConsoleID[4]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_2, ConsoleID[5], ConsoleID[4]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_CON_ID_3, ConsoleID[7], ConsoleID[6]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_CON_ID_3, ConsoleID[7], ConsoleID[6]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "CONSOLE ID WRITE"); } MechaAddPostEEPROMWrCmds(id); @@ -301,40 +302,40 @@ int EEPROMSetModelName(const char *ModelName) id = 1; if (ConMD == 40) { - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_0, ConModelName[1], ConModelName[0]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_0, ConModelName[1], ConModelName[0]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_1, ConModelName[3], ConModelName[2]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_1, ConModelName[3], ConModelName[2]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_2, ConModelName[5], ConModelName[4]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_2, ConModelName[5], ConModelName[4]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_3, ConModelName[7], ConModelName[6]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_3, ConModelName[7], ConModelName[6]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_4, ConModelName[9], ConModelName[8]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_4, ConModelName[9], ConModelName[8]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_5, ConModelName[11], ConModelName[10]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_5, ConModelName[11], ConModelName[10]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_6, ConModelName[13], ConModelName[12]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_6, ConModelName[13], ConModelName[12]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_7, ConModelName[15], ConModelName[14]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_NEW_7, ConModelName[15], ConModelName[14]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); } else { - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_0, ConModelName[1], ConModelName[0]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_0, ConModelName[1], ConModelName[0]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_1, ConModelName[3], ConModelName[2]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_1, ConModelName[3], ConModelName[2]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_2, ConModelName[5], ConModelName[4]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_2, ConModelName[5], ConModelName[4]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_3, ConModelName[7], ConModelName[6]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_3, ConModelName[7], ConModelName[6]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_4, ConModelName[9], ConModelName[8]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_4, ConModelName[9], ConModelName[8]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_5, ConModelName[11], ConModelName[10]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_5, ConModelName[11], ConModelName[10]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_6, ConModelName[13], ConModelName[12]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_6, ConModelName[13], ConModelName[12]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); - sprintf(arg, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_7, ConModelName[15], ConModelName[14]); + snprintf(arg, 9, "%04x%02x%02x", EEPROM_MAP_MODEL_NAME_7, ConModelName[15], ConModelName[14]); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, arg, id++, 0, MECHA_TASK_NORMAL_TO, "MODEL NAME WRITE"); } MechaAddPostEEPROMWrCmds(id); diff --git a/base/eeprom-main.c b/base/eeprom-main.c index 7648797..487f66c 100644 --- a/base/eeprom-main.c +++ b/base/eeprom-main.c @@ -325,7 +325,7 @@ void MenuEEPROM(void) "A-chassis (DTL-T10000H)", "A-chassis (DTL-T10000)", "B-chassis (DTL-H30001/2)", - "D-chassis (DTL-H30000)" + "D-chassis (DTL-H30000)", "H-chassis (DTL-H500xx)"}; unsigned char done; short int choice, chassis; @@ -398,7 +398,7 @@ void MenuEEPROM(void) RawData = MechaGetRawIdent(); // Format the filename - sprintf(default_filename, "%s_%07u_%s_%#08x.bin", model, serial, RawData->cfd, RawData->cfc); + snprintf(default_filename, sizeof(default_filename), "%s_%07u_%s_%#08x.bin", model, serial, RawData->cfd, RawData->cfc); printf("Default filename: %s\n", default_filename); printf("Do you want to use the default filename? (Y/N): "); diff --git a/base/elect.c b/base/elect.c index e57f443..2ad5331 100644 --- a/base/elect.c +++ b/base/elect.c @@ -26,7 +26,8 @@ typedef struct ElectMechaTaskPrep const char *args; } ElectMechaTaskPrep_t; -static const ElectMechaTaskPrep_t AutoAdjACommands[] = { // Test CD SCD-2700/YEDS-18, DVD-SL HX-504, DVD-DL HX-505 +static const ElectMechaTaskPrep_t AutoAdjACommands[] = { + // Test CD SCD-2700/YEDS-18, DVD-SL HX-504, DVD-DL HX-505 {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {3, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, @@ -91,9 +92,11 @@ static const ElectMechaTaskPrep_t AutoAdjACommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Remove disc and press ENTER", NULL}, {57, 0, 6000, MECHA_CMD_TRAY, "TRAY CLOSE", "00"}, {58, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; -static const ElectMechaTaskPrep_t AutoAdj139Commands[] = { // Test CD SCD-2700/YEDS-18, DVD-SL HX-504, DVD-DL HX-505 +static const ElectMechaTaskPrep_t AutoAdj139Commands[] = { + // Test CD SCD-2700/YEDS-18, DVD-SL HX-504, DVD-DL HX-505 {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {3, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, @@ -155,9 +158,11 @@ static const ElectMechaTaskPrep_t AutoAdj139Commands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Remove disc and press ENTER", NULL}, {54, 0, 6000, MECHA_CMD_TRAY, "TRAY CLOSE", "00"}, {55, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; -static const ElectMechaTaskPrep_t AutoAdjFCommands[] = { // Test CD SCD-2700, DVD-SL HX-504, DVD-DL HX-505 +static const ElectMechaTaskPrep_t AutoAdjFCommands[] = { + // Test CD SCD-2700, DVD-SL HX-504, DVD-DL HX-505 {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {3, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, @@ -221,9 +226,11 @@ static const ElectMechaTaskPrep_t AutoAdjFCommands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Remove disc and press ENTER", NULL}, {57, 0, 6000, MECHA_CMD_TRAY, "TRAY CLOSE", "00"}, {58, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; -static const ElectMechaTaskPrep_t AutoAdjGCommands[] = { // Test CD SCD-2700/YEDS-18, DVD-SL HX-504, DVD-DL HX-505 +static const ElectMechaTaskPrep_t AutoAdjGCommands[] = { + // Test CD SCD-2700/YEDS-18, DVD-SL HX-504, DVD-DL HX-505 {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {3, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, @@ -294,9 +301,11 @@ static const ElectMechaTaskPrep_t AutoAdjGCommands[] = { // Test CD SCD-2700/ {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Remove disc and press ENTER", NULL}, {64, 0, 6000, MECHA_CMD_TRAY, "TRAY CLOSE", "00"}, {65, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; -static const ElectMechaTaskPrep_t AutoAdjG2Commands[] = { // Test CD SCD-2700, DVD-SL HX-504, DVD-DL HX-505 +static const ElectMechaTaskPrep_t AutoAdjG2Commands[] = { + // Test CD SCD-2700, DVD-SL HX-504, DVD-DL HX-505 {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {3, 0, 3000, MECHA_CMD_SLED_POS_HOME, "CD SLED HOME POSITION", NULL}, @@ -372,9 +381,11 @@ static const ElectMechaTaskPrep_t AutoAdjG2Commands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Remove disc and press ENTER", NULL}, {68, 0, 6000, MECHA_CMD_TRAY, "TRAY CLOSE", "00"}, {69, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; -static const ElectMechaTaskPrep_t AutoAdj140Commands[] = { // Test CD SCD-2700, DVD-SL TDV-520CSC, DVD-DL TDV-540CSC +static const ElectMechaTaskPrep_t AutoAdj140Commands[] = { + // Test CD SCD-2700, DVD-SL TDV-520CSC, DVD-DL TDV-540CSC {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {0, 0, 1000, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 1s", NULL}, @@ -476,9 +487,11 @@ static const ElectMechaTaskPrep_t AutoAdj140Commands[] = { // Test CD SCD-2700, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Remove disc and press ENTER", NULL}, {76, 0, 6000, MECHA_CMD_TRAY, "TRAY CLOSE", "00"}, {77, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; -static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { // Test CD SCD-2700, DVD-SL TDV-520CSC, DVD-DL TDV-540CSC +static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { + // Test CD SCD-2700, DVD-SL TDV-520CSC, DVD-DL TDV-540CSC {1, 0, 1000, MECHA_CMD_DISC_MODE_CD_12, "DISC MODE CD 12cm", NULL}, {2, 0, 3000, MECHA_CMD_FOCUS_UPDOWN, "FOCUS UP/DOWN END", "00"}, {0, 0, 1000, MECHA_TASK_UI_CMD_WAIT, "CD WAIT 1s", NULL}, @@ -569,7 +582,8 @@ static const ElectMechaTaskPrep_t AutoAdjSlimCommands[] = { // Test CD SCD-2700, {74, 0, 3000, MECHA_CMD_SLED_POS_HOME, "DVD-DL SLED HOME POSITION", NULL}, {0, 0, 0, MECHA_TASK_UI_CMD_MSG, "Open lid, remove disc, close lid and press ENTER", NULL}, {77, 0, 3000, MECHA_CMD_SLED_POS_HOME, "FIN (SLED HOME)", NULL}, - {-1, -1, -1, -1, NULL, NULL}}; + {0, 0, 0, 0, NULL, NULL}, +}; static int ElectJudgeOPTypeError(const char *result, int len) { @@ -954,7 +968,7 @@ static int ElectJudgeDVDDLL0Jitter256(const char *result, int len) else { PlatShowEMessage("DVD-DL-L0 jitter(256) NG: %d\n", value); - return (ConSlim == 1) ? 0 : 1; + return (ConSlim == 1) ? 0 : 1; } } @@ -1440,13 +1454,13 @@ static int ElectTxHandler(MechaTask_t *task) } return 0; case MECHA_CMD_TAG_ELECT_DVDSL_WR_WORK0_NEW: - sprintf(&task->args[4], "%04x", DiscDetectValue136); + snprintf(&task->args[4], 5, "%04x", DiscDetectValue136); return 0; case MECHA_CMD_TAG_ELECT_DISC_DET_CDMIN_WR: - sprintf(&task->args[4], "%04x", CDminCalc); + snprintf(&task->args[4], 5, "%04x", CDminCalc); return 0; case MECHA_CMD_TAG_ELECT_DISC_DET_DVDMAX_WR: - sprintf(&task->args[4], "%04x", DVDmaxCalc); + snprintf(&task->args[4], 5, "%04x", DVDmaxCalc); return 0; case MECHA_CMD_TAG_ELECT_DVDSL_MIRR_EEPROM_WR: if (DisableEEPMIRRWrite) From c523d1089066ac2299d948a9a35cc74ed66a1cf7 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:58:02 +0300 Subject: [PATCH 38/42] Makefile improved Co-authored by: Vadim Yanitskiy --- PMAP-unix/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PMAP-unix/Makefile b/PMAP-unix/Makefile index 44ec43a..777390a 100644 --- a/PMAP-unix/Makefile +++ b/PMAP-unix/Makefile @@ -1,12 +1,13 @@ VPATH = ./:../base/ ELF = pmap -CFLAGS = -O2 -I. +CFLAGS ?= -O2 +CPPFLAGS = -I. OBJS += eeprom-main.o eeprom.o elect.o elect-main.o mecha-main.o mecha.o updates.o platform-unix.o OBJS += main.o # Add -DID_MANAGEMENT when ID_MANAGEMENT is defined ifdef ID_MANAGEMENT -CFLAGS += -DID_MANAGEMENT +CPPFLAGS += -DID_MANAGEMENT OBJS += eeprom-id.o id-main.o endif From 39a5c35927cf063b11c71511adaad111dd989354 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:13:49 +0300 Subject: [PATCH 39/42] get rid of sprintf --- PMAP-wincli/platform-win.c | 2 +- PMAP-wingui/id-main.c | 32 ++++++++++++------------- PMAP-wingui/mecha-main.c | 8 +++---- PMAP-wingui/platform-wingui.c | 2 +- PMAP-wingui/winmain.c | 16 ++++++------- base/eeprom-id.c | 1 - base/eeprom.c | 44 +++++++++++++++++------------------ base/mecha-main.c | 8 +++---- base/mecha.c | 12 +++++----- base/updates.c | 2 +- 10 files changed, 63 insertions(+), 64 deletions(-) diff --git a/PMAP-wincli/platform-win.c b/PMAP-wincli/platform-win.c index dbd065b..3007267 100644 --- a/PMAP-wincli/platform-win.c +++ b/PMAP-wincli/platform-win.c @@ -21,7 +21,7 @@ void ListSerialDevices() for (int portNum = 1; portNum <= 256; portNum++) { - sprintf(dosDeviceName, "%s%d", comPortName, portNum); + snprintf(dosDeviceName, sizeof(dosDeviceName), "%s%d", comPortName, portNum); if (QueryDosDevice(dosDeviceName, targetPath, sizeof(targetPath)) != 0) { diff --git a/PMAP-wingui/id-main.c b/PMAP-wingui/id-main.c index bb35650..500770f 100644 --- a/PMAP-wingui/id-main.c +++ b/PMAP-wingui/id-main.c @@ -242,38 +242,38 @@ static void InitMenu(HWND hwnd) EEPROMGetiLinkID(iLinkID); EEPROMGetConsoleID(ConsoleID); - sprintf(value, "%02x", ConsoleID[0]); + snprintf(value, 3, "%02x", ConsoleID[0]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_0), value); - sprintf(value, "%02x", ConsoleID[1]); + snprintf(value, 3, "%02x", ConsoleID[1]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_1), value); - sprintf(value, "%02x", ConsoleID[2]); + snprintf(value, 3, "%02x", ConsoleID[2]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_2), value); - sprintf(value, "%02x", ConsoleID[3]); + snprintf(value, 3, "%02x", ConsoleID[3]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_3), value); - sprintf(value, "%02x", ConsoleID[4]); + snprintf(value, 3, "%02x", ConsoleID[4]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_4), value); - sprintf(value, "%02x", ConsoleID[5]); + snprintf(value, 3, "%02x", ConsoleID[5]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_5), value); - sprintf(value, "%02x", ConsoleID[6]); + snprintf(value, 3, "%02x", ConsoleID[6]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_6), value); - sprintf(value, "%02x", ConsoleID[7]); + snprintf(value, 3, "%02x", ConsoleID[7]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_CON_ID_7), value); - sprintf(value, "%02x", iLinkID[0]); + snprintf(value, 3, "%02x", iLinkID[0]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_0), value); - sprintf(value, "%02x", iLinkID[1]); + snprintf(value, 3, "%02x", iLinkID[1]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_1), value); - sprintf(value, "%02x", iLinkID[2]); + snprintf(value, 3, "%02x", iLinkID[2]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_2), value); - sprintf(value, "%02x", iLinkID[3]); + snprintf(value, 3, "%02x", iLinkID[3]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_3), value); - sprintf(value, "%02x", iLinkID[4]); + snprintf(value, 3, "%02x", iLinkID[4]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_4), value); - sprintf(value, "%02x", iLinkID[5]); + snprintf(value, 3, "%02x", iLinkID[5]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_5), value); - sprintf(value, "%02x", iLinkID[6]); + snprintf(value, 3, "%02x", iLinkID[6]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_6), value); - sprintf(value, "%02x", iLinkID[7]); + snprintf(value, 3, "%02x", iLinkID[7]); SetWindowTextA(GetDlgItem(hwnd, IDC_EDIT_ILINK_ID_7), value); if (ConType != MECHA_TYPE_36) diff --git a/PMAP-wingui/mecha-main.c b/PMAP-wingui/mecha-main.c index 54c81ad..0a6c8cd 100644 --- a/PMAP-wingui/mecha-main.c +++ b/PMAP-wingui/mecha-main.c @@ -1005,14 +1005,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { if (!pstricmp(argv[2], "IN")) { // Micro reverse - sprintf(args, "00%04x", StepAmount); + snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Micro forward - sprintf(args, "01%04x", StepAmount); + snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, "010064", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; @@ -1029,14 +1029,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { if (!pstricmp(argv[2], "IN")) { // Biphs reverse - sprintf(args, "00%04x", StepAmount); + snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Biphs forward - sprintf(args, "01%04x", StepAmount); + snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; diff --git a/PMAP-wingui/platform-wingui.c b/PMAP-wingui/platform-wingui.c index e4c87e9..810903a 100644 --- a/PMAP-wingui/platform-wingui.c +++ b/PMAP-wingui/platform-wingui.c @@ -23,7 +23,7 @@ static FILE *DebugOutputFile = NULL; for (int portNum = 1; portNum <= 256; portNum++) { - sprintf(dosDeviceName, "%s%d", comPortName, portNum); + snprintf(dosDeviceName, sizeof(dosDeviceName), "%s%d", comPortName, portNum); if (QueryDosDevice(dosDeviceName, targetPath, sizeof(targetPath)) != 0) { diff --git a/PMAP-wingui/winmain.c b/PMAP-wingui/winmain.c index 2ad8c18..691c9de 100644 --- a/PMAP-wingui/winmain.c +++ b/PMAP-wingui/winmain.c @@ -32,13 +32,13 @@ static void InitRawConVerInfoMenu(HWND hwnd) MechaGetMode(&tm, &md); RawData = MechaGetRawIdent(); - sprintf(buffer, "TestMode.%d MD1.%d", tm, md); + snprintf(buffer, sizeof(buffer), "TestMode.%d MD1.%d", tm, md); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_MD_VER), buffer); - sprintf(buffer, "0x%s", RawData->cfd); + snprintf(buffer, sizeof(buffer), "0x%s", RawData->cfd); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFD), buffer); - sprintf(buffer, "%#08x", RawData->cfc); + snprintf(buffer, sizeof(buffer), "%#08x", RawData->cfc); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CFC), buffer); - sprintf(buffer, "%#04x", RawData->VersionID); + snprintf(buffer, sizeof(buffer), "%#04x", RawData->VersionID); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CON_VER), buffer); } @@ -115,7 +115,7 @@ static void InitConsoleInfo(HWND hwnd) char buffer[32]; MechaGetMode(&tm, &md); - sprintf(buffer, "TestMode.%d MD1.%d", tm, md); + snprintf(buffer, sizeof(buffer), "TestMode.%d MD1.%d", tm, md); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_MD_VER), buffer); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_MECHACON), MechaGetDesc()); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_CEXDEX), MechaGetCEXDEX() == 0 ? "DEX" : "CEX"); @@ -131,11 +131,11 @@ static void InitConsoleInfo(HWND hwnd) if (EEPROMInitSerial() == MECHA_RTC_RICOH) { EEPROMGetSerial(&serial, &emcs); - sprintf(buffer, "%07u", serial); + snprintf(buffer, sizeof(buffer), "%07u", serial); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_SERIAL), buffer); - sprintf(buffer, "%02x", emcs); + snprintf(buffer, sizeof(buffer), "%02x", emcs); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_EMCS_ID), buffer); - sprintf(buffer, "%04x", EEPROMGetModelID()); + snprintf(buffer, sizeof(buffer), "%04x", EEPROMGetModelID()); SetWindowTextA(GetDlgItem(hwnd, IDC_STATIC_MODEL_ID), buffer); } else diff --git a/base/eeprom-id.c b/base/eeprom-id.c index 9d37de5..e34b19c 100644 --- a/base/eeprom-id.c +++ b/base/eeprom-id.c @@ -130,7 +130,6 @@ int MechaInitMechacon(int model, int IsDex) tm = localtime(&TimeNow); // Format: RRYYMMDDHHMMSSrrrr, where R = MagicGate region, Y = Year (from 2000), M = Month (1-12), D = Day of month (1-31), H = Hour (0-23), M = minute (0-59), S = second (0-59), r = random number (first 4 digits from the right). // The time and date format is made with Ctime::Format %y%m%d%H%M%S - // sprintf(data, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); snprintf(data, 19, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); printf("Shimuke: %s (%zu)\n", data, strlen(data)); MechaCommandAdd(MECHA_CMD_INIT_SHIMUKE, data, id++, 0, 6000, "WR INIT SHIMUKE"); diff --git a/base/eeprom.c b/base/eeprom.c index 003b028..68d4eff 100644 --- a/base/eeprom.c +++ b/base/eeprom.c @@ -123,7 +123,7 @@ int EEPROMReadWord(unsigned short int word, u16 *data) int result; char args[5], buffer[16]; - sprintf(args, "%04x", word); + snprintf(args, 5, "%04x", word); if ((result = MechaCommandExecute(MECHA_CMD_EEPROM_READ, MECHA_TASK_NORMAL_TO, args, buffer, sizeof(buffer))) == 9) { *data = (u16)strtoul(buffer + 5, NULL, 16); @@ -143,7 +143,7 @@ int EEPROMWriteWord(unsigned short int word, u16 data) char args[9], buffer[16]; int result; - sprintf(args, "%04x%04x", word, data); + snprintf(args, 9, "%04x%04x", word, data); if ((result = MechaCommandExecute(MECHA_CMD_EEPROM_WRITE, MECHA_TASK_NORMAL_TO, args, buffer, sizeof(buffer))) == 9) { result = 0; @@ -503,16 +503,16 @@ int EEPROMInitSerial(void) ConEmcs = 0; if (ConMD == 40) { - sprintf(address, "%04x", EEPROM_MAP_SERIAL_NEW_0); + snprintf(address, 5, "%04x", EEPROM_MAP_SERIAL_NEW_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_SERIAL_0, MECHA_TASK_NORMAL_TO, "SERIAL READ"); - sprintf(address, "%04x", EEPROM_MAP_SERIAL_NEW_1); + snprintf(address, 5, "%04x", EEPROM_MAP_SERIAL_NEW_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_SERIAL_1, MECHA_TASK_NORMAL_TO, "SERIAL READ"); } else { - sprintf(address, "%04x", EEPROM_MAP_SERIAL_0); + snprintf(address, 5, "%04x", EEPROM_MAP_SERIAL_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_SERIAL_0, MECHA_TASK_NORMAL_TO, "SERIAL READ"); - sprintf(address, "%04x", EEPROM_MAP_SERIAL_1); + snprintf(address, 5, "%04x", EEPROM_MAP_SERIAL_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_SERIAL_1, MECHA_TASK_NORMAL_TO, "SERIAL READ"); } @@ -534,40 +534,40 @@ int EEPROMInitModelName(void) memset(ConModelName, 0, sizeof(ConModelName)); if (ConMD == 40) { - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_0); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_0, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_1); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_1, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_2); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_2); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_2, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_3); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_3); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_3, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_4); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_4); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_4, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_5); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_5); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_5, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_6); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_6); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_6, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_NEW_7); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_NEW_7); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_7, MECHA_TASK_NORMAL_TO, "M NAME READ"); } else { - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_0); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_0); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_0, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_1); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_1); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_1, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_2); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_2); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_2, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_3); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_3); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_3, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_4); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_4); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_4, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_5); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_5); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_5, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_6); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_6); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_6, MECHA_TASK_NORMAL_TO, "M NAME READ"); - sprintf(address, "%04x", EEPROM_MAP_MODEL_NAME_7); + snprintf(address, 5, "%04x", EEPROM_MAP_MODEL_NAME_7); MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id++, MECHA_CMD_TAG_EEPROM_MODEL_NAME_7, MECHA_TASK_NORMAL_TO, "M NAME READ"); } if ((result = MechaCommandExecuteList(NULL, &EEPROMRxHandler)) == 0) diff --git a/base/mecha-main.c b/base/mecha-main.c index 0dba8d2..e1378df 100644 --- a/base/mecha-main.c +++ b/base/mecha-main.c @@ -1000,14 +1000,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { if (!pstricmp(argv[2], "IN")) { // Micro reverse - sprintf(args, "00%04x", StepAmount); + snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Micro forward - sprintf(args, "01%04x", StepAmount); + snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, "010064", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; @@ -1024,14 +1024,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { if (!pstricmp(argv[2], "IN")) { // Biphs reverse - sprintf(args, "00%04x", StepAmount); + snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Biphs forward - sprintf(args, "01%04x", StepAmount); + snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) printf("Error %d\n", result); SledIsAtHome = 0; diff --git a/base/mecha.c b/base/mecha.c index d40e9ef..4af824f 100644 --- a/base/mecha.c +++ b/base/mecha.c @@ -52,9 +52,9 @@ int MechaCommandExecute(unsigned short int command, unsigned short int timeout, int result = 0; if (args != NULL) - sprintf(cmd, "%03x%s\r\n", command, args); + snprintf(cmd, sizeof(cmd), "%03x%s\r\n", command, args); else - sprintf(cmd, "%03x\r\n", command); + snprintf(cmd, sizeof(cmd), "%03x\r\n", command); PlatDPrintf("PlatWriteCOMPort: %s", cmd); @@ -579,7 +579,7 @@ int MechaInitModel(void) { for (i = 0; EEPMapToInit[i] != 0xFFFF; i++, id++) { - sprintf(address, "%04x", EEPMapToInit[i]); + snprintf(address, 5, "%04x", EEPMapToInit[i]); if ((result = MechaCommandAdd(MECHA_CMD_EEPROM_READ, address, id, MECHA_CMD_TAG_INIT_EEP_READ, MECHA_TASK_NORMAL_TO, "READ EEPROM")) != 0) break; } @@ -812,7 +812,7 @@ int MechaAddPostUpdateCmds(unsigned char ClearOSD2InitBit, unsigned char id) { if (ClearOSD2InitBit) { - sprintf(value, "%04x%04x", EEPROM_MAP_OSD2_17, EEPMapRead(EEPROM_MAP_OSD2_17) & ~0x80); + snprintf(value, 9, "%04x%04x", EEPROM_MAP_OSD2_17, EEPMapRead(EEPROM_MAP_OSD2_17) & ~0x80); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, value, id++, 0, MECHA_TASK_NORMAL_TO, "CLEAR OSD2 INIT BIT"); } @@ -840,7 +840,7 @@ int MechaAddPostUpdateCmds(unsigned char ClearOSD2InitBit, unsigned char id) { if (ClearOSD2InitBit) { - sprintf(value, "%04x%04x", EEPROM_MAP_OSD2_17_NEW, EEPMapRead(EEPROM_MAP_OSD2_17_NEW) & ~0x80); + snprintf(value, 9, "%04x%04x", EEPROM_MAP_OSD2_17_NEW, EEPMapRead(EEPROM_MAP_OSD2_17_NEW) & ~0x80); MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, value, id++, 0, MECHA_TASK_NORMAL_TO, "CLEAR OSD2 INIT BIT"); } @@ -1228,6 +1228,6 @@ void MechaGetTimeString(char *TimeString) if (TimeInfo->tm_year + 1900 >= 2000) month |= 0x80; //'99 -> '00 Century bit year = itob(TimeInfo->tm_year % 100); - sprintf(TimeString, "%02x%02x%02x%02x%02x%02x%02x", itob(TimeInfo->tm_sec), itob(TimeInfo->tm_min), itob(TimeInfo->tm_hour), itob(TimeInfo->tm_wday), + snprintf(TimeString, 15, "%02x%02x%02x%02x%02x%02x%02x", itob(TimeInfo->tm_sec), itob(TimeInfo->tm_min), itob(TimeInfo->tm_hour), itob(TimeInfo->tm_wday), itob(TimeInfo->tm_mday), month, year); } diff --git a/base/updates.c b/base/updates.c index e7acc00..b5a8bcc 100644 --- a/base/updates.c +++ b/base/updates.c @@ -21,7 +21,7 @@ struct UpdateData static int AddUpdateItem(u16 word, u16 value, unsigned char index) { char args[16]; - sprintf(args, "%04x%04x", word, value); + snprintf(args, 9, "%04x%04x", word, value); return MechaCommandAdd(MECHA_CMD_EEPROM_WRITE, args, index, 0, MECHA_TASK_NORMAL_TO, "EEPROM WRITE"); } From 8c4e7fb17c37d8fba4ff7b777e0d24bf198e7eb1 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:29:36 +0300 Subject: [PATCH 40/42] fix segfault for garbage data --- base/mecha.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/base/mecha.c b/base/mecha.c index 4af824f..d3236b6 100644 --- a/base/mecha.c +++ b/base/mecha.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "platform.h" #include "mecha.h" @@ -15,6 +16,19 @@ char MechaName[9], RTCData[19]; static struct MechaIdentRaw MechaIdentRaw; unsigned char ConMD, ConType, ConTM, ConCEXDEX, ConOP, ConLens, ConRTC, ConRTCStat, ConECR, ConChecksumStat, ConSlim; +int is_valid_data(const char *data, int size) +{ + // Validate the received data + for (int i = 0; i < size; i++) + { + if (!isprint((unsigned char)data[i])) + { + return 0; + } + } + return 1; +} + int MechaCommandAdd(unsigned short int command, const char *args, unsigned char id, unsigned char tag, unsigned short int timeout, const char *label) { struct MechaTask *task; @@ -144,9 +158,18 @@ int MechaCommandExecuteList(MechaCommandTxHandler_t transmit, MechaCommandRxHand } else { + if (result == -EPIPE) + { + if (!is_valid_data(RxBuffer, size)) + { + PlatShowEMessage("Error: Connection problems, received invalid data for task ID %02d.\n", task->id); + result = -1; // Indicate an error + break; + } + PlatShowEMessage("%02d. %04x%s %s: 101 - rx-Command timed out\n", task->id, task->command, task->args, task->label); - break; + } } if (receive != NULL) @@ -1229,5 +1252,5 @@ void MechaGetTimeString(char *TimeString) month |= 0x80; //'99 -> '00 Century bit year = itob(TimeInfo->tm_year % 100); snprintf(TimeString, 15, "%02x%02x%02x%02x%02x%02x%02x", itob(TimeInfo->tm_sec), itob(TimeInfo->tm_min), itob(TimeInfo->tm_hour), itob(TimeInfo->tm_wday), - itob(TimeInfo->tm_mday), month, year); + itob(TimeInfo->tm_mday), month, year); } From a001b0c25f25568946cd694f2a3c8d4d81877b11 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:33:25 +0300 Subject: [PATCH 41/42] replace printf with PlatShowMessage --- PMAP-unix/platform-unix.c | 36 ++--- PMAP-wincli/platform-win.c | 12 +- PMAP-wingui/eeprom-main.c | 36 ++--- PMAP-wingui/id-main.c | 18 +-- PMAP-wingui/mecha-main.c | 232 ++++++++++++++++----------------- PMAP-wingui/platform-wingui.c | 12 +- base/eeprom-id.c | 2 +- base/eeprom-main.c | 116 ++++++++--------- base/elect-main.c | 4 +- base/id-main.c | 40 +++--- base/main.c | 30 ++--- base/mecha-main.c | 238 +++++++++++++++++----------------- 12 files changed, 388 insertions(+), 388 deletions(-) diff --git a/PMAP-unix/platform-unix.c b/PMAP-unix/platform-unix.c index bf746b9..c5a0028 100644 --- a/PMAP-unix/platform-unix.c +++ b/PMAP-unix/platform-unix.c @@ -26,7 +26,7 @@ int PlatOpenCOMPort(const char *device) if (ComPortHandle == -1) { // List available serial devices - printf("Available serial devices in /dev/:\n"); + PlatShowMessage("Available serial devices in /dev/:\n"); DIR *dir; const struct dirent *entry; @@ -37,24 +37,24 @@ int PlatOpenCOMPort(const char *device) { if (strncmp(entry->d_name, "cu.", 3) == 0) { - printf("/dev/%s\n", entry->d_name); + PlatShowMessage("/dev/%s\n", entry->d_name); } } closedir(dir); } - printf("Opening COM port: %s\n", device); + PlatShowMessage("Opening COM port: %s\n", device); ComPortHandle = open(device, O_RDWR | O_NOCTTY | O_NDELAY); if (ComPortHandle != -1) { - printf("COM port opened successfully.\n"); + PlatShowMessage("COM port opened successfully.\n"); fcntl(ComPortHandle, F_SETFL, 0); if (tcgetattr(ComPortHandle, &options) == -1) { - printf("Failed to get terminal attributes. Error code: %d\n", errno); + PlatShowMessage("Failed to get terminal attributes. Error code: %d\n", errno); close(ComPortHandle); ComPortHandle = -1; return errno; @@ -73,7 +73,7 @@ int PlatOpenCOMPort(const char *device) if (tcsetattr(ComPortHandle, TCSANOW, &options) == -1) { - printf("Failed to set terminal attributes. Error code: %d\n", errno); + PlatShowMessage("Failed to set terminal attributes. Error code: %d\n", errno); close(ComPortHandle); ComPortHandle = -1; return errno; @@ -81,7 +81,7 @@ int PlatOpenCOMPort(const char *device) if (tcflush(ComPortHandle, TCIOFLUSH) == -1) { - printf("Failed to flush terminal I/O. Error code: %d\n", errno); + PlatShowMessage("Failed to flush terminal I/O. Error code: %d\n", errno); close(ComPortHandle); ComPortHandle = -1; return errno; @@ -89,18 +89,18 @@ int PlatOpenCOMPort(const char *device) RxTimeout = MECHA_TASK_NORMAL_TO; - printf("COM port configuration set.\n"); + PlatShowMessage("COM port configuration set.\n"); result = 0; } else { result = errno; - printf("Failed to open COM port. Error code: %d\n", result); + PlatShowMessage("Failed to open COM port. Error code: %d\n", result); } } else { - printf("COM port is already open.\n"); + PlatShowMessage("COM port is already open.\n"); result = EMFILE; } @@ -113,7 +113,7 @@ int PlatReadCOMPort(char *data, int n, unsigned short timeout) if (ComPortHandle == -1) { - printf("COM port is not open.\n"); + PlatShowMessage("COM port is not open.\n"); return -1; // Return an error code indicating that the COM port is not open. } @@ -135,18 +135,18 @@ int PlatReadCOMPort(char *data, int n, unsigned short timeout) if (result < 0) { - printf("Read from COM port failed.\n"); + PlatShowMessage("Read from COM port failed.\n"); } } else if (result == 0) { // Timeout - printf("Read from COM port timed out.\n"); + PlatShowMessage("Read from COM port timed out.\n"); } else { // Error - printf("Select function error.\n"); + PlatShowMessage("Select function error.\n"); } return result; @@ -159,7 +159,7 @@ int PlatWriteCOMPort(const char *data) if (result < 0) { - printf("Write to COM port failed.\n"); + PlatShowMessage("Write to COM port failed.\n"); } return result; @@ -169,14 +169,14 @@ void PlatCloseCOMPort(void) { if (ComPortHandle != -1) { - printf("Closing COM port...\n"); + PlatShowMessage("Closing COM port...\n"); close(ComPortHandle); ComPortHandle = -1; - printf("COM port closed.\n"); + PlatShowMessage("COM port closed.\n"); } else { - printf("COM port is already closed.\n"); + PlatShowMessage("COM port is already closed.\n"); } } diff --git a/PMAP-wincli/platform-win.c b/PMAP-wincli/platform-win.c index 3007267..6d3b334 100644 --- a/PMAP-wincli/platform-win.c +++ b/PMAP-wincli/platform-win.c @@ -25,8 +25,8 @@ void ListSerialDevices() if (QueryDosDevice(dosDeviceName, targetPath, sizeof(targetPath)) != 0) { - printf("Found COM Port: %s\n", dosDeviceName); - printf("Target Path: %s\n", targetPath); + PlatShowMessage("Found COM Port: %s\n", dosDeviceName); + PlatShowMessage("Target Path: %s\n", targetPath); } } } @@ -106,7 +106,7 @@ int PlatWriteCOMPort(const char *data) if (result < 0) { - printf("Write to COM port failed.\n"); + PlatShowMessage("Write to COM port failed.\n"); } return result; @@ -116,14 +116,14 @@ void PlatCloseCOMPort(void) { if (ComPortHandle != INVALID_HANDLE_VALUE) { - printf("Closing COM port...\n"); + PlatShowMessage("Closing COM port...\n"); CloseHandle(ComPortHandle); ComPortHandle = INVALID_HANDLE_VALUE; - printf("COM port closed.\n"); + PlatShowMessage("COM port closed.\n"); } else { - printf("COM port is already closed.\n"); + PlatShowMessage("COM port is already closed.\n"); } } diff --git a/PMAP-wingui/eeprom-main.c b/PMAP-wingui/eeprom-main.c index 3bb69e2..2a750f0 100644 --- a/PMAP-wingui/eeprom-main.c +++ b/PMAP-wingui/eeprom-main.c @@ -105,7 +105,7 @@ static int UpdateEEPROM(HWND hwndDlg) { do { - printf("Please select the optical block:\n" + PlatShowMessage("Please select the optical block:\n" "\t1. SONY\n" "\t2. SANYO\n" "Your choice: "); @@ -124,7 +124,7 @@ static int UpdateEEPROM(HWND hwndDlg) { do { - printf("Please select the object lens:\n" + PlatShowMessage("Please select the object lens:\n" "\t1. T487\n" "\t2. T609K\n" "Your choice: "); @@ -143,7 +143,7 @@ static int UpdateEEPROM(HWND hwndDlg) { do { - printf("The OSD2 init bit is set. Clear it? (y/n)"); + PlatShowMessage("The OSD2 init bit is set. Clear it? (y/n)"); choice = getchar(); while (getchar() != '\n') { @@ -154,35 +154,35 @@ static int UpdateEEPROM(HWND hwndDlg) if ((result = selected->update(ClearOSD2InitBit, ReplacedMecha, ObjectLens, OpticalBlock)) > 0) { - printf("Actions available:\n"); + PlatShowMessage("Actions available:\n"); if (result & UPDATE_REGION_EEP_ECR) - printf("\tEEPROM ECR\n"); + PlatShowMessage("\tEEPROM ECR\n"); if (result & UPDATE_REGION_DISCDET) - printf("\tDisc detect\n"); + PlatShowMessage("\tDisc detect\n"); if (result & UPDATE_REGION_SERVO) - printf("\tServo\n"); + PlatShowMessage("\tServo\n"); if (result & UPDATE_REGION_TILT) - printf("\tAuto-tilt\n"); + PlatShowMessage("\tAuto-tilt\n"); if (result & UPDATE_REGION_TRAY) - printf("\tTray\n"); + PlatShowMessage("\tTray\n"); if (result & UPDATE_REGION_EEGS) - printf("\tEE & GS\n"); + PlatShowMessage("\tEE & GS\n"); if (result & UPDATE_REGION_ECR) - printf("\tRTC ECR\n"); + PlatShowMessage("\tRTC ECR\n"); if (result & UPDATE_REGION_RTC) { - printf("\tRTC:\n"); + PlatShowMessage("\tRTC:\n"); if (result & UPDATE_REGION_RTC_CTL12) - printf("\t\tRTC CTL1,2 ERROR\n"); + PlatShowMessage("\t\tRTC CTL1,2 ERROR\n"); if (result & UPDATE_REGION_RTC_TIME) - printf("\t\tRTC TIME ERROR\n"); + PlatShowMessage("\t\tRTC TIME ERROR\n"); } if (result & UPDATE_REGION_DEFAULTS) - printf("\tMechacon defaults\n"); + PlatShowMessage("\tMechacon defaults\n"); do { - printf("Proceed with updates? (y/n) "); + PlatShowMessage("Proceed with updates? (y/n) "); choice = getchar(); while (getchar() != '\n') { @@ -200,14 +200,14 @@ static int UpdateEEPROM(HWND hwndDlg) } else { - printf("An error occurred. Wrong chassis selected?\n"); + PlatShowMessage("An error occurred. Wrong chassis selected?\n"); } return result; } else { - printf("Unsupported chassis selected.\n"); + PlatShowMessage("Unsupported chassis selected.\n"); return -EINVAL; } } diff --git a/PMAP-wingui/id-main.c b/PMAP-wingui/id-main.c index 500770f..cfd4a03 100644 --- a/PMAP-wingui/id-main.c +++ b/PMAP-wingui/id-main.c @@ -27,7 +27,7 @@ extern unsigned char ConType, ConCEXDEX; { do { - printf("MECHACON initialization for H/I-chassis\n" + PlatShowMessage("MECHACON initialization for H/I-chassis\n" "Select type:\n" "\t1. CEX\n" "\t2. DEX\n" @@ -58,7 +58,7 @@ extern unsigned char ConType, ConCEXDEX; { if (!dex) { - printf("Select model Name:\n" + PlatShowMessage("Select model Name:\n" "\t1. SCPH-xx000 (Japan)\n" "\t2. SCPH-xx001 (USA)\n" "\t3. SCPH-xx002 (Australia)\n" @@ -78,7 +78,7 @@ extern unsigned char ConType, ConCEXDEX; } else { - printf("Select model Name:\n" + PlatShowMessage("Select model Name:\n" "\t1. DTL-H50000\n" "\t2. DTL-H50001\n" "\t3. DTL-H50002\n" @@ -113,7 +113,7 @@ extern unsigned char ConType, ConCEXDEX; case 11: case 12: case 13: - printf("MechaInit: %s\n", MechaInitMechacon(choice, 0) == 0 ? "done" : "failed"); + PlatShowMessage("MechaInit: %s\n", MechaInitMechacon(choice, 0) == 0 ? "done" : "failed"); break; case 14: done = 1; @@ -130,7 +130,7 @@ extern unsigned char ConType, ConCEXDEX; case 5: case 6: case 7: - printf("MechaInit: %s\n", MechaInitMechacon(choice, 1) == 0 ? "done" : "failed"); + PlatShowMessage("MechaInit: %s\n", MechaInitMechacon(choice, 1) == 0 ? "done" : "failed"); break; case 8: done = 1; @@ -140,7 +140,7 @@ extern unsigned char ConType, ConCEXDEX; } } else - printf("MechaInit: Unsupported chassis.\n"); + PlatShowMessage("MechaInit: Unsupported chassis.\n"); } static void InitNTSCPALDefaults(void) @@ -149,7 +149,7 @@ static void InitNTSCPALDefaults(void) do { - printf("NTSC/PAL selection:\n" + PlatShowMessage("NTSC/PAL selection:\n" "\t1. NTSC\n" "\t2. PAL\n" "\t3. Quit\n" @@ -164,10 +164,10 @@ static void InitNTSCPALDefaults(void) switch (choice) { case 1: - printf("Init NTSC defaults: %s\n", EEPROMNTSCPALDefaults(0) == 0 ? "completed" : "failed"); + PlatShowMessage("Init NTSC defaults: %s\n", EEPROMNTSCPALDefaults(0) == 0 ? "completed" : "failed"); break; case 2: - printf("Init PAL defaults: %s\n", EEPROMNTSCPALDefaults(1) == 0 ? "completed" : "failed"); + PlatShowMessage("Init PAL defaults: %s\n", EEPROMNTSCPALDefaults(1) == 0 ? "completed" : "failed"); break; } } */ diff --git a/PMAP-wingui/mecha-main.c b/PMAP-wingui/mecha-main.c index 0a6c8cd..6b44325 100644 --- a/PMAP-wingui/mecha-main.c +++ b/PMAP-wingui/mecha-main.c @@ -125,29 +125,29 @@ static int MechaAdjTxHandler(MechaTask_t *task) switch (DiscDetect) { case DISC_TYPE_CD12: - printf("Disc type CD 12cm\n"); + PlatShowMessage("Disc type CD 12cm\n"); task->command = MECHA_CMD_DISC_MODE_CD_12; status = MECHA_ADJ_STATE_CD; return 0; case DISC_TYPE_DVDS12: - printf("Disc type DVD-SL 12cm\n"); + PlatShowMessage("Disc type DVD-SL 12cm\n"); task->command = MECHA_CMD_DISC_MODE_DVDSL_12; status = MECHA_ADJ_STATE_DVDSL; return 0; case DISC_TYPE_DVDD12: - printf("Disc type DVD-DL 12cm\n"); + PlatShowMessage("Disc type DVD-DL 12cm\n"); task->command = MECHA_CMD_DISC_MODE_DVDDL_12; status = MECHA_ADJ_STATE_DVDDL; return 0; case DISC_TYPE_UNKNOWN: - printf("Disc type unknown.\n"); + PlatShowMessage("Disc type unknown.\n"); task->id = 0; task->tag = 0; task->command = 0; status = MECHA_ADJ_STATE_NONE; return 0; case DISC_TYPE_NO_DISC: - printf("No disc inserted.\n"); + PlatShowMessage("No disc inserted.\n"); task->id = 0; task->tag = 0; task->command = 0; @@ -155,7 +155,7 @@ static int MechaAdjTxHandler(MechaTask_t *task) return 0; default: status = MECHA_ADJ_STATE_NONE; - printf("Unsupported disc type: %02x\n", DiscDetect); + PlatShowMessage("Unsupported disc type: %02x\n", DiscDetect); return 1; } default: @@ -391,7 +391,7 @@ static int MechaAdjInit(short int argc, char *argv[]) case MECHA_TYPE_40: break; default: - printf("MechaAdjInit: Unsupported chassis.\n"); + PlatShowMessage("MechaAdjInit: Unsupported chassis.\n"); return 0; } @@ -414,7 +414,7 @@ static int MechaAdjInit(short int argc, char *argv[]) case MECHA_ADJ_STATE_DVDDL_1: case MECHA_ADJ_STATE_DVDDL_1p6: case MECHA_ADJ_STATE_DVDDL_1p64: - printf("Please STOP the drive first! Currently in another PLAY mode.\n"); + PlatShowMessage("Please STOP the drive first! Currently in another PLAY mode.\n"); return 0; } @@ -441,7 +441,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "CD STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("CD initialization failed.\n"); + PlatShowMessage("CD initialization failed.\n"); else status = MECHA_ADJ_STATE_CD; @@ -468,7 +468,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "DVD-SL STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("DVD-SL initialization failed.\n"); + PlatShowMessage("DVD-SL initialization failed.\n"); else status = MECHA_ADJ_STATE_DVDSL; @@ -494,7 +494,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "DVD-DL STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("DVD-DL initialization failed.\n"); + PlatShowMessage("DVD-DL initialization failed.\n"); else status = MECHA_ADJ_STATE_DVDDL; @@ -521,7 +521,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "DVD-SL STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("DVD-SL initialization failed.\n"); + PlatShowMessage("DVD-SL initialization failed.\n"); else status = MECHA_ADJ_STATE_DVDSL; @@ -547,7 +547,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) switch (status) { case MECHA_ADJ_STATE_NONE: - printf("Please do initialization first!\n"); + PlatShowMessage("Please do initialization first!\n"); break; case MECHA_ADJ_STATE_DVDDL_PAUSE: case MECHA_ADJ_STATE_DVDDL_1: @@ -556,7 +556,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) if (!pstricmp(argv[1], "FJ")) { if ((result = MechaCommandExecute(MECHA_CMD_FOCUS_JUMP, 2000, "0300", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); break; } case MECHA_ADJ_STATE_DVDSL_PAUSE: @@ -569,7 +569,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_4: case MECHA_ADJ_STATE_CD_512: case MECHA_ADJ_STATE_CD_1024: - printf("Please STOP the drive. It is currently in PLAY mode.\n"); + PlatShowMessage("Please STOP the drive. It is currently in PLAY mode.\n"); break; case MECHA_ADJ_STATE_CD: speed = (int)strtol(argv[1], NULL, 0); @@ -597,7 +597,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) command = MECHA_CMD_CD_PLAY_5; break; default: - printf("Unsupported speed.\n"); + PlatShowMessage("Unsupported speed.\n"); timeout = 0; command = 0; } @@ -605,7 +605,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) if (command != 0) { if ((result = MechaCommandExecute(command, timeout, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else status += speed; @@ -631,7 +631,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) command = MECHA_CMD_DVD_PLAY_3; break; default: - printf("Unsupported speed.\n"); + PlatShowMessage("Unsupported speed.\n"); timeout = 0; command = 0; } @@ -639,7 +639,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) if (command != 0) { if ((result = MechaCommandExecute(command, timeout, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else status += speed; @@ -668,7 +668,7 @@ static int MechaAdjStop(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_512: case MECHA_ADJ_STATE_CD_1024: if ((result = MechaCommandExecute(MECHA_CMD_CD_STOP, 4000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); status = MECHA_ADJ_STATE_CD; break; case MECHA_ADJ_STATE_DVDSL_PAUSE: @@ -680,7 +680,7 @@ static int MechaAdjStop(short int argc, char *argv[]) case MECHA_ADJ_STATE_DVDDL_1p6: case MECHA_ADJ_STATE_DVDDL_1p64: if ((result = MechaCommandExecute(MECHA_CMD_DVD_STOP, 5000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); switch (status) { @@ -699,7 +699,7 @@ static int MechaAdjStop(short int argc, char *argv[]) } break; default: - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } return 0; @@ -711,7 +711,7 @@ static int MechaAdjAutoTilt(short int argc, char *argv[]) if (!IsAutoTiltModel()) { - printf("This is not a B-chassis (non-auto-tilt motor model).\n"); + PlatShowMessage("This is not a B-chassis (non-auto-tilt motor model).\n"); return 0; } @@ -722,13 +722,13 @@ static int MechaAdjAutoTilt(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_INIT_AUTO_TILT, NULL, id++, 0, 5000, "AUTO TILT INIT"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "ADJ")) { MechaCommandAdd(MECHA_CMD_ADJ_AUTO_TILT, "00", id++, 0, 15000, "TILT ADJUST"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "WRITE")) { @@ -744,19 +744,19 @@ static int MechaAdjAutoTilt(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_WRITE_CHECKSUM, "00", id++, 0, 3000, "EEPROM WRITE CHECKSUM"); MechaCommandAdd(MECHA_CMD_READ_CHECKSUM, "00", id++, 0, 3000, "EEPROM READ CHECKSUM"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "REV")) { MechaCommandAdd(MECHA_CMD_MOV_AUTO_TILT, "000001", id++, 0, 5000, "TILT ADJUST REV"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "FWD")) { MechaCommandAdd(MECHA_CMD_MOV_AUTO_TILT, "010001", id++, 0, 5000, "TILT ADJUST FWD"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -777,7 +777,7 @@ static int MechaAdjPause(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_PAUSE: case MECHA_ADJ_STATE_DVDSL_PAUSE: case MECHA_ADJ_STATE_DVDDL_PAUSE: - printf("Already paused.\n"); + PlatShowMessage("Already paused.\n"); break; case MECHA_ADJ_STATE_CD_1: case MECHA_ADJ_STATE_CD_2: @@ -785,7 +785,7 @@ static int MechaAdjPause(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_512: case MECHA_ADJ_STATE_CD_1024: if ((result = MechaCommandExecute(MECHA_CMD_CD_PAUSE, 3000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); break; case MECHA_ADJ_STATE_DVDSL_1: case MECHA_ADJ_STATE_DVDSL_1p6: @@ -794,7 +794,7 @@ static int MechaAdjPause(short int argc, char *argv[]) case MECHA_ADJ_STATE_DVDDL_1p6: case MECHA_ADJ_STATE_DVDDL_1p64: if ((result = MechaCommandExecute(MECHA_CMD_DVD_PAUSE, 5000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); switch (status) { @@ -811,7 +811,7 @@ static int MechaAdjPause(short int argc, char *argv[]) } break; default: - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } return 0; @@ -828,37 +828,37 @@ static int MechaAdjTray(short int argc, char *argv[]) { if (!SledIsAtHome) { - printf("Sled must be in home position!\n"); + PlatShowMessage("Sled must be in home position!\n"); return 0; } if ((result = MechaCommandExecute(MECHA_CMD_TRAY, 6000, "00", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else if (!pstricmp(argv[1], "OPEN")) { if (!SledIsAtHome) { - printf("Sled must be in home position!\n"); + PlatShowMessage("Sled must be in home position!\n"); return 0; } if ((result = MechaCommandExecute(MECHA_CMD_TRAY, 6000, "01", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else if (!pstricmp(argv[1], "IN-SW")) { if ((result = MechaCommandExecute(MECHA_CMD_TRAY_SW, 3000, "00", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("IN-SW: %s\n", buffer); + PlatShowMessage("IN-SW: %s\n", buffer); } else if (!pstricmp(argv[1], "OUT-SW")) { if ((result = MechaCommandExecute(MECHA_CMD_TRAY_SW, 3000, "01", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("OUT-SW: %s\n", buffer); + PlatShowMessage("OUT-SW: %s\n", buffer); } else return -EINVAL; @@ -879,23 +879,23 @@ static int MechaAdjJitter(short int argc, char *argv[]) if (!pstricmp(argv[1], "1")) { if ((result = MechaCommandExecute(MECHA_CMD_JITTER, 1000, "00", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("%s\n", &buffer[1]); + PlatShowMessage("%s\n", &buffer[1]); } else if (!pstricmp(argv[1], "16")) { if ((result = MechaCommandExecute(MECHA_CMD_JITTER, 1000, "02", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("%s\n", &buffer[1]); + PlatShowMessage("%s\n", &buffer[1]); } else if (!pstricmp(argv[1], "256")) { if ((result = MechaCommandExecute(MECHA_CMD_JITTER, 2000, "01", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("%s\n", &buffer[1]); + PlatShowMessage("%s\n", &buffer[1]); } else return -EINVAL; @@ -924,7 +924,7 @@ static int MechaAdjGetError(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_DSP_ERROR_RATE, "00", id++, MECHA_CMD_TAG_MECHA_DVD_ERROR_RATE, 2000, "DVD GET DSP ERROR RATE"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) == 0) { - printf("DVD Error Data:\n" + PlatShowMessage("DVD Error Data:\n" "PI Correct:\t\t%#04x\tPO Correct:\t\t%#04x\n" "PI Non-correct:\t%#04x\tPO Non-correct:\t%#04x\n" "PI Max:\t\t\t%#04x\tPO Max:\t\t\t%#04x\n" @@ -934,10 +934,10 @@ static int MechaAdjGetError(short int argc, char *argv[]) DvdError.jitter); } else - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); break; default: - printf("Not in a DVD PLAY mode.\n"); + PlatShowMessage("Not in a DVD PLAY mode.\n"); } } else if (!pstricmp(argv[1], "CD")) @@ -952,13 +952,13 @@ static int MechaAdjGetError(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_CD_ERROR, "00", id++, MECHA_CMD_TAG_MECHA_CD_ERROR_RATE, 2000, "CD GET DSP ERROR RATE"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) == 0) { - printf("%04x:::%04x\n", CdError.c1, CdError.c2); + PlatShowMessage("%04x:::%04x\n", CdError.c1, CdError.c2); } else - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); break; default: - printf("Not in a CD PLAY mode.\n"); + PlatShowMessage("Not in a CD PLAY mode.\n"); } } else @@ -977,26 +977,26 @@ static int MechaAdjSled(short int argc, char *argv[]) if (!pstricmp(argv[1], "HOME")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_POS_HOME, 3000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else SledIsAtHome = 1; } else if (!pstricmp(argv[1], "IN")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_POS, 2000, "00", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[1], "OUT")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_POS, 3000, "02", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[1], "MID")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_POS, 3000, "01", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[1], "STEP-M")) @@ -1007,14 +1007,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { // Micro reverse snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Micro forward snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, "010064", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else @@ -1031,14 +1031,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { // Biphs reverse snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Biphs forward snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else @@ -1054,12 +1054,12 @@ static int MechaAdjSled(short int argc, char *argv[]) if (!pstricmp(argv[2], "ON")) { if ((result = MechaCommandExecute(MECHA_CMD_TRACKING, 1000, "01", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else if (!pstricmp(argv[2], "OFF")) { if ((result = MechaCommandExecute(MECHA_CMD_TRACKING, 1000, "00", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else return -EINVAL; @@ -1070,11 +1070,11 @@ static int MechaAdjSled(short int argc, char *argv[]) else if (!pstricmp(argv[1], "IN-SW")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_IN_SW, 1000, NULL, buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { result = (int)strtoul(&buffer[1], NULL, 16); - printf("IN-SW: %02x\n", result); + PlatShowMessage("IN-SW: %02x\n", result); } } else if (!pstricmp(argv[1], "STEP")) @@ -1082,7 +1082,7 @@ static int MechaAdjSled(short int argc, char *argv[]) if (argc == 3) { StepAmount = (unsigned short int)strtoul(argv[2], NULL, 0); - printf("STEP: %u\n", StepAmount); + PlatShowMessage("STEP: %u\n", StepAmount); } else return -EINVAL; @@ -1103,10 +1103,10 @@ static int DisplayHelp(const struct MechaDiagCommand *commands, short int argc, if (argc == 1) { - printf("To get help for a specific command, type HELP \n" + PlatShowMessage("To get help for a specific command, type HELP \n" "Available commands:\n"); for (pCmd = commands, i = 0; pCmd->command != NULL; pCmd++, i++) - printf("\t%s%c", pCmd->command, (i != 0 && i % 4 == 0) ? '\n' : ' '); + PlatShowMessage("\t%s%c", pCmd->command, (i != 0 && i % 4 == 0) ? '\n' : ' '); putchar('\n'); } else if (argc == 2) @@ -1115,13 +1115,13 @@ static int DisplayHelp(const struct MechaDiagCommand *commands, short int argc, { if (!pstricmp(pCmd->command, argv[1])) { - printf("%s - %s\n", pCmd->syntax, pCmd->description); + PlatShowMessage("%s - %s\n", pCmd->syntax, pCmd->description); break; } } if (pCmd->command == NULL) - printf("No such command.\n"); + PlatShowMessage("No such command.\n"); } else { @@ -1158,7 +1158,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) if (!pstricmp(argv[1], "CD")) { if ((result = MechaCommandExecute(MECHA_CMD_DISC_MODE_CD_12, 1000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { status = MECHA_ADJ_STATE_CD; @@ -1168,7 +1168,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) else if (!pstricmp(argv[1], "DVD-SL")) { if ((result = MechaCommandExecute(MECHA_CMD_DISC_MODE_DVDSL_12, 1000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { status = MECHA_ADJ_STATE_DVDSL; @@ -1178,7 +1178,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) else if (!pstricmp(argv[1], "DVD-DL")) { if ((result = MechaCommandExecute(MECHA_CMD_DISC_MODE_DVDDL_12, 1000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { status = MECHA_ADJ_STATE_DVDDL; @@ -1190,7 +1190,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_DISC_DETECT, NULL, id++, MECHA_CMD_TAG_MECHA_DISC_DETECT, 3000, "DISC DETECT"); MechaCommandAdd(MECHA_CMD_DISC_MODE_CD_8, NULL, id++, MECHA_CMD_TAG_MECHA_SET_DISC_TYPE, 1000, "DISC MODE CD 8cm"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1212,13 +1212,13 @@ static int MechaTestLaserControl(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_LASER_DIODE, "01", id++, 0, 3000, "LD ON"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "OFF")) { MechaCommandAdd(MECHA_CMD_LASER_DIODE, "00", id++, 0, 3000, "LD OFF"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1235,13 +1235,13 @@ static int MechaTestLaserControl(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "01", id++, 0, 3000, "FOCUS UP/DOWN START"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[3], "STOP")) { MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "FOCUS UP/DOWN STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1252,13 +1252,13 @@ static int MechaTestLaserControl(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_FOCUS_AUTO_START, NULL, id++, 0, 3000, "AUTO FOCUS START"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[3], "STOP")) { MechaCommandAdd(MECHA_CMD_FOCUS_AUTO_STOP, NULL, id++, 0, 3000, "AUTO FOCUS STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1284,7 +1284,7 @@ static int MechaTestServoControl(short int argc, char *argv[]) if (DiscDetect == 0xFF) { - printf("Disc type/circuit not set up!\n"); + PlatShowMessage("Disc type/circuit not set up!\n"); return 0; } @@ -1296,7 +1296,7 @@ static int MechaTestServoControl(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_SLED_POS_HOME, NULL, id++, 0, 3000, "SLED HOME"); MechaCommandAdd(MECHA_CMD_AUTO_ADJ_ST_12, "00", id++, 0, 40000, "SERVO AUTO ADJ START"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1313,7 +1313,7 @@ static int MechaTestPlay(short int argc, char *argv[]) if (DiscDetect == 0xFF) { - printf("Disc type/circuit not set up!\n"); + PlatShowMessage("Disc type/circuit not set up!\n"); return 0; } @@ -1327,7 +1327,7 @@ static int MechaTestPlay(short int argc, char *argv[]) case DISC_TYPE_CD12: MechaCommandAdd(MECHA_CMD_CD_PLAY_1, NULL, id++, 0, 3000, "PLAY CD 12cm"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); else status = MECHA_ADJ_STATE_CD_1; break; @@ -1335,7 +1335,7 @@ static int MechaTestPlay(short int argc, char *argv[]) case DISC_TYPE_DVDD12: MechaCommandAdd(MECHA_CMD_DVD_PLAY_1, NULL, id++, 0, 5000, "PLAY DVD 12cm"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); else { switch (DiscDetect) @@ -1359,10 +1359,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_CTL, "01000A", id++, 0, 5000, "CD FWD 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1370,10 +1370,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_CTL, "01000A", id++, 0, 5000, "DVD FWD 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "REV")) @@ -1385,10 +1385,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_CTL, "00000A", id++, 0, 5000, "CD REV 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1396,10 +1396,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_CTL, "00000A", id++, 0, 5000, "DVD REV 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "FWDL")) @@ -1411,10 +1411,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_LONG_CTL, "010001", id++, 0, 10000, "CD FWD LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1422,10 +1422,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_LONG_CTL, "010001", id++, 0, 10000, "DVD FWD LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "REVL")) @@ -1437,10 +1437,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_LONG_CTL, "000001", id++, 0, 10000, "CD REV LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1448,10 +1448,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_LONG_CTL, "000001", id++, 0, 10000, "DVD REV LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "STOP")) @@ -1463,12 +1463,12 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_STOP, NULL, id++, 0, 20000, "CD STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); status = MECHA_ADJ_STATE_CD; } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1476,7 +1476,7 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_STOP, NULL, id++, 0, 20000, "DVD STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); switch (status) { @@ -1488,7 +1488,7 @@ static int MechaTestPlay(short int argc, char *argv[]) } } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "FJ")) @@ -1499,13 +1499,13 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_FOCUS_JUMP, "0205", id++, 0, 2000, "DVD-DL FOCUS JUMP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } else - printf("Not a DVD-DL.\n"); + PlatShowMessage("Not a DVD-DL.\n"); } else return -EINVAL; @@ -1527,31 +1527,31 @@ static int MechaTestSpindle(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_SP_CTL, "01", id++, 0, 3000, "SP KICK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "BRAKE")) { MechaCommandAdd(MECHA_CMD_SP_CTL, "00", id++, 0, 3000, "SP BRAKE"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "STOP")) { MechaCommandAdd(MECHA_CMD_SP_CTL, "02", id++, 0, 3000, "SP STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "CLV-S")) { MechaCommandAdd(MECHA_CMD_SP_CLV_S, NULL, id++, 0, 3000, "SP CLV-S"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "CLV-A")) { MechaCommandAdd(MECHA_CMD_SP_CLV_A, NULL, id++, 0, 3000, "SP CLV-A"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1579,7 +1579,7 @@ static void MechaCommonMain(const struct MechaDiagCommand *commands, char prompt previous[0] = '\0'; do { - printf("MD1.%d %c> ", md, prompt); + PlatShowMessage("MD1.%d %c> ", md, prompt); if (fgets(input, sizeof(input), stdin)) { input[strlen(input) - 1] = '\0'; @@ -1605,7 +1605,7 @@ static void MechaCommonMain(const struct MechaDiagCommand *commands, char prompt if ((result = pCmd->function(argc, argv)) < 0) { if (result == -EINVAL) - printf(MECHA_ADJ_SYNTAX_ERR); + PlatShowMessage(MECHA_ADJ_SYNTAX_ERR); } else { @@ -1613,7 +1613,7 @@ static void MechaCommonMain(const struct MechaDiagCommand *commands, char prompt } } else - printf("Unrecognized command. For help, type HELP.\n"); + PlatShowMessage("Unrecognized command. For help, type HELP.\n"); } } while (!done); } @@ -1633,7 +1633,7 @@ static int MechaAdjPromptT10K(void) char input; do { - printf("Is this a DTL-T10000? [y,n] "); + PlatShowMessage("Is this a DTL-T10000? [y,n] "); input = getchar(); while (getchar() != '\n') { diff --git a/PMAP-wingui/platform-wingui.c b/PMAP-wingui/platform-wingui.c index 810903a..924ac20 100644 --- a/PMAP-wingui/platform-wingui.c +++ b/PMAP-wingui/platform-wingui.c @@ -27,8 +27,8 @@ static FILE *DebugOutputFile = NULL; if (QueryDosDevice(dosDeviceName, targetPath, sizeof(targetPath)) != 0) { - printf("Found COM Port: %s\n", dosDeviceName); - printf("Target Path: %s\n", targetPath); + PlatShowMessage("Found COM Port: %s\n", dosDeviceName); + PlatShowMessage("Target Path: %s\n", targetPath); } } } */ @@ -108,7 +108,7 @@ int PlatWriteCOMPort(const char *data) if (result < 0) { - printf("Write to COM port failed.\n"); + PlatShowMessage("Write to COM port failed.\n"); } return result; @@ -118,14 +118,14 @@ void PlatCloseCOMPort(void) { if (ComPortHandle != INVALID_HANDLE_VALUE) { - printf("Closing COM port...\n"); + PlatShowMessage("Closing COM port...\n"); CloseHandle(ComPortHandle); ComPortHandle = INVALID_HANDLE_VALUE; - printf("COM port closed.\n"); + PlatShowMessage("COM port closed.\n"); } else { - printf("COM port is already closed.\n"); + PlatShowMessage("COM port is already closed.\n"); } } diff --git a/base/eeprom-id.c b/base/eeprom-id.c index e34b19c..1fcb81f 100644 --- a/base/eeprom-id.c +++ b/base/eeprom-id.c @@ -131,7 +131,7 @@ int MechaInitMechacon(int model, int IsDex) // Format: RRYYMMDDHHMMSSrrrr, where R = MagicGate region, Y = Year (from 2000), M = Month (1-12), D = Day of month (1-31), H = Hour (0-23), M = minute (0-59), S = second (0-59), r = random number (first 4 digits from the right). // The time and date format is made with Ctime::Format %y%m%d%H%M%S snprintf(data, 19, "%02x%02d%02d%02d%02d%02d%02d%04d", region->region, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rand() % 10000); - printf("Shimuke: %s (%zu)\n", data, strlen(data)); + PlatShowMessage("Shimuke: %s (%zu)\n", data, strlen(data)); MechaCommandAdd(MECHA_CMD_INIT_SHIMUKE, data, id++, 0, 6000, "WR INIT SHIMUKE"); MechaCommandAdd(MECHA_TASK_UI_CMD_WAIT, NULL, MECHA_TASK_ID_UI, 0, 100, "EEPROM WAIT 100ms"); // } diff --git a/base/eeprom-main.c b/base/eeprom-main.c index 487f66c..58981ef 100644 --- a/base/eeprom-main.c +++ b/base/eeprom-main.c @@ -16,13 +16,13 @@ static int DumpEEPROM(const char *filename) int i, progress, result; u16 data; - printf("\nDumping EEPROM:\n"); + PlatShowMessage("\nDumping EEPROM:\n"); if ((dump = fopen(filename, "wb")) != NULL) { for (i = 0; i < 1024 / 2; i++) { putchar('\r'); - printf("Progress: "); + PlatShowMessage("Progress: "); putchar('['); for (progress = 0; progress <= (i * 20 / 512); progress++) putchar('#'); @@ -32,7 +32,7 @@ static int DumpEEPROM(const char *filename) if ((result = EEPROMReadWord(i, &data)) != 0) { - printf("EEPROM read error %d:%d\n", i, result); + PlatShowMessage("EEPROM read error %d:%d\n", i, result); break; } if (fwrite(&data, sizeof(u16), 1, dump) != 1) @@ -54,13 +54,13 @@ static int RestoreEEPROM(const char *filename) int i, progress, result; u16 data; - printf("\nRestoring EEPROM:\n"); + PlatShowMessage("\nRestoring EEPROM:\n"); if ((dump = fopen(filename, "rb")) != NULL) { for (i = 0; i < 1024 / 2; i++) { putchar('\r'); - printf("Progress: "); + PlatShowMessage("Progress: "); putchar('['); for (progress = 0; progress <= (i * 20 / 512); progress++) putchar('#'); @@ -73,7 +73,7 @@ static int RestoreEEPROM(const char *filename) if ((result = EEPROMWriteWord(i, data)) != 0) { - printf("EEPROM write error %d:%d\n", i, result); + PlatShowMessage("EEPROM write error %d:%d\n", i, result); break; } } @@ -118,14 +118,14 @@ static int UpdateEEPROM(int chassis) {&MechaUpdateChassisDexH, EEPROM_UPDATE_FLAG_SANYO | EEPROM_UPDATE_FLAG_NEW_SONY}, }; - printf("Update EEPROM\n\n"); + PlatShowMessage("Update EEPROM\n\n"); if (chassis >= 0) { selected = &data[chassis]; do { - printf("Was the MECHACON replaced (y/n)? "); + PlatShowMessage("Was the MECHACON replaced (y/n)? "); choice = getchar(); while (getchar() != '\n') { @@ -137,7 +137,7 @@ static int UpdateEEPROM(int chassis) { do { - printf("Please select the optical block:\n" + PlatShowMessage("Please select the optical block:\n" "\t1. SONY\n" "\t2. SANYO\n" "Your choice: "); @@ -156,7 +156,7 @@ static int UpdateEEPROM(int chassis) { do { - printf("Please select the object lens:\n" + PlatShowMessage("Please select the object lens:\n" "\t1. T487\n" "\t2. T609K\n" "Your choice: "); @@ -175,7 +175,7 @@ static int UpdateEEPROM(int chassis) { do { - printf("The OSD2 init bit is set. Clear it? (y/n)"); + PlatShowMessage("The OSD2 init bit is set. Clear it? (y/n)"); choice = getchar(); while (getchar() != '\n') { @@ -188,35 +188,35 @@ static int UpdateEEPROM(int chassis) if ((result = selected->update(ClearOSD2InitBit, ReplacedMecha, ObjectLens, OpticalBlock)) > 0) { - printf("Actions available:\n"); + PlatShowMessage("Actions available:\n"); if (result & UPDATE_REGION_EEP_ECR) - printf("\tEEPROM ECR\n"); + PlatShowMessage("\tEEPROM ECR\n"); if (result & UPDATE_REGION_DISCDET) - printf("\tDisc detect\n"); + PlatShowMessage("\tDisc detect\n"); if (result & UPDATE_REGION_SERVO) - printf("\tServo\n"); + PlatShowMessage("\tServo\n"); if (result & UPDATE_REGION_TILT) - printf("\tAuto-tilt\n"); + PlatShowMessage("\tAuto-tilt\n"); if (result & UPDATE_REGION_TRAY) - printf("\tTray\n"); + PlatShowMessage("\tTray\n"); if (result & UPDATE_REGION_EEGS) - printf("\tEE & GS\n"); + PlatShowMessage("\tEE & GS\n"); if (result & UPDATE_REGION_ECR) - printf("\tRTC ECR\n"); + PlatShowMessage("\tRTC ECR\n"); if (result & UPDATE_REGION_RTC) { - printf("\tRTC:\n"); + PlatShowMessage("\tRTC:\n"); if (result & UPDATE_REGION_RTC_CTL12) - printf("\t\tRTC CTL1,2 ERROR\n"); + PlatShowMessage("\t\tRTC CTL1,2 ERROR\n"); if (result & UPDATE_REGION_RTC_TIME) - printf("\t\tRTC TIME ERROR\n"); + PlatShowMessage("\t\tRTC TIME ERROR\n"); } if (result & UPDATE_REGION_DEFAULTS) - printf("\tMechacon defaults\n"); + PlatShowMessage("\tMechacon defaults\n"); do { - printf("Proceed with updates? (y/n) "); + PlatShowMessage("Proceed with updates? (y/n) "); choice = getchar(); while (getchar() != '\n') { @@ -234,14 +234,14 @@ static int UpdateEEPROM(int chassis) } else { - printf("An error occurred. Wrong chassis selected?, result = %d\n", result); + PlatShowMessage("An error occurred. Wrong chassis selected?, result = %d\n", result); } return result; } else { - printf("Unsupported chassis selected.\n"); + PlatShowMessage("Unsupported chassis selected.\n"); return -EINVAL; } } @@ -273,12 +273,12 @@ static int SelectChassis(void) int SelectCount, LastSelectIndex, i, choice; DisplayCommonConsoleInfo(); - printf("Chassis:\n"); + PlatShowMessage("Chassis:\n"); for (i = 0, SelectCount = 0, LastSelectIndex = -1; i < MECHA_CHASSIS_MODEL_COUNT; i++) { if (data[i].probe() != 0) { - printf("\t%2d. %s\n", i + 1, data[i].label); + PlatShowMessage("\t%2d. %s\n", i + 1, data[i].label); SelectCount++; LastSelectIndex = i; } @@ -286,10 +286,10 @@ static int SelectChassis(void) if (SelectCount > 1) { - printf("\t%2d. None\n", i + 1); + PlatShowMessage("\t%2d. None\n", i + 1); do { - printf("Choice: "); + PlatShowMessage("Choice: "); choice = 0; if (scanf("%d", &choice) > 0) while (getchar() != '\n') @@ -340,11 +340,11 @@ void MenuEEPROM(void) return; } if (IsOutdatedBCModel()) - printf("B/C-chassis: EEPROM update required.\n"); + PlatShowMessage("B/C-chassis: EEPROM update required.\n"); chassis = SelectChassis(); do { - printf("\nSelected chassis: %s\n" + PlatShowMessage("\nSelected chassis: %s\n" "EEPROM operations:\n" "\t1. Display console information\n" "\t2. Dump EEPROM\n" @@ -377,7 +377,7 @@ void MenuEEPROM(void) { case 1: DisplayCommonConsoleInfo(); - printf("Press ENTER to continue\n"); + PlatShowMessage("Press ENTER to continue\n"); while (getchar() != '\n') { }; @@ -400,8 +400,8 @@ void MenuEEPROM(void) // Format the filename snprintf(default_filename, sizeof(default_filename), "%s_%07u_%s_%#08x.bin", model, serial, RawData->cfd, RawData->cfc); - printf("Default filename: %s\n", default_filename); - printf("Do you want to use the default filename? (Y/N): "); + PlatShowMessage("Default filename: %s\n", default_filename); + PlatShowMessage("Do you want to use the default filename? (Y/N): "); if (scanf(" %c", &useDefault) > 0) while (getchar() != '\n') @@ -412,87 +412,87 @@ void MenuEEPROM(void) strcpy(filename, default_filename); else { - printf("Enter dump filename: "); + PlatShowMessage("Enter dump filename: "); if (fgets(filename, sizeof(filename), stdin)) filename[strlen(filename) - 1] = '\0'; } - printf("Dump %s.\n", DumpEEPROM(filename) == 0 ? "completed" : "failed"); + PlatShowMessage("Dump %s.\n", DumpEEPROM(filename) == 0 ? "completed" : "failed"); } break; case 3: - printf("Enter dump filename: "); + PlatShowMessage("Enter dump filename: "); if (fgets(filename, sizeof(filename), stdin)) { filename[strlen(filename) - 1] = '\0'; // gets(filename); - printf("Restore %s.\n", RestoreEEPROM(filename) == 0 ? "completed" : "failed"); + PlatShowMessage("Restore %s.\n", RestoreEEPROM(filename) == 0 ? "completed" : "failed"); } break; case 4: #ifdef ID_MANAGEMENT - printf("EEPROM erase %s.\n", EEPROMClear() == 0 ? "completed" : "failed"); + PlatShowMessage("EEPROM erase %s.\n", EEPROMClear() == 0 ? "completed" : "failed"); #else - printf("Function disabled.\n"); + PlatShowMessage("Function disabled.\n"); #endif break; case 5: #ifdef ID_MANAGEMENT - printf("Defaults (all) load: %s.\n", EEPROMDefaultAll() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (all) load: %s.\n", EEPROMDefaultAll() == 0 ? "completed" : "failed"); #else - printf("Function disabled.\n"); + PlatShowMessage("Function disabled.\n"); #endif break; case 6: - printf("Defaults (disc detect) load: %s.\n", EEPROMDefaultDiscDetect() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (disc detect) load: %s.\n", EEPROMDefaultDiscDetect() == 0 ? "completed" : "failed"); break; case 7: - printf("Defaults (servo) load: %s.\n", EEPROMDefaultServo() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (servo) load: %s.\n", EEPROMDefaultServo() == 0 ? "completed" : "failed"); break; case 8: - printf("Defaults (tilt) load: %s.\n", EEPROMDefaultTilt() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (tilt) load: %s.\n", EEPROMDefaultTilt() == 0 ? "completed" : "failed"); break; case 9: - printf("Defaults (tray) load: %s.\n", EEPROMDefaultTray() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (tray) load: %s.\n", EEPROMDefaultTray() == 0 ? "completed" : "failed"); break; case 10: - printf("Defaults (EEGS) load: %s.\n", EEPROMDefaultEEGS() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (EEGS) load: %s.\n", EEPROMDefaultEEGS() == 0 ? "completed" : "failed"); break; case 11: - printf("Defaults (OSD) load: %s.\n", EEPROMDefaultOSD() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (OSD) load: %s.\n", EEPROMDefaultOSD() == 0 ? "completed" : "failed"); break; case 12: - printf("Defaults (RTC) load: %s.\n", EEPROMDefaultRTC() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (RTC) load: %s.\n", EEPROMDefaultRTC() == 0 ? "completed" : "failed"); break; case 13: - printf("Defaults (DVD Player) load: %s.\n", EEPROMDefaultDVDVideo() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (DVD Player) load: %s.\n", EEPROMDefaultDVDVideo() == 0 ? "completed" : "failed"); break; case 14: #ifdef ID_MANAGEMENT - printf("Defaults (ID) load: %s.\n", EEPROMDefaultID() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (ID) load: %s.\n", EEPROMDefaultID() == 0 ? "completed" : "failed"); #else - printf("Function disabled.\n"); + PlatShowMessage("Function disabled.\n"); #endif break; case 15: #ifdef ID_MANAGEMENT - printf("Defaults (Model Name) load: %s.\n", EEPROMDefaultModelName() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (Model Name) load: %s.\n", EEPROMDefaultModelName() == 0 ? "completed" : "failed"); #else - printf("Function disabled.\n"); + PlatShowMessage("Function disabled.\n"); #endif break; case 16: - printf("Defaults (Sanyo OP) load: %s.\n", EEPROMDefaultSanyoOP() == 0 ? "completed" : "failed"); + PlatShowMessage("Defaults (Sanyo OP) load: %s.\n", EEPROMDefaultSanyoOP() == 0 ? "completed" : "failed"); break; case 17: - printf("EEPROM update: %s.\n", UpdateEEPROM(chassis) == 0 ? "completed" : "failed"); + PlatShowMessage("EEPROM update: %s.\n", UpdateEEPROM(chassis) == 0 ? "completed" : "failed"); break; case 18: done = 1; break; } - printf("\nIf the EEPROM was updated, please reboot the MECHACON\n" + PlatShowMessage("\nIf the EEPROM was updated, please reboot the MECHACON\n" "by leaving this menu before pressing the RESET button.\n"); } while (!done); } diff --git a/base/elect-main.c b/base/elect-main.c index 9672a68..b4ee952 100644 --- a/base/elect-main.c +++ b/base/elect-main.c @@ -16,7 +16,7 @@ static int ElectPromptT10K(void) char input; do { - printf("DTL-T10000 (YEDS-18)? [y,n] "); + PlatShowMessage("DTL-T10000 (YEDS-18)? [y,n] "); input = getchar(); while (getchar() != '\n') { @@ -39,7 +39,7 @@ void MenuELECT(void) do { - printf("\nElectric Circuit Adjustment\n" + PlatShowMessage("\nElectric Circuit Adjustment\n" "This tool allows you to re-calibrate the electric circuit of the CD/DVD drive.\n" "You need to do this if you:\n" "\t1. Change/remove the OPtical (OP) block\n" diff --git a/base/id-main.c b/base/id-main.c index 7e000b4..6f927d0 100644 --- a/base/id-main.c +++ b/base/id-main.c @@ -22,7 +22,7 @@ static void InitMechacon(void) { do { - printf("MECHACON initialization for H/I-chassis\n" + PlatShowMessage("MECHACON initialization for H/I-chassis\n" "Select type:\n" "\t1. CEX\n" "\t2. DEX\n" @@ -53,7 +53,7 @@ static void InitMechacon(void) { if (!dex) { - printf("Select model Name:\n" + PlatShowMessage("Select model Name:\n" "\t1. SCPH-xx000 (Japan)\n" "\t2. SCPH-xx001 (USA)\n" "\t3. SCPH-xx002 (Australia)\n" @@ -73,7 +73,7 @@ static void InitMechacon(void) } else { - printf("Select model Name:\n" + PlatShowMessage("Select model Name:\n" "\t1. DTL-H50000\n" "\t2. DTL-H50001\n" "\t3. DTL-H50002\n" @@ -108,7 +108,7 @@ static void InitMechacon(void) case 11: case 12: case 13: - printf("MechaInit: %s\n", MechaInitMechacon(choice, 0) == 0 ? "done" : "failed"); + PlatShowMessage("MechaInit: %s\n", MechaInitMechacon(choice, 0) == 0 ? "done" : "failed"); break; case 14: done = 1; @@ -125,7 +125,7 @@ static void InitMechacon(void) case 5: case 6: case 7: - printf("MechaInit: %s\n", MechaInitMechacon(choice, 1) == 0 ? "done" : "failed"); + PlatShowMessage("MechaInit: %s\n", MechaInitMechacon(choice, 1) == 0 ? "done" : "failed"); break; case 8: done = 1; @@ -135,7 +135,7 @@ static void InitMechacon(void) } } else - printf("MechaInit: Unsupported chassis.\n"); + PlatShowMessage("MechaInit: Unsupported chassis.\n"); } static void WriteiLinkID(void) @@ -145,7 +145,7 @@ static void WriteiLinkID(void) unsigned short int NewiLinkIDInput[8]; EEPROMGetiLinkID(iLinkID); - printf("Current i.Link ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" + PlatShowMessage("Current i.Link ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" "Enter new ID:\t\t", iLinkID[0], iLinkID[1], iLinkID[2], iLinkID[3], iLinkID[4], iLinkID[5], iLinkID[6], iLinkID[7]); if (scanf("%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", @@ -154,11 +154,11 @@ static void WriteiLinkID(void) { for (i = 0; i < 8; i++) iLinkID[i] = (u8)NewiLinkIDInput[i]; - printf("iLink ID update %s\n", (EEPROMSetiLinkID(iLinkID) == 0) ? "completed" : "failed"); + PlatShowMessage("iLink ID update %s\n", (EEPROMSetiLinkID(iLinkID) == 0) ? "completed" : "failed"); } else { - printf("Operation aborted.\n"); + PlatShowMessage("Operation aborted.\n"); } while (getchar() != '\n') @@ -173,7 +173,7 @@ static void WriteConsoleID(void) unsigned short int NewConsoleIDInput[8]; EEPROMGetConsoleID(ConsoleID); - printf("Current console ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" + PlatShowMessage("Current console ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" "Enter new ID:\t\t", ConsoleID[0], ConsoleID[1], ConsoleID[2], ConsoleID[3], ConsoleID[4], ConsoleID[5], ConsoleID[6], ConsoleID[7]); if (scanf("%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", @@ -182,11 +182,11 @@ static void WriteConsoleID(void) { for (i = 0; i < 8; i++) ConsoleID[i] = (u8)NewConsoleIDInput[i]; - printf("Console ID update %s\n", (EEPROMSetConsoleID(ConsoleID) == 0) ? "completed" : "failed"); + PlatShowMessage("Console ID update %s\n", (EEPROMSetConsoleID(ConsoleID) == 0) ? "completed" : "failed"); } else { - printf("Operation aborted.\n"); + PlatShowMessage("Operation aborted.\n"); } while (getchar() != '\n') @@ -202,19 +202,19 @@ static void WriteModelName(void) switch (ConType) { case MECHA_TYPE_36: - printf("This model does not support a model name.\n"); + PlatShowMessage("This model does not support a model name.\n"); return; } ModelName = EEPROMGetModelName(); - printf("Current model name:\t%s\n" + PlatShowMessage("Current model name:\t%s\n" "Maximum length is 16\n" "Enter new name:\t\t", ModelName[0] == 0x00 ? "" : ModelName); if (fgets(NewModelName, sizeof(NewModelName), stdin)) { NewModelName[16] = '\0'; - printf("Model name update %s\n", (EEPROMSetModelName(NewModelName) == 0) ? "completed" : "failed"); + PlatShowMessage("Model name update %s\n", (EEPROMSetModelName(NewModelName) == 0) ? "completed" : "failed"); } } @@ -224,7 +224,7 @@ static void DisplayIDInfo(void) EEPROMGetiLinkID(iLinkID); EEPROMGetConsoleID(ConsoleID); - printf("i.Link ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" + PlatShowMessage("i.Link ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n" "Console ID:\t%02x %02x %02x %02x %02x %02x %02x %02x\n", iLinkID[0], iLinkID[1], iLinkID[2], iLinkID[3], iLinkID[4], iLinkID[5], iLinkID[6], iLinkID[7], ConsoleID[0], ConsoleID[1], ConsoleID[2], ConsoleID[3], ConsoleID[4], ConsoleID[5], ConsoleID[6], ConsoleID[7]); @@ -236,7 +236,7 @@ static void InitNTSCPALDefaults(void) do { - printf("NTSC/PAL selection:\n" + PlatShowMessage("NTSC/PAL selection:\n" "\t1. NTSC\n" "\t2. PAL\n" "\t3. Quit\n" @@ -251,10 +251,10 @@ static void InitNTSCPALDefaults(void) switch (choice) { case 1: - printf("Init NTSC defaults: %s\n", EEPROMNTSCPALDefaults(0) == 0 ? "completed" : "failed"); + PlatShowMessage("Init NTSC defaults: %s\n", EEPROMNTSCPALDefaults(0) == 0 ? "completed" : "failed"); break; case 2: - printf("Init PAL defaults: %s\n", EEPROMNTSCPALDefaults(1) == 0 ? "completed" : "failed"); + PlatShowMessage("Init PAL defaults: %s\n", EEPROMNTSCPALDefaults(1) == 0 ? "completed" : "failed"); break; } } @@ -277,7 +277,7 @@ void MenuID(void) { DisplayCommonConsoleInfo(); DisplayIDInfo(); - printf("ID Managenent:\n" + PlatShowMessage("ID Managenent:\n" "\t1. Write i.Link ID\n" "\t2. Write console ID\n" "\t3. Write model name (AB-chassis and later only)\n" diff --git a/base/main.c b/base/main.c index 6cb71b7..6788e2a 100644 --- a/base/main.c +++ b/base/main.c @@ -17,7 +17,7 @@ void DisplayRawIdentData(void) MechaGetMode(&tm, &md); RawData = MechaGetRawIdent(); - printf("\nTestMode.%d MD1.%d\n" + PlatShowMessage("\nTestMode.%d MD1.%d\n" "CFD:\t\t0x%s\n" "CFC:\t\t%#08x\n" "Version:\t%#04x\n", @@ -31,40 +31,40 @@ void DisplayCommonConsoleInfo(void) u8 emcs, tm, md; MechaGetMode(&tm, &md); - printf("\nTestMode.%d MD1.%d\tChecksum: %s\n" + PlatShowMessage("\nTestMode.%d MD1.%d\tChecksum: %s\n" "MECHA:\t\t%s (%s)\n", tm, md, MechaGetEEPROMStat() ? "OK" : "NG", MechaGetDesc(), MechaGetCEXDEX() == 0 ? "DEX" : "CEX"); - printf("Serial:\t\t"); + PlatShowMessage("Serial:\t\t"); if (EEPROMInitSerial() == 0) { EEPROMGetSerial(&serial, &emcs); - printf("%07u\t\t" + PlatShowMessage("%07u\t\t" "EMCS:\t%02x\n", serial, emcs); } else - printf("\n"); - printf("MODELID:\t%04x\t\tTV:\t%s\n", EEPROMGetModelID(), MechaGetTVSystemDesc(EEPROMGetTVSystem())); - printf("Model:\t\t"); + PlatShowMessage("\n"); + PlatShowMessage("MODELID:\t%04x\t\tTV:\t%s\n", EEPROMGetModelID(), MechaGetTVSystemDesc(EEPROMGetTVSystem())); + PlatShowMessage("Model:\t\t"); if (EEPROMInitModelName() == 0) { ModelName = EEPROMGetModelName(); - printf("%s\n", ModelName); + PlatShowMessage("%s\n", ModelName); } else - printf("\n"); - printf("RTC:\t\t%s (%s)\n" + PlatShowMessage("\n"); + PlatShowMessage("RTC:\t\t%s (%s)\n" "OP:\t\t%s\t\tLens:\t%s\n", MechaGetRTCName(MechaGetRTCType()), MechaGetRtcStatusDesc(MechaGetRTCType(), MechaGetRTCStat()), MechaGetOPTypeName(MechaGetOP()), MechaGetLensTypeName(MechaGetLens())); if (EEPROMGetEEPROMStatus() == 1) - printf("EEPROM was erased (defaults must now be loaded).\n"); + PlatShowMessage("EEPROM was erased (defaults must now be loaded).\n"); } void DisplayConnHelp(void) { - printf("There was a problem communicating with the PlayStation 2 console.\n" + PlatShowMessage("There was a problem communicating with the PlayStation 2 console.\n" "Check the connections, press the RESET button and try again.\n\n"); } @@ -75,13 +75,13 @@ int main(int argc, char *argv[]) if (argc != 2) { - printf("Syntax error. Syntax: PMAP \n"); + PlatShowMessage("Syntax error. Syntax: PMAP \n"); return EINVAL; } if (PlatOpenCOMPort(argv[1]) != 0) { - printf("Cannot open %s.\n", argv[1]); + PlatShowMessage("Cannot open %s.\n", argv[1]); return ENODEV; } @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { do { - printf("\nP.M.A.P (v1.2)\n" + PlatShowMessage("\nP.M.A.P (v1.2)\n" "=============================\n" "\t1.\tEEPROM management\n" "\t2.\tAutomatic ELECT adjustment\n" diff --git a/base/mecha-main.c b/base/mecha-main.c index e1378df..039b097 100644 --- a/base/mecha-main.c +++ b/base/mecha-main.c @@ -120,29 +120,29 @@ static int MechaAdjTxHandler(MechaTask_t *task) switch (DiscDetect) { case DISC_TYPE_CD12: - printf("Disc type CD 12cm\n"); + PlatShowMessage("Disc type CD 12cm\n"); task->command = MECHA_CMD_DISC_MODE_CD_12; status = MECHA_ADJ_STATE_CD; return 0; case DISC_TYPE_DVDS12: - printf("Disc type DVD-SL 12cm\n"); + PlatShowMessage("Disc type DVD-SL 12cm\n"); task->command = MECHA_CMD_DISC_MODE_DVDSL_12; status = MECHA_ADJ_STATE_DVDSL; return 0; case DISC_TYPE_DVDD12: - printf("Disc type DVD-DL 12cm\n"); + PlatShowMessage("Disc type DVD-DL 12cm\n"); task->command = MECHA_CMD_DISC_MODE_DVDDL_12; status = MECHA_ADJ_STATE_DVDDL; return 0; case DISC_TYPE_UNKNOWN: - printf("Disc type unknown.\n"); + PlatShowMessage("Disc type unknown.\n"); task->id = 0; task->tag = 0; task->command = 0; status = MECHA_ADJ_STATE_NONE; return 0; case DISC_TYPE_NO_DISC: - printf("No disc inserted.\n"); + PlatShowMessage("No disc inserted.\n"); task->id = 0; task->tag = 0; task->command = 0; @@ -150,7 +150,7 @@ static int MechaAdjTxHandler(MechaTask_t *task) return 0; default: status = MECHA_ADJ_STATE_NONE; - printf("Unsupported disc type: %02x\n", DiscDetect); + PlatShowMessage("Unsupported disc type: %02x\n", DiscDetect); return 1; } default: @@ -386,7 +386,7 @@ static int MechaAdjInit(short int argc, char *argv[]) case MECHA_TYPE_40: break; default: - printf("MechaAdjInit: Unsupported chassis.\n"); + PlatShowMessage("MechaAdjInit: Unsupported chassis.\n"); return 0; } @@ -409,7 +409,7 @@ static int MechaAdjInit(short int argc, char *argv[]) case MECHA_ADJ_STATE_DVDDL_1: case MECHA_ADJ_STATE_DVDDL_1p6: case MECHA_ADJ_STATE_DVDDL_1p64: - printf("Please STOP the drive first! Currently in another PLAY mode.\n"); + PlatShowMessage("Please STOP the drive first! Currently in another PLAY mode.\n"); return 0; } @@ -436,7 +436,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "CD STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("CD initialization failed.\n"); + PlatShowMessage("CD initialization failed.\n"); else status = MECHA_ADJ_STATE_CD; @@ -463,7 +463,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "DVD-SL STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("DVD-SL initialization failed.\n"); + PlatShowMessage("DVD-SL initialization failed.\n"); else status = MECHA_ADJ_STATE_DVDSL; @@ -489,7 +489,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "DVD-DL STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("DVD-DL initialization failed.\n"); + PlatShowMessage("DVD-DL initialization failed.\n"); else status = MECHA_ADJ_STATE_DVDDL; @@ -516,7 +516,7 @@ static int MechaAdjInit(short int argc, char *argv[]) } MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "DVD-SL STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("DVD-SL initialization failed.\n"); + PlatShowMessage("DVD-SL initialization failed.\n"); else status = MECHA_ADJ_STATE_DVDSL; @@ -542,7 +542,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) switch (status) { case MECHA_ADJ_STATE_NONE: - printf("Please do initialization first!\n"); + PlatShowMessage("Please do initialization first!\n"); break; case MECHA_ADJ_STATE_DVDDL_PAUSE: case MECHA_ADJ_STATE_DVDDL_1: @@ -551,7 +551,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) if (!pstricmp(argv[1], "FJ")) { if ((result = MechaCommandExecute(MECHA_CMD_FOCUS_JUMP, 2000, "0300", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); break; } case MECHA_ADJ_STATE_DVDSL_PAUSE: @@ -564,7 +564,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_4: case MECHA_ADJ_STATE_CD_512: case MECHA_ADJ_STATE_CD_1024: - printf("Please STOP the drive. It is currently in PLAY mode.\n"); + PlatShowMessage("Please STOP the drive. It is currently in PLAY mode.\n"); break; case MECHA_ADJ_STATE_CD: speed = (int)strtol(argv[1], NULL, 0); @@ -592,7 +592,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) command = MECHA_CMD_CD_PLAY_5; break; default: - printf("Unsupported speed.\n"); + PlatShowMessage("Unsupported speed.\n"); timeout = 0; command = 0; } @@ -600,7 +600,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) if (command != 0) { if ((result = MechaCommandExecute(command, timeout, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else status += speed; @@ -626,7 +626,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) command = MECHA_CMD_DVD_PLAY_3; break; default: - printf("Unsupported speed.\n"); + PlatShowMessage("Unsupported speed.\n"); timeout = 0; command = 0; } @@ -634,7 +634,7 @@ static int MechaAdjPlay(short int argc, char *argv[]) if (command != 0) { if ((result = MechaCommandExecute(command, timeout, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else status += speed; @@ -663,7 +663,7 @@ static int MechaAdjStop(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_512: case MECHA_ADJ_STATE_CD_1024: if ((result = MechaCommandExecute(MECHA_CMD_CD_STOP, 4000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); status = MECHA_ADJ_STATE_CD; break; case MECHA_ADJ_STATE_DVDSL_PAUSE: @@ -675,7 +675,7 @@ static int MechaAdjStop(short int argc, char *argv[]) case MECHA_ADJ_STATE_DVDDL_1p6: case MECHA_ADJ_STATE_DVDDL_1p64: if ((result = MechaCommandExecute(MECHA_CMD_DVD_STOP, 5000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); switch (status) { @@ -694,7 +694,7 @@ static int MechaAdjStop(short int argc, char *argv[]) } break; default: - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } return 0; @@ -706,7 +706,7 @@ static int MechaAdjAutoTilt(short int argc, char *argv[]) if (!IsAutoTiltModel()) { - printf("This is not a B-chassis (non-auto-tilt motor model).\n"); + PlatShowMessage("This is not a B-chassis (non-auto-tilt motor model).\n"); return 0; } @@ -717,13 +717,13 @@ static int MechaAdjAutoTilt(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_INIT_AUTO_TILT, NULL, id++, 0, 5000, "AUTO TILT INIT"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "ADJ")) { MechaCommandAdd(MECHA_CMD_ADJ_AUTO_TILT, "00", id++, 0, 15000, "TILT ADJUST"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "WRITE")) { @@ -739,19 +739,19 @@ static int MechaAdjAutoTilt(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_WRITE_CHECKSUM, "00", id++, 0, 3000, "EEPROM WRITE CHECKSUM"); MechaCommandAdd(MECHA_CMD_READ_CHECKSUM, "00", id++, 0, 3000, "EEPROM READ CHECKSUM"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "REV")) { MechaCommandAdd(MECHA_CMD_MOV_AUTO_TILT, "000001", id++, 0, 5000, "TILT ADJUST REV"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "FWD")) { MechaCommandAdd(MECHA_CMD_MOV_AUTO_TILT, "010001", id++, 0, 5000, "TILT ADJUST FWD"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -772,7 +772,7 @@ static int MechaAdjPause(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_PAUSE: case MECHA_ADJ_STATE_DVDSL_PAUSE: case MECHA_ADJ_STATE_DVDDL_PAUSE: - printf("Already paused.\n"); + PlatShowMessage("Already paused.\n"); break; case MECHA_ADJ_STATE_CD_1: case MECHA_ADJ_STATE_CD_2: @@ -780,7 +780,7 @@ static int MechaAdjPause(short int argc, char *argv[]) case MECHA_ADJ_STATE_CD_512: case MECHA_ADJ_STATE_CD_1024: if ((result = MechaCommandExecute(MECHA_CMD_CD_PAUSE, 3000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); break; case MECHA_ADJ_STATE_DVDSL_1: case MECHA_ADJ_STATE_DVDSL_1p6: @@ -789,7 +789,7 @@ static int MechaAdjPause(short int argc, char *argv[]) case MECHA_ADJ_STATE_DVDDL_1p6: case MECHA_ADJ_STATE_DVDDL_1p64: if ((result = MechaCommandExecute(MECHA_CMD_DVD_PAUSE, 5000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); switch (status) { @@ -806,7 +806,7 @@ static int MechaAdjPause(short int argc, char *argv[]) } break; default: - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } return 0; @@ -823,37 +823,37 @@ static int MechaAdjTray(short int argc, char *argv[]) { if (!SledIsAtHome) { - printf("Sled must be in home position!\n"); + PlatShowMessage("Sled must be in home position!\n"); return 0; } if ((result = MechaCommandExecute(MECHA_CMD_TRAY, 6000, "00", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else if (!pstricmp(argv[1], "OPEN")) { if (!SledIsAtHome) { - printf("Sled must be in home position!\n"); + PlatShowMessage("Sled must be in home position!\n"); return 0; } if ((result = MechaCommandExecute(MECHA_CMD_TRAY, 6000, "01", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else if (!pstricmp(argv[1], "IN-SW")) { if ((result = MechaCommandExecute(MECHA_CMD_TRAY_SW, 3000, "00", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("IN-SW: %s\n", buffer); + PlatShowMessage("IN-SW: %s\n", buffer); } else if (!pstricmp(argv[1], "OUT-SW")) { if ((result = MechaCommandExecute(MECHA_CMD_TRAY_SW, 3000, "01", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("OUT-SW: %s\n", buffer); + PlatShowMessage("OUT-SW: %s\n", buffer); } else return -EINVAL; @@ -874,23 +874,23 @@ static int MechaAdjJitter(short int argc, char *argv[]) if (!pstricmp(argv[1], "1")) { if ((result = MechaCommandExecute(MECHA_CMD_JITTER, 1000, "00", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("%s\n", &buffer[1]); + PlatShowMessage("%s\n", &buffer[1]); } else if (!pstricmp(argv[1], "16")) { if ((result = MechaCommandExecute(MECHA_CMD_JITTER, 1000, "02", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("%s\n", &buffer[1]); + PlatShowMessage("%s\n", &buffer[1]); } else if (!pstricmp(argv[1], "256")) { if ((result = MechaCommandExecute(MECHA_CMD_JITTER, 2000, "01", buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else - printf("%s\n", &buffer[1]); + PlatShowMessage("%s\n", &buffer[1]); } else return -EINVAL; @@ -919,7 +919,7 @@ static int MechaAdjGetError(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_DSP_ERROR_RATE, "00", id++, MECHA_CMD_TAG_MECHA_DVD_ERROR_RATE, 2000, "DVD GET DSP ERROR RATE"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) == 0) { - printf("DVD Error Data:\n" + PlatShowMessage("DVD Error Data:\n" "PI Correct:\t\t%#04x\tPO Correct:\t\t%#04x\n" "PI Non-correct:\t%#04x\tPO Non-correct:\t%#04x\n" "PI Max:\t\t\t%#04x\tPO Max:\t\t\t%#04x\n" @@ -929,10 +929,10 @@ static int MechaAdjGetError(short int argc, char *argv[]) DvdError.jitter); } else - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); break; default: - printf("Not in a DVD PLAY mode.\n"); + PlatShowMessage("Not in a DVD PLAY mode.\n"); } } else if (!pstricmp(argv[1], "CD")) @@ -947,13 +947,13 @@ static int MechaAdjGetError(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_CD_ERROR, "00", id++, MECHA_CMD_TAG_MECHA_CD_ERROR_RATE, 2000, "CD GET DSP ERROR RATE"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) == 0) { - printf("%04x:::%04x\n", CdError.c1, CdError.c2); + PlatShowMessage("%04x:::%04x\n", CdError.c1, CdError.c2); } else - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); break; default: - printf("Not in a CD PLAY mode.\n"); + PlatShowMessage("Not in a CD PLAY mode.\n"); } } else @@ -972,26 +972,26 @@ static int MechaAdjSled(short int argc, char *argv[]) if (!pstricmp(argv[1], "HOME")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_POS_HOME, 3000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else SledIsAtHome = 1; } else if (!pstricmp(argv[1], "IN")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_POS, 2000, "00", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[1], "OUT")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_POS, 3000, "02", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[1], "MID")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_POS, 3000, "01", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[1], "STEP-M")) @@ -1002,14 +1002,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { // Micro reverse snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Micro forward snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_MICRO, 2000, "010064", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else @@ -1026,14 +1026,14 @@ static int MechaAdjSled(short int argc, char *argv[]) { // Biphs reverse snprintf(args, 7, "00%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else if (!pstricmp(argv[2], "OUT")) { // Biphs forward snprintf(args, 7, "01%04x", StepAmount); if ((result = MechaCommandExecute(MECHA_CMD_SLED_CTL_BIPHS, 2000, args, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); SledIsAtHome = 0; } else @@ -1049,12 +1049,12 @@ static int MechaAdjSled(short int argc, char *argv[]) if (!pstricmp(argv[2], "ON")) { if ((result = MechaCommandExecute(MECHA_CMD_TRACKING, 1000, "01", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else if (!pstricmp(argv[2], "OFF")) { if ((result = MechaCommandExecute(MECHA_CMD_TRACKING, 1000, "00", buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); } else return -EINVAL; @@ -1065,11 +1065,11 @@ static int MechaAdjSled(short int argc, char *argv[]) else if (!pstricmp(argv[1], "IN-SW")) { if ((result = MechaCommandExecute(MECHA_CMD_SLED_IN_SW, 1000, NULL, buffer, sizeof(buffer))) < 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { result = (int)strtoul(&buffer[1], NULL, 16); - printf("IN-SW: %02x\n", result); + PlatShowMessage("IN-SW: %02x\n", result); } } else if (!pstricmp(argv[1], "STEP")) @@ -1077,7 +1077,7 @@ static int MechaAdjSled(short int argc, char *argv[]) if (argc == 3) { StepAmount = (unsigned short int)strtoul(argv[2], NULL, 0); - printf("STEP: %u\n", StepAmount); + PlatShowMessage("STEP: %u\n", StepAmount); } else return -EINVAL; @@ -1098,11 +1098,11 @@ static int DisplayHelp(const struct MechaDiagCommand *commands, short int argc, if (argc == 1) { - printf("To get help for a specific command, type HELP \n" + PlatShowMessage("To get help for a specific command, type HELP \n" "Available commands:\n"); for (pCmd = commands, i = 0; pCmd->command != NULL; pCmd++, i++) { - printf("\t%s%c", pCmd->command, ((i != 0) && (i % 4) == 0) ? '\n' : ' '); + PlatShowMessage("\t%s%c", pCmd->command, ((i != 0) && (i % 4) == 0) ? '\n' : ' '); } putchar('\n'); } @@ -1112,13 +1112,13 @@ static int DisplayHelp(const struct MechaDiagCommand *commands, short int argc, { if (!pstricmp(pCmd->command, argv[1])) { - printf("%s - %s\n", pCmd->syntax, pCmd->description); + PlatShowMessage("%s - %s\n", pCmd->syntax, pCmd->description); break; } } if (pCmd->command == NULL) - printf("No such command.\n"); + PlatShowMessage("No such command.\n"); } else { @@ -1155,7 +1155,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) if (!pstricmp(argv[1], "CD")) { if ((result = MechaCommandExecute(MECHA_CMD_DISC_MODE_CD_12, 1000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { status = MECHA_ADJ_STATE_CD; @@ -1165,7 +1165,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) else if (!pstricmp(argv[1], "DVD-SL")) { if ((result = MechaCommandExecute(MECHA_CMD_DISC_MODE_DVDSL_12, 1000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { status = MECHA_ADJ_STATE_DVDSL; @@ -1175,7 +1175,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) else if (!pstricmp(argv[1], "DVD-DL")) { if ((result = MechaCommandExecute(MECHA_CMD_DISC_MODE_DVDDL_12, 1000, NULL, buffer, sizeof(buffer))) < 0 || (result = strtoul(buffer, NULL, 16)) != 0) - printf("Error %d\n", result); + PlatShowMessage("Error %d\n", result); else { status = MECHA_ADJ_STATE_DVDDL; @@ -1187,7 +1187,7 @@ static int MechaTestDiscControl(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_DISC_DETECT, NULL, id++, MECHA_CMD_TAG_MECHA_DISC_DETECT, 3000, "DISC DETECT"); MechaCommandAdd(MECHA_CMD_DISC_MODE_CD_8, NULL, id++, MECHA_CMD_TAG_MECHA_SET_DISC_TYPE, 1000, "DISC MODE CD 8cm"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1209,13 +1209,13 @@ static int MechaTestLaserControl(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_LASER_DIODE, "01", id++, 0, 3000, "LD ON"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "OFF")) { MechaCommandAdd(MECHA_CMD_LASER_DIODE, "00", id++, 0, 3000, "LD OFF"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1232,13 +1232,13 @@ static int MechaTestLaserControl(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "01", id++, 0, 3000, "FOCUS UP/DOWN START"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[3], "STOP")) { MechaCommandAdd(MECHA_CMD_FOCUS_UPDOWN, "00", id++, 0, 3000, "FOCUS UP/DOWN STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1249,13 +1249,13 @@ static int MechaTestLaserControl(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_FOCUS_AUTO_START, NULL, id++, 0, 3000, "AUTO FOCUS START"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[3], "STOP")) { MechaCommandAdd(MECHA_CMD_FOCUS_AUTO_STOP, NULL, id++, 0, 3000, "AUTO FOCUS STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1281,7 +1281,7 @@ static int MechaTestServoControl(short int argc, char *argv[]) if (DiscDetect == 0xFF) { - printf("Disc type/circuit not set up!\n"); + PlatShowMessage("Disc type/circuit not set up!\n"); return 0; } @@ -1293,7 +1293,7 @@ static int MechaTestServoControl(short int argc, char *argv[]) MechaCommandAdd(MECHA_CMD_SLED_POS_HOME, NULL, id++, 0, 3000, "SLED HOME"); MechaCommandAdd(MECHA_CMD_AUTO_ADJ_ST_12, "00", id++, 0, 40000, "SERVO AUTO ADJ START"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1310,7 +1310,7 @@ static int MechaTestPlay(short int argc, char *argv[]) if (DiscDetect == 0xFF) { - printf("Disc type/circuit not set up!\n"); + PlatShowMessage("Disc type/circuit not set up!\n"); return 0; } @@ -1324,7 +1324,7 @@ static int MechaTestPlay(short int argc, char *argv[]) case DISC_TYPE_CD12: MechaCommandAdd(MECHA_CMD_CD_PLAY_1, NULL, id++, 0, 3000, "PLAY CD 12cm"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); else status = MECHA_ADJ_STATE_CD_1; break; @@ -1332,7 +1332,7 @@ static int MechaTestPlay(short int argc, char *argv[]) case DISC_TYPE_DVDD12: MechaCommandAdd(MECHA_CMD_DVD_PLAY_1, NULL, id++, 0, 5000, "PLAY DVD 12cm"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); else { switch (DiscDetect) @@ -1356,10 +1356,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_CTL, "01000A", id++, 0, 5000, "CD FWD 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1367,10 +1367,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_CTL, "01000A", id++, 0, 5000, "DVD FWD 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "REV")) @@ -1382,10 +1382,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_CTL, "00000A", id++, 0, 5000, "CD REV 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1393,10 +1393,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_CTL, "00000A", id++, 0, 5000, "DVD REV 1 TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "FWDL")) @@ -1408,10 +1408,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_LONG_CTL, "010001", id++, 0, 10000, "CD FWD LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1419,10 +1419,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_LONG_CTL, "010001", id++, 0, 10000, "DVD FWD LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "REVL")) @@ -1434,10 +1434,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_TRACK_LONG_CTL, "000001", id++, 0, 10000, "CD REV LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1445,10 +1445,10 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_TRACK_LONG_CTL, "000001", id++, 0, 10000, "DVD REV LONG TRACK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "STOP")) @@ -1460,12 +1460,12 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_CD_STOP, NULL, id++, 0, 20000, "CD STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); status = MECHA_ADJ_STATE_CD; } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); break; case DISC_TYPE_DVDS12: case DISC_TYPE_DVDD12: @@ -1473,7 +1473,7 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_DVD_STOP, NULL, id++, 0, 20000, "DVD STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); switch (status) { @@ -1485,7 +1485,7 @@ static int MechaTestPlay(short int argc, char *argv[]) } } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } } else if (!pstricmp(argv[1], "FJ")) @@ -1496,13 +1496,13 @@ static int MechaTestPlay(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_FOCUS_JUMP, "0205", id++, 0, 2000, "DVD-DL FOCUS JUMP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else - printf("Not in PLAY mode.\n"); + PlatShowMessage("Not in PLAY mode.\n"); } else - printf("Not a DVD-DL.\n"); + PlatShowMessage("Not a DVD-DL.\n"); } else return -EINVAL; @@ -1524,31 +1524,31 @@ static int MechaTestSpindle(short int argc, char *argv[]) { MechaCommandAdd(MECHA_CMD_SP_CTL, "01", id++, 0, 3000, "SP KICK"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "BRAKE")) { MechaCommandAdd(MECHA_CMD_SP_CTL, "00", id++, 0, 3000, "SP BRAKE"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "STOP")) { MechaCommandAdd(MECHA_CMD_SP_CTL, "02", id++, 0, 3000, "SP STOP"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "CLV-S")) { MechaCommandAdd(MECHA_CMD_SP_CLV_S, NULL, id++, 0, 3000, "SP CLV-S"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else if (!pstricmp(argv[1], "CLV-A")) { MechaCommandAdd(MECHA_CMD_SP_CLV_A, NULL, id++, 0, 3000, "SP CLV-A"); if (MechaCommandExecuteList(&MechaAdjTxHandler, &MechaAdjRxHandler) != 0) - printf("Failed to execute.\n"); + PlatShowMessage("Failed to execute.\n"); } else return -EINVAL; @@ -1576,7 +1576,7 @@ static void MechaCommonMain(const struct MechaDiagCommand *commands, char prompt previous[0] = '\0'; do { - printf("MD1.%d %c> ", md, prompt); + PlatShowMessage("MD1.%d %c> ", md, prompt); if (fgets(input, sizeof(input), stdin)) { input[strlen(input) - 1] = '\0'; @@ -1603,7 +1603,7 @@ static void MechaCommonMain(const struct MechaDiagCommand *commands, char prompt if ((result = pCmd->function(argc, argv)) < 0) { if (result == -EINVAL) - printf(MECHA_ADJ_SYNTAX_ERR); + PlatShowMessage(MECHA_ADJ_SYNTAX_ERR); } else { @@ -1611,7 +1611,7 @@ static void MechaCommonMain(const struct MechaDiagCommand *commands, char prompt } } else - printf("Unrecognized command. For help, type HELP.\n"); + PlatShowMessage("Unrecognized command. For help, type HELP.\n"); } } while (!done); } @@ -1631,7 +1631,7 @@ static int MechaAdjPromptT10K(void) char input; do { - printf("Is this a DTL-T10000? [y,n] "); + PlatShowMessage("Is this a DTL-T10000? [y,n] "); input = getchar(); while (getchar() != '\n') { @@ -1654,13 +1654,13 @@ void MenuMECHA(void) } if (IsOutdatedBCModel()) { - printf("B/C-chassis: EEPROM update required.\n"); + PlatShowMessage("B/C-chassis: EEPROM update required.\n"); return; } do { - printf("\nMechanics (skew) Adjustment\n" + PlatShowMessage("\nMechanics (skew) Adjustment\n" "This tool allows you to re-calibrate and test the mechanics (skew) of the CD/DVD drive.\n" "You need to do this if you:\n" "\t1. Change/remove the OPtical (OP) block\n" @@ -1683,7 +1683,7 @@ void MenuMECHA(void) { do { - printf("\nMechanics (skew) Adjustment\n" + PlatShowMessage("\nMechanics (skew) Adjustment\n" "\t1. Adjust mechanics\n" "\t2. Test mechanics\n" "\t3. Quit\n" From 9779a91defa1023ca032a16b29be76f15d86444f Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:38:22 +0300 Subject: [PATCH 42/42] Win fix for charactr output --- PMAP-wingui/platform-wingui.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/PMAP-wingui/platform-wingui.c b/PMAP-wingui/platform-wingui.c index 924ac20..bfdb1e1 100644 --- a/PMAP-wingui/platform-wingui.c +++ b/PMAP-wingui/platform-wingui.c @@ -144,9 +144,7 @@ void PlatShowEMessage(const char *format, ...) if (DebugOutputFile != NULL) vfprintf(DebugOutputFile, format, args); - MessageBoxA(g_mainWin, (LPCSTR)buffer, - L"Error", - MB_OK | MB_ICONERROR); + MessageBoxA(g_mainWin, buffer, "Error", MB_OK | MB_ICONERROR); va_end(args); } @@ -161,9 +159,7 @@ void PlatShowMessage(const char *format, ...) if (DebugOutputFile != NULL) vfprintf(DebugOutputFile, format, args); - MessageBoxA(g_mainWin, (LPCSTR)buffer, - L"Information", - MB_OK | MB_ICONINFORMATION); + MessageBoxA(g_mainWin, buffer, "Information", MB_OK | MB_ICONINFORMATION); va_end(args); } @@ -177,9 +173,7 @@ void PlatShowMessageB(const char *format, ...) if (DebugOutputFile != NULL) vfprintf(DebugOutputFile, format, args); - MessageBoxA(g_mainWin, (LPCSTR)buffer, - L"Information", - MB_OK | MB_ICONINFORMATION); + MessageBoxA(g_mainWin, buffer, "Information", MB_OK | MB_ICONINFORMATION); va_end(args); }