summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2009-06-16 14:53:25 +0200
committerLuc Verhaegen <libv@skynet.be>2009-06-17 14:47:05 +0200
commit6af9ecf70616287f0799dbb2219926da89806629 (patch)
tree470fd77ef82cc96bb87dd2b21288ee345f36c9b4
parent1a3e94cf30a1f14375af4b416ce6be22da380d2a (diff)
Quick visual cleanup and removal of 3 pointless headers.
-rw-r--r--phnxdeco/phnxdeco.c124
-rw-r--r--phnxdeco/phnxdeco.h13
-rw-r--r--phnxdeco/phnxfunc.c57
-rw-r--r--phnxdeco/phnxhelp.h69
-rw-r--r--phnxdeco/phnxsoft.h18
-rw-r--r--phnxdeco/phnxver.h17
6 files changed, 89 insertions, 209 deletions
diff --git a/phnxdeco/phnxdeco.c b/phnxdeco/phnxdeco.c
index 56f67fe..43f1e9d 100644
--- a/phnxdeco/phnxdeco.c
+++ b/phnxdeco/phnxdeco.c
@@ -20,19 +20,69 @@
#include <stdio.h>
#include <stdlib.h>
-
-#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
#include <memory.h>
-#define __LINUX_NOW__
-#else
-#include <mem.h>
-#include <conio.h>
-#endif
-#include "./phnxdeco.h"
-#include "./phnxsoft.h"
-#include "./phnxver.h"
-#include "./phnxhelp.h"
+#include "phnxdeco.h"
+
+#define SftPlatform "Linux"
+#define SftVersion "0.33 ("SftPlatform")"
+#define SftName "PhoenixDeco"
+#define SftEMail "Anton Borisov, anton.borisov@gmail.com"
+
+byte SoftName[] = "-=" SftName ", version " SftVersion "=-";
+byte CopyRights[] = "\n(C) Anton Borisov, 2000, 2002-2004, Portions (C) 1999-2000";
+byte Url[] = "Bug-reports direct to " SftEMail;
+
+byte HelpSystem(byte argc, byte * argv[])
+{
+ byte x = 0, retcode = 0;
+
+ for (x = 1; x < argc; x++) {
+ if (StrCmp(argv[x], "-h") == 0) {
+ printf("\n" SftName " HelpSystem Starting Now!\n");
+ printf("\nThis Program Version Number %s", SftVersion);
+ printf("\n" SftName " - Decompressor for PhoenixBIOSes only.\n" "\tSupported formats: Phoenix BIOS 4.0, Phoenix FirstBIOS\n\n" "" SftName
+ " performs on 386 or better CPU systems\n" "under control of LinuxOS\n\n" "Compression schemes include: NONE, LZSS, LZINT\n\n"
+ "Modules marked with " IDSign " sign are compressed modules\n\n" "\tBug reports mailto: " SftEMail "\n" "\t\tCompiled: %s, %s with \n\t\t%s",
+ __DATE__, __TIME__, __VERSION__);
+ printf("\n");
+ retcode = 0x80;
+
+ }
+
+ if (StrCmp(argv[x], "-xs") == 0)
+ retcode = 0x20;
+ if (StrCmp(argv[x], "-ls") == 0)
+ retcode = 0x21;
+ if (StrCmp(argv[x], "-x") == 0)
+ retcode = 0x10;
+ if (StrCmp(argv[x], "-l") == 0)
+ retcode = 0x11;
+ if (StrCmp(argv[x], "-c") == 0)
+ retcode += 0x40;
+ }
+ return (retcode);
+
+}
+
+void PrintHeader(byte * EOL)
+{
+
+ printf("\n%c%s%c%s", 0x4, SoftName, 0x4, EOL);
+
+}
+
+void PrintUsage()
+{
+
+ PrintHeader("");
+ printf("%s", CopyRights);
+ printf("\n\nUsage: PhnxDeco <PhoenixBIOS.ROM> [Options]");
+ printf("\n" "\t\tOptions:" "\n\t\t\t\"-ls\" List (System) Bios Structure" "\n\t\t\t\"-xs\" eXtract (System) Bios Modules"
+ "\n\t\t\t\"-l\" List Bios Structure" "\n\t\t\t\"-x\" eXtract Bios Modules" "\n\t\t\t\"-c\" show Bios Copyrights" "\n\t\t\t\"-h\" Help statistics");
+ printf("\n\n\t*%s*\n", Url);
+
+}
int main(byte argc, byte * argv[])
{
@@ -50,20 +100,6 @@ int main(byte argc, byte * argv[])
byte __COPY__ = 0;
-
-#ifndef __LINUX_NOW__
- clrscr();
-#endif
-
-
-#ifdef __DEBUG__
-// argv[1] = "C:\\phnx\\z.bin";
- argv[1] = "C:\\phnx\\10410.bin";
-// argv[1] = "C:\\firmware.111";
- argv[2] = "-l";
- argc = 3;
-#endif
-
switch (HelpSystem(argc, argv)) {
case 0x80:
return 0;
@@ -123,7 +159,7 @@ int main(byte argc, byte * argv[])
fread(Buf, 1, BLOCK, ptx);
if ((CurPos = FoundAt(ptx, Buf, BCPSEGMENT, BLOCK)) != 0)
break;
- /*-----O'K, we got PhoenixBIOS BCPSEGMENT hook-------*/
+ /* O'K, we got PhoenixBIOS BCPSEGMENT hook */
CurPos = ftell(ptx) - 0x100;
}
@@ -140,9 +176,7 @@ int main(byte argc, byte * argv[])
while (IDMod.Name[0] != 0x0 && IDMod.Len != 0x0) {
fread(&IDMod, 1, sizeof(IDMod), ptx);
- /*--------Wrong Count w/ ALR and some S/N ---------
- internal errors ?
- ---------------------------------------------------*/
+ /* Wrong Count w/ ALR and some S/N internal errors ? */
if (IDMod.Name[0] < 0x41 && IDMod.Name[0] != 0x0) {
do {
fread(Buf, 1, 1, ptx);
@@ -164,13 +198,13 @@ int main(byte argc, byte * argv[])
Mods++;
}
- /*-----Looking for BCPFCP control structure------------*/
+ /* Looking for BCPFCP control structure */
rewind(ptx);
while (!feof(ptx)) {
fread(Buf, 1, BLOCK, ptx);
if ((CurPos = FoundAt(ptx, Buf, BCPFCP, BLOCK)) != 0)
break;
- /*---------O'K, we got this hook-----------*/
+ /* O'K, we got this hook */
CurPos = ftell(ptx) - 0x100;
}
@@ -190,12 +224,12 @@ int main(byte argc, byte * argv[])
fread(&phtime, 1, 8, ptx);
fseek(ptx, SYSOff + 0x77, 0);
- /*-----Move to the pointer of 1st module-----*/
+ /* Move to the pointer of 1st module */
fread(&Start, 1, sizeof(Start), ptx);
Offset = (0xFFFE0000 - (ftell(ptx) & 0xFFFE0000));
Start -= Offset;
- /*-----Move to the DEVEL string------------*/
+ /* Move to the DEVEL string */
fseek(ptx, SYSOff + 0x37, 0);
fread(Buf, 1, 8, ptx);
@@ -216,16 +250,8 @@ int main(byte argc, byte * argv[])
printf("/* Copyrighted Information */\n");
-
- if (__COPY__)
-
- /*
- If .rom begins with no additional trash
- this routine should be applied
- */
-
- {
-
+ /* If .rom begins with no additional trash this routine should be applied */
+ if (__COPY__) {
fseek(ptx, POSTOff + 0x1B, 0);
fread(&CurPos, 1, sizeof(word), ptx);
@@ -242,16 +268,8 @@ int main(byte argc, byte * argv[])
printf("\t%.64s\n", Buf);
-
- if (__COPY__)
-
- /*
- If .rom begins with no additional trash
- this routine should be applied
- */
-
- {
-
+ /* If .rom begins with no additional trash this routine should be applied */
+ if (__COPY__) {
fseek(ptx, POSTOff + 0x38, 0);
fread(&CurPos, 1, sizeof(word), ptx);
fseek(ptx, (POSTOff & 0xF0000) + (CurPos & 0xffff), 0);
diff --git a/phnxdeco/phnxdeco.h b/phnxdeco/phnxdeco.h
index cbf9818..fc6150b 100644
--- a/phnxdeco/phnxdeco.h
+++ b/phnxdeco/phnxdeco.h
@@ -6,7 +6,7 @@
**
***********************************************/
-/* ------ 26 Jan 2003 -------
+/* ------ 26 Jan 2003 -------
** New Name Conventions
* ------------------------- */
@@ -23,14 +23,7 @@ typedef unsigned short word;
#define ListM 0x21
-#ifndef __LINUX_NOW__
-#define IDSign ""
-#else
#define IDSign "+"
-#endif
-
-
-//#define __DEBUG__
typedef struct {
FILE *infile;
@@ -82,9 +75,7 @@ void decodeM3(interfacing interface);
byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize);
-/*---------------Modified Module Detection & Manipulating------------
- According to BCPSYS block
---------------------------------------------------------------------*/
+/* Modified Module Detection & Manipulating According to BCPSYS block */
byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff, dword SYSOff);
dword IsPhoenixBIOS(FILE * ptx, byte * Buf);
diff --git a/phnxdeco/phnxfunc.c b/phnxdeco/phnxfunc.c
index c8e3e07..9631b23 100644
--- a/phnxdeco/phnxfunc.c
+++ b/phnxdeco/phnxfunc.c
@@ -22,12 +22,7 @@ typedef unsigned short word;
#define XtractM 0x20
#define ListM 0x21
-
-#ifndef __LINUX_NOW__
-#define IDSign ""
-#else
#define IDSign "+"
-#endif
typedef struct {
FILE *infile;
@@ -168,11 +163,11 @@ byte *GetModuleName(byte ID)
return ("WAV");
case 'H':
- return ("TCPA_H"); // TCPA (Trust Computing), USBKCLIB?
+ return ("TCPA_H"); /* TCPA (Trust Computing), USBKCLIB? */
case 'K':
- return ("TCPA_K"); // TCPA (Trust Computing), "AUTH"?
+ return ("TCPA_K"); /* TCPA (Trust Computing), "AUTH"? */
case 'Q':
- return ("TCPA_Q"); // TCPA (Trust Computing), "SROM"?
+ return ("TCPA_Q"); /* TCPA (Trust Computing), "SROM"? */
case '<':
return ("TCPA_<");
case '*':
@@ -214,12 +209,9 @@ byte *GetCompressionName(byte ID)
void decodeM3(interfacing interface)
{
FILE *ptx, *bmx;
-
- /*------------------------*/
word Index, Index2, DX, Loop, XorOp, i;
byte *Buffer, tmp;
dword RealLen, Now;
- /*------------------------*/
ptx = interface.infile;
bmx = interface.outfile;
@@ -357,12 +349,10 @@ byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize)
interface.dicbit = 13;
interface.method = 5;
- /*---------------------------------------------
- isPacked == PackedLevel == CompressionName
- ----------------------------------------------*/
- if (phhead.isPacked == 0x5) {
+ /* isPacked == PackedLevel == CompressionName */
+ if (phhead.isPacked == 0x5)
decode(interface);
- } else if (phhead.isPacked == 0x3) {
+ else if (phhead.isPacked == 0x3) {
fseek(ptx, -4L, 1);
decodeM3(interface);
} else {
@@ -377,8 +367,6 @@ byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize)
printf("Done\n");
break;
- /* End of Xtract */
-
}
} else {
@@ -391,22 +379,20 @@ byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize)
CurPos = Tmp;
continue;
}
-
CurPos += phhead.Packed1;
} else
CurPos = ftell(ptx);
-
-
}
return (TotalSec);
}
-/*---------------Modified Module Detection & Manipulating------------
- According to BCPSYS block
---------------------------------------------------------------------*/
+/*
+ * Modified Module Detection & Manipulating
+ * According to BCPSYS block
+ */
byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff, dword SYSOff)
{
FILE *pto, *scr;
@@ -427,10 +413,6 @@ byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff,
phhead.Prev = 0xFFFF0000;
fseek(ptx, 0, 2);
-
- /*-------- Start Phoenix compatible script file ----------*/
- /*-------- End Phoenix compatible script file ----------*/
-
switch (Action) {
case ListM:
@@ -490,12 +472,10 @@ byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff,
interface.dicbit = 13;
interface.method = 5;
- /*---------------------------------------------
- Evidently, isPacked == PackedLevel
- ----------------------------------------------*/
- if (phhead.isPacked == 0x5) {
+ /* Evidently, isPacked == PackedLevel */
+ if (phhead.isPacked == 0x5)
decode(interface);
- } else if (phhead.isPacked == 0x3) {
+ else if (phhead.isPacked == 0x3) {
fseek(ptx, -4L, 1);
decodeM3(interface);
} else {
@@ -508,13 +488,8 @@ byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff,
fclose(pto);
break;
- /* End of Xtract */
-
}
- /* End of switch */
-
}
- /* End of while */
return (TotalSec);
}
@@ -532,7 +507,7 @@ dword IsPhoenixBIOS(FILE * ptx, byte * Buf)
fread(Buf, 1, BLOCK, ptx);
if ((CurPos = FoundAt(ptx, Buf, PhoenixPattern, BLOCK)) != 0)
break;
- /*---------O'K, we got PhoenixBIOS 4.0 hook---------*/
+ /* O'K, we got PhoenixBIOS 4.0 hook */
CurPos = ftell(ptx) - 0x100;
}
@@ -542,11 +517,11 @@ dword IsPhoenixBIOS(FILE * ptx, byte * Buf)
fread(Buf, 1, BLOCK, ptx);
if ((CurPos = FoundAt(ptx, Buf, FirstPattern, BLOCK)) != 0)
break;
- /*---------O'K, we got Phoenix FirstBIOS hook---------*/
+ /* O'K, we got Phoenix FirstBIOS hook */
CurPos = ftell(ptx) - 0x100;
}
- /*---------Neither PhoenixBIOS 4.0 nor FirstBIOS---*/
+ /* Neither PhoenixBIOS 4.0 nor FirstBIOS */
if (feof(ptx))
return (0);
diff --git a/phnxdeco/phnxhelp.h b/phnxdeco/phnxhelp.h
deleted file mode 100644
index fbeefb8..0000000
--- a/phnxdeco/phnxhelp.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**********************************************
-**
-**
-** Defines for PhnxHelp
-**
-**
-***********************************************/
-
-#include <stdio.h>
-
-
-byte HelpSystem(byte argc, byte * argv[])
-{
- byte x = 0, retcode = 0;
-
- for (x = 1; x < argc; x++) {
- if (StrCmp(argv[x], "-h") == 0) {
- printf("\n" SftName " HelpSystem Starting Now!\n");
- printf("\nThis Program Version Number %s", SftVersion);
-
-#ifndef __LINUX_NOW__
- printf("\n" SftName " - Decompressor for PhoenixBIOSes only.\n" "\tSupported formats: Phoenix BIOS 4.0, Phoenix FirstBIOS\n\n" "" SftName
- " performs on 386 or better CPU systems\n" "under control of DOS, Win3.xx, Win9x/NT/2K or DosEmu\n\n"
- "Compression schemes include: NONE, LZSS, LZINT\n\n" "Modules marked with " IDSign " sign are compressed modules\n\n"
- "\tBug reports mailto: " SftEMail "\n" "\t\tCompiled: %s, %s\n", __DATE__, __TIME__);
-#else
- printf("\n" SftName " - Decompressor for PhoenixBIOSes only.\n" "\tSupported formats: Phoenix BIOS 4.0, Phoenix FirstBIOS\n\n" "" SftName
- " performs on 386 or better CPU systems\n" "under control of LinuxOS\n\n" "Compression schemes include: NONE, LZSS, LZINT\n\n"
- "Modules marked with " IDSign " sign are compressed modules\n\n" "\tBug reports mailto: " SftEMail "\n" "\t\tCompiled: %s, %s with \n\t\t%s",
- __DATE__, __TIME__, __VERSION__);
-#endif
- printf("\n");
- retcode = 0x80;
-
- }
-
- if (StrCmp(argv[x], "-xs") == 0)
- retcode = 0x20;
- if (StrCmp(argv[x], "-ls") == 0)
- retcode = 0x21;
- if (StrCmp(argv[x], "-x") == 0)
- retcode = 0x10;
- if (StrCmp(argv[x], "-l") == 0)
- retcode = 0x11;
- if (StrCmp(argv[x], "-c") == 0)
- retcode += 0x40;
- }
- return (retcode);
-
-}
-
-void PrintHeader(byte * EOL)
-{
-
- printf("\n%c%s%c%s", 0x4, SoftName, 0x4, EOL);
-
-}
-
-void PrintUsage()
-{
-
- PrintHeader("");
- printf("%s", CopyRights);
- printf("\n\nUsage: PhnxDeco <PhoenixBIOS.ROM> [Options]");
- printf("\n" "\t\tOptions:" "\n\t\t\t\"-ls\" List (System) Bios Structure" "\n\t\t\t\"-xs\" eXtract (System) Bios Modules"
- "\n\t\t\t\"-l\" List Bios Structure" "\n\t\t\t\"-x\" eXtract Bios Modules" "\n\t\t\t\"-c\" show Bios Copyrights" "\n\t\t\t\"-h\" Help statistics");
- printf("\n\n\t*%s*\n", Url);
-
-}
diff --git a/phnxdeco/phnxsoft.h b/phnxdeco/phnxsoft.h
deleted file mode 100644
index 40bbf3b..0000000
--- a/phnxdeco/phnxsoft.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/**********************************************
-**
-**
-** Defines for PhnxSoft
-**
-**
-***********************************************/
-
-#include <stdio.h>
-#include "./phnxver.h"
-
-#define SftName "PhoenixDeco"
-#define SftEMail "Anton Borisov, anton.borisov@gmail.com"
-
- /********SoftWare*************/
-byte SoftName[] = "-=" SftName ", version " SftVersion "=-";
-byte CopyRights[] = "\n(C) Anton Borisov, 2000, 2002-2004, Portions (C) 1999-2000";
-byte Url[] = "Bug-reports direct to " SftEMail;
diff --git a/phnxdeco/phnxver.h b/phnxdeco/phnxver.h
deleted file mode 100644
index 268b11b..0000000
--- a/phnxdeco/phnxver.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/**********************************************
-**
-**
-** Defines for PhnxVer
-**
-**
-***********************************************/
-
-#include <stdio.h>
-
-#ifdef __LINUX_NOW__
-#define SftPlatform "Linux"
-#else
-#define SftPlatform "DOS32"
-#endif
-
-#define SftVersion "0.33 ("SftPlatform")"