From d85b180a418ea81eb1845b72e6ba6d1b98699a74 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 17 Jun 2026 13:21:35 -0700 Subject: [PATCH] prowizard: update integrated ripper to 1.70a Refresh the bundled ProWizard sources from the standalone 1.70a tree and add the new ripper modules to the Unix and Visual Studio build lists. Keep the WinUAE entry point, module-ripper file hooks, logging, and byte-order compatibility shims while updating the visible Pro Wizard version labels. Drop duplicate upstream source aliases from the integrated build lists so the imported ripper objects link without duplicate definitions. --- CMakeLists.txt | 18 + od-unix/qt/launcher.cpp | 2 +- od-win32/prowizard/prowizard.vcxproj | 20 +- od-win32/prowizard/prowizard.vcxproj.filters | 56 +- od-win32/resources/winuae.rc | 2 +- od-win32/resources/winuae_minimal.rc | 2 +- od-win32/resources/winuae_old.rc | 2 +- prowizard/include/extern.h | 339 ++-- prowizard/include/globals.h | 61 +- prowizard/include/tuning.h | 2 +- prowizard/include/vars.h | 32 +- prowizard/misc/misc.c | 187 ++- prowizard/misc/testbag.c | 6 +- prowizard/prowiz.c | 1465 +++++++++++------- prowizard/rippers/AC1D_packer.c | 65 +- prowizard/rippers/AMF.c | 192 +++ prowizard/rippers/AMOS-MusicBank.c | 88 +- prowizard/rippers/AMOS-PowerPackerBank.c | 2 +- prowizard/rippers/BP-Soundmonitor.c | 22 +- prowizard/rippers/BSI-FutureComposer.c | 2 +- prowizard/rippers/Bytekiller.c | 276 +++- prowizard/rippers/ChipTracker.c | 56 +- prowizard/rippers/Crunchmania-Address.c | 125 +- prowizard/rippers/Crunchmania-Simple.c | 12 +- prowizard/rippers/DM1.c | 73 + prowizard/rippers/DefjamCruncher32-pro.c | 21 +- prowizard/rippers/DigiBooster17.c | 2 +- prowizard/rippers/DigitalIllusion.c | 124 +- prowizard/rippers/DoubleAction.c | 8 +- prowizard/rippers/Dragpack100.c | 28 +- prowizard/rippers/Dragpack252.c | 10 +- prowizard/rippers/EurekaPacker.c | 22 +- prowizard/rippers/FC-M-Packer.c | 16 +- prowizard/rippers/FastTracker2.c | 8 +- prowizard/rippers/FuchsTracker.c | 28 +- prowizard/rippers/FutureComposer13.c | 2 +- prowizard/rippers/FutureComposer14.c | 2 +- prowizard/rippers/FuzzacPacker.c | 28 +- prowizard/rippers/GMC.c | 72 +- prowizard/rippers/GNUPacker12.c | 10 +- prowizard/rippers/GPMO.c | 16 +- prowizard/rippers/GnuPlayer.c | 237 +-- prowizard/rippers/HCD.c | 161 ++ prowizard/rippers/HQC2.c | 10 +- prowizard/rippers/HeatseekerMC10.c | 20 +- prowizard/rippers/HighPresCr.c | 127 ++ prowizard/rippers/HornetPacker.c | 18 +- prowizard/rippers/IFF.c | 85 + prowizard/rippers/IT.c | 182 +++ prowizard/rippers/JamCracker.c | 2 +- prowizard/rippers/KefrensSoundMachine.c | 36 +- prowizard/rippers/MED-Octamed.c | 2 +- prowizard/rippers/MOD-compatible.c | 2 +- prowizard/rippers/MasterCruncher30-Address.c | 6 +- prowizard/rippers/MaxPacker12.c | 10 +- prowizard/rippers/MegaCruncher-Object.c | 10 +- prowizard/rippers/MegaCruncher.c | 12 +- prowizard/rippers/ModuleProtector.c | 105 +- prowizard/rippers/Mugician.c | 2 +- prowizard/rippers/NP3.c | 44 +- prowizard/rippers/Newtron.c | 14 +- prowizard/rippers/NewtronOld.c | 124 +- prowizard/rippers/NoiseFromHeaven.c | 18 +- prowizard/rippers/NoisePacker1.c | 32 +- prowizard/rippers/NoisePacker2.c | 44 +- prowizard/rippers/NoiseRunner.c | 24 +- prowizard/rippers/NovoTrade.c | 533 ++++--- prowizard/rippers/Perfsong.c | 342 ++++ prowizard/rippers/PhaPacker.c | 48 +- prowizard/rippers/PolkaPacker.c | 16 +- prowizard/rippers/PowerMusic.c | 14 +- prowizard/rippers/PowerPacker23.c | 6 +- prowizard/rippers/PowerPacker30.c | 6 +- prowizard/rippers/PowerPacker40-library.c | 10 +- prowizard/rippers/PowerPacker40.c | 6 +- prowizard/rippers/ProPacker10.c | 70 +- prowizard/rippers/ProPacker21.c | 37 +- prowizard/rippers/ProPacker30.c | 28 +- prowizard/rippers/Promizer01.c | 32 +- prowizard/rippers/Promizer10c.c | 111 +- prowizard/rippers/Promizer18a.c | 89 +- prowizard/rippers/Promizer20.c | 49 +- prowizard/rippers/Promizer40.c | 430 ++--- prowizard/rippers/Prorunner10.c | 43 +- prowizard/rippers/Prorunner20.c | 22 +- prowizard/rippers/QuadraComposer.c | 38 +- prowizard/rippers/RelokIt10.c | 10 +- prowizard/rippers/S3M.c | 130 ++ prowizard/rippers/SA.c | 369 +++++ prowizard/rippers/SGT-Packer.c | 42 +- prowizard/rippers/SkytPacker.c | 25 +- prowizard/rippers/SlamPacker.c | 283 ++++ prowizard/rippers/SoundFX.c | 24 +- prowizard/rippers/SoundTracker.c | 40 +- prowizard/rippers/SoundTracker26.c | 14 +- prowizard/rippers/SpikeCruncher.c | 6 +- prowizard/rippers/StartrekkerPack.c | 34 +- prowizard/rippers/StimPacker.c | 34 +- prowizard/rippers/StoneArtsPlayer.c | 322 ++-- prowizard/rippers/StoneCracker270.c | 10 +- prowizard/rippers/StoneCracker299.c | 10 +- prowizard/rippers/StoneCracker299b.c | 10 +- prowizard/rippers/StoneCracker299d.c | 10 +- prowizard/rippers/StoneCracker300.c | 10 +- prowizard/rippers/StoneCracker310.c | 10 +- prowizard/rippers/SuperCruncher27.c | 6 +- prowizard/rippers/SyncroPacker46.c | 12 +- prowizard/rippers/THX.c | 112 ++ prowizard/rippers/TMK.c | 39 +- prowizard/rippers/TNMCruncher.c | 12 +- prowizard/rippers/TetraPack102.c | 117 +- prowizard/rippers/TetraPack21.c | 12 +- prowizard/rippers/TetraPack22.c | 12 +- prowizard/rippers/TheDarkDemon.c | 37 +- prowizard/rippers/ThePlayer22a.c | 42 +- prowizard/rippers/ThePlayer30a.c | 42 +- prowizard/rippers/ThePlayer40.c | 54 +- prowizard/rippers/ThePlayer41a.c | 85 +- prowizard/rippers/ThePlayer50a.c | 55 +- prowizard/rippers/ThePlayer60a.c | 58 +- prowizard/rippers/ThePlayer61a.c | 56 +- prowizard/rippers/TimeCruncher17.c | 10 +- prowizard/rippers/TitanicsPlayer.c | 50 +- prowizard/rippers/TrackerPacker1.c | 34 +- prowizard/rippers/TrackerPacker2.c | 32 +- prowizard/rippers/TrackerPacker3.c | 30 +- prowizard/rippers/TreasurePattern.c | 26 +- prowizard/rippers/TryItCruncher101.c | 10 +- prowizard/rippers/TurboSqueezer61.c | 12 +- prowizard/rippers/UnicTracker.c | 45 +- prowizard/rippers/UnicTracker2.c | 20 +- prowizard/rippers/Viruz2.c | 272 ++-- prowizard/rippers/WantonPacker.c | 16 +- prowizard/rippers/XannPlayer.c | 26 +- prowizard/rippers/ZenPacker.c | 34 +- prowizard/rippers/bnr.c | 214 +++ prowizard/rippers/datacrunchers.c | 35 +- prowizard/rippers/mosh.c | 185 +++ prowizard/rippers/okta.c | 141 ++ prowizard/rippers/pmd3.c | 310 ++++ prowizard/rippers/sidmon1.c | 157 ++ prowizard/rippers/sidmon2.c | 82 + prowizard/rippers/skizzo.c | 365 ++--- prowizard/rippers/struggle.c | 199 +++ 144 files changed, 7878 insertions(+), 3332 deletions(-) create mode 100644 prowizard/rippers/AMF.c create mode 100644 prowizard/rippers/DM1.c create mode 100644 prowizard/rippers/HCD.c create mode 100644 prowizard/rippers/HighPresCr.c create mode 100644 prowizard/rippers/IFF.c create mode 100644 prowizard/rippers/IT.c create mode 100644 prowizard/rippers/Perfsong.c create mode 100644 prowizard/rippers/S3M.c create mode 100644 prowizard/rippers/SA.c create mode 100644 prowizard/rippers/SlamPacker.c create mode 100644 prowizard/rippers/THX.c create mode 100644 prowizard/rippers/bnr.c create mode 100644 prowizard/rippers/mosh.c create mode 100644 prowizard/rippers/okta.c create mode 100644 prowizard/rippers/pmd3.c create mode 100644 prowizard/rippers/sidmon1.c create mode 100644 prowizard/rippers/sidmon2.c create mode 100644 prowizard/rippers/struggle.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 779a0f01..18aeabbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1052,6 +1052,7 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/prowiz.c prowizard/misc/testbag.c prowizard/rippers/AC1D_packer.c + prowizard/rippers/AMF.c prowizard/rippers/AMOS-MusicBank.c prowizard/rippers/AMOS-PowerPackerBank.c prowizard/rippers/BP-Soundmonitor.c @@ -1065,6 +1066,7 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/rippers/DigiBooster17.c prowizard/rippers/DigitalIllusion.c prowizard/rippers/DoubleAction.c + prowizard/rippers/DM1.c prowizard/rippers/Dragpack100.c prowizard/rippers/Dragpack252.c prowizard/rippers/EurekaPacker.c @@ -1078,9 +1080,13 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/rippers/GNUPacker12.c prowizard/rippers/GnuPlayer.c prowizard/rippers/GPMO.c + prowizard/rippers/HCD.c prowizard/rippers/HeatseekerMC10.c + prowizard/rippers/HighPresCr.c prowizard/rippers/HornetPacker.c prowizard/rippers/HQC2.c + prowizard/rippers/IFF.c + prowizard/rippers/IT.c prowizard/rippers/JamCracker.c prowizard/rippers/KefrensSoundMachine.c prowizard/rippers/MasterCruncher30-Address.c @@ -1100,6 +1106,7 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/rippers/NovoTrade.c prowizard/rippers/NP3.c prowizard/rippers/PhaPacker.c + prowizard/rippers/Perfsong.c prowizard/rippers/PolkaPacker.c prowizard/rippers/PowerMusic.c prowizard/rippers/PowerPacker23.c @@ -1118,8 +1125,11 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/rippers/Prorunner20.c prowizard/rippers/QuadraComposer.c prowizard/rippers/RelokIt10.c + prowizard/rippers/S3M.c + prowizard/rippers/SA.c prowizard/rippers/SGT-Packer.c prowizard/rippers/skizzo.c + prowizard/rippers/SlamPacker.c prowizard/rippers/SkytPacker.c prowizard/rippers/SoundFX.c prowizard/rippers/SoundTracker.c @@ -1136,6 +1146,7 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/rippers/StoneCracker310.c prowizard/rippers/SuperCruncher27.c prowizard/rippers/SyncroPacker46.c + prowizard/rippers/THX.c prowizard/rippers/TetraPack102.c prowizard/rippers/TetraPack21.c prowizard/rippers/TetraPack22.c @@ -1160,6 +1171,13 @@ if(WINUAE_UNIX_WITH_PROWIZARD) prowizard/rippers/UnicTracker2.c prowizard/rippers/WantonPacker.c prowizard/rippers/XannPlayer.c + prowizard/rippers/bnr.c + prowizard/rippers/mosh.c + prowizard/rippers/okta.c + prowizard/rippers/pmd3.c + prowizard/rippers/sidmon1.c + prowizard/rippers/sidmon2.c + prowizard/rippers/struggle.c prowizard/rippers/ZenPacker.c ) list(APPEND WINUAE_UNIX_EXTRA_SOURCES diff --git a/od-unix/qt/launcher.cpp b/od-unix/qt/launcher.cpp index 8402ace5..44d2cfe0 100644 --- a/od-unix/qt/launcher.cpp +++ b/od-unix/qt/launcher.cpp @@ -9302,7 +9302,7 @@ private: root->addWidget(groupBox(QStringLiteral("Output Properties"), properties)); QPushButton *saveScreenshot = new QPushButton(QStringLiteral("Save screenshot")); - QPushButton *proWizard = new QPushButton(QStringLiteral("Pro Wizard 1.62")); + QPushButton *proWizard = new QPushButton(QStringLiteral("Pro Wizard 1.70a")); QCheckBox *sampleRipper = new QCheckBox(QStringLiteral("Sample ripper")); if (hardwareProvider.saveScreenshot) { connect(saveScreenshot, &QPushButton::clicked, this, [this]() { diff --git a/od-win32/prowizard/prowizard.vcxproj b/od-win32/prowizard/prowizard.vcxproj index deb16fd7..a00d3b69 100644 --- a/od-win32/prowizard/prowizard.vcxproj +++ b/od-win32/prowizard/prowizard.vcxproj @@ -284,6 +284,7 @@ + @@ -297,6 +298,7 @@ + @@ -310,9 +312,13 @@ + + + + @@ -332,6 +338,7 @@ + @@ -350,8 +357,11 @@ + + + @@ -368,6 +378,7 @@ + @@ -392,9 +403,16 @@ + + + + + + + - \ No newline at end of file + diff --git a/od-win32/prowizard/prowizard.vcxproj.filters b/od-win32/prowizard/prowizard.vcxproj.filters index ec062f2b..8ccca1b8 100644 --- a/od-win32/prowizard/prowizard.vcxproj.filters +++ b/od-win32/prowizard/prowizard.vcxproj.filters @@ -28,6 +28,9 @@ Source Files + + Source Files\Rippers + Source Files\Rippers @@ -67,6 +70,9 @@ Source Files\Rippers + + Source Files\Rippers + Source Files\Rippers @@ -103,15 +109,27 @@ Source Files\Rippers + + Source Files\Rippers + Source Files\Rippers + + Source Files\Rippers + Source Files\Rippers Source Files\Rippers + + Source Files\Rippers + + + Source Files\Rippers + Source Files\Rippers @@ -166,6 +184,9 @@ Source Files\Rippers + + Source Files\Rippers + Source Files\Rippers @@ -220,12 +241,21 @@ Source Files\Rippers + + Source Files\Rippers + + + Source Files\Rippers + Source Files\Rippers Source Files\Rippers + + Source Files\Rippers + Source Files\Rippers @@ -274,6 +304,9 @@ Source Files\Rippers + + Source Files\Rippers + Source Files\Rippers @@ -346,6 +379,27 @@ Source Files\Rippers + + Source Files\Rippers + + + Source Files\Rippers + + + Source Files\Rippers + + + Source Files\Rippers + + + Source Files\Rippers + + + Source Files\Rippers + + + Source Files\Rippers + Source Files\Rippers @@ -358,4 +412,4 @@ Source Files\Rippers - \ No newline at end of file + diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 838cbce2..4332d089 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -899,7 +899,7 @@ BEGIN CONTROL "AVI output enabled",IDC_AVIOUTPUT_ACTIVATED,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT,15,129,144,14 GROUPBOX "Ripper",IDC_STATIC,1,155,393,65 PUSHBUTTON "Save screenshot",IDC_SCREENSHOT,28,169,87,14 - PUSHBUTTON "Pro Wizard 1.62",IDC_PROWIZARD,162,169,87,14,WS_DISABLED + PUSHBUTTON "Pro Wizard 1.70a",IDC_PROWIZARD,162,169,87,14,WS_DISABLED CONTROL "Sample ripper",IDC_SAMPLERIPPER_ACTIVATED,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT,280,169,87,14 CONTROL "Take screenshot before filtering",IDC_SCREENSHOT_ORIGINALSIZE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,192,130,10 diff --git a/od-win32/resources/winuae_minimal.rc b/od-win32/resources/winuae_minimal.rc index e3339347..3c98109d 100644 --- a/od-win32/resources/winuae_minimal.rc +++ b/od-win32/resources/winuae_minimal.rc @@ -896,7 +896,7 @@ BEGIN CONTROL "AVI output enabled",IDC_AVIOUTPUT_ACTIVATED,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT,15,129,144,14 GROUPBOX "Ripper",IDC_STATIC,1,155,393,65 PUSHBUTTON "Save screenshot",IDC_SCREENSHOT,28,169,87,14 - PUSHBUTTON "Pro Wizard 1.62",IDC_PROWIZARD,162,169,87,14,WS_DISABLED + PUSHBUTTON "Pro Wizard 1.70a",IDC_PROWIZARD,162,169,87,14,WS_DISABLED CONTROL "Sample ripper",IDC_SAMPLERIPPER_ACTIVATED,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_FLAT,280,169,87,14 CONTROL "Take screenshot before filtering",IDC_SCREENSHOT_ORIGINALSIZE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,192,130,10 diff --git a/od-win32/resources/winuae_old.rc b/od-win32/resources/winuae_old.rc index cd559af7..4a43b451 100644 --- a/od-win32/resources/winuae_old.rc +++ b/od-win32/resources/winuae_old.rc @@ -609,7 +609,7 @@ BEGIN LTEXT "fps",IDC_AVIOUTPUT_FPS_STATIC,255,84,19,8 PUSHBUTTON "Save screenshot",IDC_SCREENSHOT,16,141,76,14 GROUPBOX "Ripper",IDC_STATIC,5,127,274,38 - PUSHBUTTON "Pro Wizard 1.62",IDC_PROWIZARD,100,141,76,14,WS_DISABLED + PUSHBUTTON "Pro Wizard 1.70a",IDC_PROWIZARD,100,141,76,14,WS_DISABLED CONTROL "Sample ripper",IDC_SAMPLERIPPER_ACTIVATED,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,192,141,77,14 GROUPBOX "Input Recorder",IDC_STATIC,5,166,274,33 CONTROL "Record",IDC_INPREC_RECORD,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE | BS_FLAT,191,177,77,14 diff --git a/prowizard/include/extern.h b/prowizard/include/extern.h index 593d3b42..70efe1b6 100644 --- a/prowizard/include/extern.h +++ b/prowizard/include/extern.h @@ -3,132 +3,162 @@ * * part of Pro-Wizard-1 package * (c) Sylvain "Asle" Chipaux + +20071216 some pbs pointed out by Luigi Auriemma. Thx. + */ +#ifndef _GLOBALS_H +#include "globals.h" +#endif /* _GLOBALS_H */ + /* tests */ #ifdef INCLUDEALL -extern short testArcDDataCruncher ( void ); -extern short testByteKiller_13 ( void ); -extern short testByteKiller_20 ( void ); -extern short testByteKiller30 ( void ); -extern short testbytekillerpro10 ( void ); -extern short testcrunchmaniaAddr ( void ); -extern short testcrunchmaniaSimple ( void ); -extern short testCRND ( void ); -extern short testDefjam32 ( void ); -extern short testDefjam32pro ( void ); -extern short testDefjamCruncher32t (void); -extern short testDoubleAction10 ( void ); -extern short testDragpack100 ( void ); -extern short testDragpack252 ( void ); -extern short testGNUPacker12 (void); -extern short testHQCCruncher2 ( void ); -extern short testMasterCruncher30addr ( void ); -extern short testMaxPacker12 ( void ); -extern short testMegaCruncher10 ( void ); -extern short testMegaCruncher12 ( void ); -extern short testMegaCruncherObj ( void ); -extern short testPowerpacker23 ( void ); -extern short testPowerpacker30 ( void ); -extern short testPowerpacker40 ( void ); -extern short testPowerpacker4lib ( void ); -extern short testPPbk ( void ); -extern short testRelokIt10 ( void ); -extern short testSpikeCruncher ( void ); -extern short testSTC299 ( void ); -extern short testSTC299b ( void ); -extern short testSTC299d ( void ); -extern short testSTC300 ( void ); -extern short testSTC310 ( void ); -extern short testStoneCracker270 ( void ); -extern short testSuperCruncher27 ( void ); -extern short testSyncroPacker ( void ); -extern short testTetrapack102 ( void ); -extern short testTetrapack_2_1 ( void ); -extern short testTetrapack_2_2 ( void ); -extern short testTimeCruncher17 ( void ); -extern short testTNMCruncher11 ( void ); -extern short testTryIt101 ( void ); -extern short testTurboSqueezer61 ( void ); +extern int16_t testArcDDataCruncher ( void ); +extern int16_t testB9AB ( void ); +extern int16_t testByteKiller_13 ( void ); +extern int16_t testByteKiller_20 ( void ); +extern int16_t testByteKiller30 ( void ); +extern int16_t testbytekillerpro10 ( void ); +extern int16_t testBKCloneFLT ( void ); +extern int16_t testBKClone5 ( void ); +extern int16_t testcrunchmaniaAddr ( int ); +extern int16_t testcrunchmaniaSimple ( void ); +extern int16_t testCRND ( void ); +extern int16_t testDefjam32 ( void ); +extern int16_t testDefjam32pro ( void ); +extern int16_t testDefjam32t (void); +extern int16_t testDietDataPacker ( void ); +extern int16_t testDoubleAction10 ( void ); +extern int16_t testDragpack100 ( void ); +extern int16_t testDragpack252 ( void ); +extern int16_t testGNUPacker12 (void); +extern int16_t testHighPressureCruncher ( void ); +extern int16_t testHQCCruncher2 ( void ); +extern int16_t testIFF ( void ); +extern int16_t testIT ( void ); +extern int16_t testMasterCruncher30addr ( void ); +extern int16_t testMaxPacker12 ( void ); +extern int16_t testMegaCruncher10 ( void ); +extern int16_t testMegaCruncher12 ( void ); +extern int16_t testMegaCruncherObj ( void ); +extern int16_t testPowerpacker23 ( void ); +extern int16_t testPowerpacker30 ( void ); +extern int16_t testPowerpacker40 ( void ); +extern int16_t testPowerpacker4lib ( void ); +extern int16_t testPPbk ( void ); +extern int16_t testRelokIt10 ( void ); +extern int16_t testS3M (void); +extern int16_t testSpikeCruncher ( void ); +extern int16_t testSTC299 ( void ); +extern int16_t testSTC299b ( void ); +extern int16_t testSTC299d ( void ); +extern int16_t testSTC300 ( void ); +extern int16_t testSTC310 ( void ); +extern int16_t testStoneCracker270 ( void ); +extern int16_t testSuperCruncher27 ( void ); +extern int16_t testSyncroPacker ( void ); +extern int16_t testTetrapack102 ( void ); +extern int16_t testTetrapack101 ( void ); +extern int16_t testTetrapack_2_1 ( void ); +extern int16_t testTetrapack_2_2 ( void ); +extern int16_t testTimeCruncher17 ( void ); +extern int16_t testTNMCruncher11 ( void ); +extern int16_t testTryIt101 ( void ); +extern int16_t testTurboSqueezer61 ( void ); #endif -extern short testAC1D ( void ); -extern short testAmBk ( void ); -extern short testBP ( void ); -extern short testBSIFutureComposer ( void ); -extern short testDI ( void ); -extern short testDigiBooster17 ( void ); -extern short testEUREKA ( void ); -extern short testFC_M ( void ); -extern short testFC13 ( void ); -extern short testFC14 ( void ); -extern short testFuchsTracker ( void ); -extern short testFUZZAC ( void ); -extern short testGnuPlayer ( void ); -extern short testGMC ( void ); -extern short testGPMO ( void ); -extern short testHEATSEEKER ( void ); -extern short testHRT ( void ); -extern short testJamCracker ( void ); -extern short testKRIS ( void ); -extern short testKSM ( void ); -extern short testMMD0 ( void ); -extern short testMOD ( int ); -extern short testMP_noID ( void ); -extern short testMP_withID ( void ); -extern short testMUGICIAN ( void ); -extern short testNewtron ( void ); -extern short testNewtronOld ( void ); -extern short testNFH ( void ); -extern short testNoiserunner ( void ); -extern short testNoisepacker1 ( void ); -extern short testNoisepacker2 ( void ); -extern short testNoisepacker3 ( void ); -extern short testNovoTrade ( void ); -extern short testP40A ( void ); -extern short testP41A ( void ); -extern short testP50A ( void ); -extern short testP60A_nopack ( void ); -extern short testP60A_pack ( void ); -extern short testP61A_nopack ( void ); -extern short testP61A_pack ( void ); -extern short testPHA ( void ); -extern short testPM ( void ); -extern short testPM01 ( void ); -extern short testPM10c ( void ); -extern short testPM2 ( void ); -extern short testPM40 ( void ); -extern short testPMZ ( void ); -extern short testPolka ( void ); -extern short testPP10 ( void ); -extern short testPP21 ( void ); -extern short testPP30 ( void ); -extern short testPRUN1 ( void ); -extern short testPRUN2 ( void ); -/*extern short testPTK ( void );*/ -extern short testQuadraComposer ( void ); -extern short testSGT ( void ); -extern short testSkizzo ( void ); -extern short testSKYT ( void ); -extern short testSoundFX13 ( void ); -extern short testSoundTracker ( void ); -extern short testSTARPACK ( void ); -extern short testSTK26 ( void ); -extern short testSTIM ( void ); -extern short testStoneArtsPlayer ( void ); -extern short testTheDarkDemon ( void ); -extern short testTitanicsPlayer ( void ); -extern short testTMK ( void ); -extern short testTP1 ( void ); -extern short testTP2 ( void ); -extern short testTP3 ( void ); -extern short testUNIC_noID ( void ); -extern short testUNIC_withID ( void ); -extern short testUNIC_withemptyID ( void ); -extern short testUNIC2 ( void ); -extern short testWN ( void ); -extern short testXANN ( void ); -extern short testXM ( void ); -extern short testZEN ( void ); +extern int16_t testAC1D ( void ); +extern int16_t testAmBk ( void ); +extern int16_t testBP ( void ); +extern int16_t testBNR ( void ); +extern int16_t testBSIFutureComposer ( void ); +extern int16_t testDI ( void ); +extern int16_t testDigiBooster17 ( void ); +extern int16_t testDM1 ( void ); +extern int16_t testEUREKA ( void ); +extern int16_t testFC_M ( void ); +extern int16_t testFC13 ( void ); +extern int16_t testFC14 ( void ); +extern int16_t testFuchsTracker ( void ); +extern int16_t testFUZZAC ( void ); +extern int16_t testGnuPlayer ( void ); +extern int16_t testGMC ( void ); +extern int16_t testGPMO ( void ); +extern int16_t testHEATSEEKER ( void ); +extern int16_t testHCD ( void ); +extern int16_t testHRT ( void ); +extern int16_t testIFF ( void ); +extern int16_t testJamCracker ( void ); +extern int16_t testKRIS ( void ); +extern int16_t testKSM ( void ); +extern int16_t testMMD0 ( void ); +extern int16_t testMOD ( int ); +extern int16_t testMOSH ( void ); +extern int16_t testMP_noID ( void ); +extern int16_t testMP_withID ( void ); +extern int16_t testMUGICIAN ( void ); +extern int16_t testOkta ( void ); +extern int16_t testNewtron ( void ); +extern int16_t testNewtronOld ( void ); +extern int16_t testNFH ( void ); +extern int16_t testNoiserunner ( void ); +extern int16_t testNoisepacker1 ( void ); +extern int16_t testNoisepacker2 ( void ); +extern int16_t testNoisepacker3 ( void ); +extern int16_t testNovoTrade ( void ); +extern int16_t testP40A ( void ); +extern int16_t testP41A ( void ); +extern int16_t testP50A ( void ); +extern int16_t testP60A_nopack ( void ); +extern int16_t testP60A_pack ( void ); +extern int16_t testP61A_nopack ( void ); +extern int16_t testP61A_pack ( void ); +extern int16_t testPERFSONG ( void ); +extern int16_t testPHA ( void ); +extern int16_t testPM ( void ); +extern int16_t testPM01 ( void ); +extern int16_t testPM10c ( void ); +extern int16_t testPM2 ( void ); +extern int16_t testPM40 ( void ); +extern int16_t testPMD3 ( void ); +extern int16_t testPMZ ( void ); +extern int16_t testPolka ( void ); +extern int16_t testPP10 ( void ); +extern int16_t testPP21 ( void ); +extern int16_t testPP30 ( void ); +extern int16_t testPRUN1 ( void ); +extern int16_t testPRUN2 ( void ); +/*extern int16_t testPTK ( void );*/ +extern int16_t testQuadraComposer ( void ); +extern int16_t testSA ( void ); +extern int16_t testSAhunk ( void ); +extern int16_t testSGT ( void ); +extern int16_t testSIDMON1 (void); +extern int16_t testSIDMON2 (void); +extern int16_t testSkizzo ( void ); +extern int16_t testSKYT ( void ); +extern int16_t testSoundFX13 ( void ); +extern int16_t testSoundTracker ( void ); +extern int16_t testSTARPACK ( void ); +extern int16_t testSTK26 ( void ); +extern int16_t testSTIM ( void ); +extern int16_t testStoneArtsPlayer ( void ); +extern int16_t testSTRUGGLE ( void ); +extern int16_t testTheDarkDemon ( void ); +extern int16_t testTitanicsPlayer ( void ); +extern int16_t testTHX ( void ); +extern int16_t testTMK ( void ); +extern int16_t testTP1 ( void ); +extern int16_t testTP2 ( void ); +extern int16_t testTP3 ( void ); +extern int16_t testUNIC_noID ( void ); +extern int16_t testUNIC_withID ( void ); +extern int16_t testUNIC_withemptyID ( void ); +extern int16_t testUNIC2 ( void ); +extern int16_t testWN ( void ); +extern int16_t testXANN ( void ); +extern int16_t testXM ( void ); +extern int16_t testZEN ( void ); /* rips */ @@ -136,14 +166,20 @@ extern short testZEN ( void ); extern void Rip_ByteKiller ( void ); extern void Rip_ByteKiller30 ( void ); extern void Rip_bytekillerpro10 ( void ); +extern void Rip_BKCloneFLT ( void ); +extern void Rip_BKClone5 ( void ); extern void Rip_CrunchmaniaAddr ( void ); extern void Rip_CrunchmaniaSimple ( void ); extern void Rip_Defjam32 ( void ); +extern void Rip_DietDataPacker ( void ); extern void Rip_DoubleAction10 ( void ); extern void Rip_Dragpack100 ( void ); extern void Rip_Dragpack252 ( void ); extern void Rip_GNUPacker12 (void); +extern void Rip_HighPressureCruncher ( void ); extern void Rip_HQCCruncher2 ( void ); +extern void Rip_IFF ( void ); +extern void Rip_IT ( void ); extern void Rip_MasterCruncher30addr ( void ); extern void Rip_MaxPacker12 ( void ); extern void Rip_MegaCruncher ( void ); @@ -154,6 +190,7 @@ extern void Rip_Powerpacker40 ( void ); extern void Rip_Powerpacker4lib ( void ); extern void Rip_PPbk ( void ); extern void Rip_RelokIt10 ( void ); +extern void Rip_S3M ( void ); extern void Rip_SpikeCruncher ( void ); extern void Rip_STC299 ( void ); extern void Rip_STC299b ( void ); @@ -164,6 +201,7 @@ extern void Rip_StoneCracker270 ( void ); extern void Rip_SuperCruncher27 ( void ); extern void Rip_SyncroPacker ( void ); extern void Rip_Tetrapack102 ( void ); +extern void Rip_Tetrapack101 ( void ); extern void Rip_Tetrapack_2_1 ( void ); extern void Rip_Tetrapack_2_2 ( void ); extern void Rip_TimeCruncher17 ( void ); @@ -173,10 +211,12 @@ extern void Rip_TurboSqueezer61 ( void ); #endif extern void Rip_AC1D ( void ); extern void Rip_AmBk ( void ); +extern void Rip_BNR ( void ); extern void Rip_BP ( void ); extern void Rip_BSIFutureComposer ( void ); extern void Rip_DI ( void ); extern void Rip_DigiBooster17 ( void ); +extern void Rip_DM1 ( void ); extern void Rip_EUREKA ( void ); extern void Rip_FC_M ( void ); extern void Rip_FC13 ( void ); @@ -187,12 +227,15 @@ extern void Rip_GnuPlayer ( void ); extern void Rip_GMC ( void ); extern void Rip_GPMO ( void ); extern void Rip_HEATSEEKER ( void ); +extern void Rip_HCD ( void ); extern void Rip_HRT ( void ); +extern void Rip_IFF ( void ); extern void Rip_JamCracker ( void ); extern void Rip_KRIS ( void ); extern void Rip_KSM ( void ); extern void Rip_MMD0 ( void ); extern void Rip_MOD ( int ); +extern void Rip_MOSH ( void ); extern void Rip_MUGICIAN ( void ); extern void Rip_MP_noID ( void ); extern void Rip_MP_withID ( void ); @@ -204,6 +247,7 @@ extern void Rip_Noisepacker2 ( void ); extern void Rip_Noisepacker3 ( void ); extern void Rip_Noiserunner ( void ); extern void Rip_NovoTrade ( void); +extern void Rip_Okta ( void ); extern void Rip_P22A ( void ); extern void Rip_P30A ( void ); extern void Rip_P40A ( void ); @@ -212,6 +256,7 @@ extern void Rip_P41A ( void ); extern void Rip_P50A ( void ); extern void Rip_P60A ( void ); extern void Rip_P61A ( void ); +extern void Rip_PERFSONG ( void ); extern void Rip_PHA ( void ); extern void Rip_PM ( void ); extern void Rip_PM01 ( void ); @@ -219,13 +264,17 @@ extern void Rip_PM10c ( void ); extern void Rip_PM18a ( void ); extern void Rip_PM20 ( void ); extern void Rip_PM40 ( void ); +extern void Rip_PMD3 ( void ); extern void Rip_Polka ( void ); extern void Rip_PP10 ( void ); extern void Rip_PP21 ( void ); extern void Rip_PP30 ( void ); /*extern void Rip_PTK ( void );*/ extern void Rip_QuadraComposer ( void ); +extern void Rip_SA ( void ); extern void Rip_SGT ( void ); +extern void Rip_SIDMON1 ( void ); +extern void Rip_SIDMON2 ( void ); extern void Rip_Skizzo ( void ); extern void Rip_SKYT ( void ); extern void Rip_SoundFX13 ( void ); @@ -235,8 +284,10 @@ extern void Rip_STARPACK ( void ); extern void Rip_STK26 ( void ); extern void Rip_STIM ( void ); extern void Rip_StoneArtsPlayer ( void ); +extern void Rip_STRUGGLE ( void ); extern void Rip_TheDarkDemon ( void ); extern void Rip_TitanicsPlayer ( void ); +extern void Rip_THX ( void ); extern void Rip_TMK ( void ); extern void Rip_TP1 ( void ); extern void Rip_TP2 ( void ); @@ -256,6 +307,7 @@ extern void Rip_ZEN ( void ); extern void Depack_AmBk ( void ); extern void Depack_AC1D ( void ); extern void Depack_SoundFX13 ( void ); +extern void Depack_BNR ( void ); extern void Depack_DI ( void ); extern void Depack_EUREKA ( void ); extern void Depack_FC_M ( void ); @@ -265,10 +317,12 @@ extern void Depack_GnuPlayer ( void ); extern void Depack_GMC ( void ); extern void Depack_GPMO ( void ); extern void Depack_HEATSEEKER ( void ); +extern void Depack_HCD ( void ); extern void Depack_HRT ( void ); extern void Depack_KRIS ( void ); extern void Depack_KSM ( void ); extern void Depack_MP ( void ); +extern void Depack_MOSH ( void ); extern void Depack_Newtron ( void ); extern void Depack_NewtronOld ( void ); extern void Depack_NFH ( void ); @@ -284,6 +338,7 @@ extern void Depack_P41A ( void ); extern void Depack_P50A ( void ); extern void Depack_P60A ( void ); extern void Depack_P61A ( void ); +extern void Depack_PERFSONG ( void ); extern void Depack_PHA ( void ); extern void Depack_PM01 ( void ); extern void Depack_PM10c ( void ); @@ -291,6 +346,7 @@ extern void Depack_PM18a ( void ); extern void Depack_PM20 ( void ); extern void Depack_PM40 ( void ); extern void Depack_PM ( void ); +extern void Depack_PMD3 ( void ); extern void Depack_Polka ( void ); extern void Depack_PP10 ( void ); extern void Depack_PP21 ( void ); @@ -304,6 +360,7 @@ extern void Depack_SKYT ( void ); extern void Depack_STARPACK ( void ); extern void Depack_STK26 ( void ); extern void Depack_STIM ( void ); +extern void Depack_STRUGGLE ( void ); extern void Depack_StoneArtsPlayer ( void ); extern void Depack_TheDarkDemon ( void ); extern void Depack_TitanicsPlayer ( void ); @@ -322,16 +379,16 @@ extern void Depack_ZEN ( void ); extern void Support_Types ( void ); extern void Support_Types_FileDefault ( void ); extern void Save_Rip ( char *, int ); -extern void Save_Rip_Special ( char *, int, Uchar * , Ulong ); -extern void Crap (char *, Uchar, Uchar, FILE *); -extern void Crap15 (char *, Uchar, Uchar, FILE *); -extern short testSpecialCruncherData ( long , long ); +extern void Save_Rip_Special ( char *, int, uint8_t * , uint32_t ); +extern void Crap ( char *, uint8_t, uint8_t, FILE *); +extern void Crap15 ( char *, uint8_t, uint8_t, FILE *); +extern int16_t testSpecialCruncherData ( int32_t , int32_t ); extern void Rip_SpecialCruncherData ( char * , int , int ); -extern short test_1_start ( Ulong ); -extern short test_smps ( long, long, long, Uchar, Uchar ); -extern long PWGetFileSize ( char * ); +extern int16_t test_1_start ( uint32_t ); +extern int16_t test_smps ( int32_t, int32_t, int32_t, uint8_t, uint8_t ); +extern int32_t PWGetFileSize ( char * ); /* xigh: Should be 64-bits */ extern FILE * PW_fopen ( char *, char * ); -extern void fillPTKtable ( Uchar[37][2] ); +extern void fillPTKtable ( uint8_t[37][2] ); #ifndef htonl extern unsigned int htonl(unsigned int); #endif @@ -340,21 +397,21 @@ extern unsigned int htonl(unsigned int); /* Some say it's badly coding when using Globals ... sure it is, now what's the solution ? */ extern FILE *PW_in,*PW_out; -extern long PW_Start_Address; -extern Ulong OutputSize; -extern long PW_in_size; -extern long Cpt_Filename; -extern Ulong PW_i; -extern Ulong PW_j,PW_k,PW_l,PW_m,PW_n,PW_o; -extern Uchar *in_data; -/*extern Uchar OutName[5];*/ +extern int32_t PW_Start_Address; /* xigh: Should be 64 bits */ +extern uint32_t OutputSize; +extern int32_t PW_in_size; +extern int32_t Cpt_Filename; +extern uint32_t PW_i; +extern uint32_t PW_j,PW_k,PW_l,PW_m,PW_n,PW_o; +extern uint8_t *in_data; +/*extern uint8_t OutName[5];*/ extern char OutName_final[33]; extern char Depacked_OutName[33]; -extern Uchar Save_Status; -extern Ulong PW_WholeSampleSize; +extern uint8_t Save_Status; +extern uint32_t PW_WholeSampleSize; extern char Extensions[_KNOWN_FORMATS+1][33]; -extern Uchar CONVERT; -extern Uchar Amiga_EXE_Header; +extern uint8_t CONVERT; +extern uint8_t Amiga_EXE_Header; extern void pw_write_log (const char *, ...); extern FILE *moduleripper2_fopen (const char *name, const char *mode, const char *aid, int addr, int size); diff --git a/prowizard/include/globals.h b/prowizard/include/globals.h index 11c978af..46d375d2 100644 --- a/prowizard/include/globals.h +++ b/prowizard/include/globals.h @@ -1,28 +1,20 @@ +#ifndef _GLOBALS_H +#define _GLOBALS_H + /* * ProWizard PC include file */ #include #include +#include +/* #include */ #include -//#include #include #include -/*#include */ -#ifdef DOS -#include -#endif -#ifdef DMALLOC -#include "dmalloc.h" -#endif - - -typedef unsigned char Uchar; -typedef unsigned long Ulong; -typedef unsigned short Ushort; #ifdef _WIN32 -__inline Ulong htonlx (Ulong v) +__inline uint32_t htonlx (uint32_t v) { return (v >> 24) | ((v >> 8) & 0xff00) | (v << 24) | ((v << 8) & 0xff0000); } @@ -32,7 +24,6 @@ __inline Ulong htonlx (Ulong v) #endif #endif -#define _KNOWN_FORMATS 135 #define _TYPES_FILENAME "_types_" #define _TYPES_LINE_LENGHT 256 #define MINIMAL_FILE_LENGHT 64 @@ -183,6 +174,44 @@ enum TitanicsPlayer, NewtronOld, NovoTrade, - Skizzo, + GnoiPacker, StoneArtsPlayer, + SLAM, + S3M, + MOSH, + BNR, + HCD, + TPACK101, + STRUGGLE, + BKCloneFLT, + Oktalizer, + AHX, + Sidmon1, + Sidmon2, + PerfSong, + MASMDataCruncher, + ImpulseTracker, + HighPresCruncher, + SP20, + B9AB, + HVL, + BKClone5, + xVdg, + Diet, + LSDDataCruncher, + JamDataCruncher, + MentalImage, + BHC3CruncherData, + IFF, + SA, + DM1, + PMd3, + PMD3, + BHC2CruncherData, + Pac1, + + /* Must be the last : */ + _KNOWN_FORMATS }; + +#endif /* _GLOBALS_H */ diff --git a/prowizard/include/tuning.h b/prowizard/include/tuning.h index 1faa1e5e..c6c46d79 100644 --- a/prowizard/include/tuning.h +++ b/prowizard/include/tuning.h @@ -5,7 +5,7 @@ */ -short Tuning[16][36] = { +int16_t Tuning[16][36] = { { 856,808,762,720,678,640,604,570,538,508,480,453, 428,404,381,360,339,320,302,285,269,254,240,226, 214,202,190,180,170,160,151,143,135,127,120,113 }, diff --git a/prowizard/include/vars.h b/prowizard/include/vars.h index f69dfc47..b8ac61a9 100644 --- a/prowizard/include/vars.h +++ b/prowizard/include/vars.h @@ -6,19 +6,19 @@ */ -FILE *PW_in,*PW_out; -long PW_Start_Address=0; -Ulong OutputSize=0; -long PW_in_size; -long Cpt_Filename=0l; -Ulong PW_i; -Ulong PW_j,PW_k,PW_l,PW_m,PW_n,PW_o; -Uchar *in_data; -/*Uchar OutName[5]={'.','-','-','-',0x00};*/ -char OutName_final[33]; -char Depacked_OutName[33]; -Uchar Save_Status = GOOD; -Ulong PW_WholeSampleSize=0; -char Extensions[_KNOWN_FORMATS+1][33]; -Uchar CONVERT = BAD; -Uchar Amiga_EXE_Header = GOOD; +FILE *PW_in,*PW_out; +int32_t PW_Start_Address=0; +uint32_t OutputSize=0; +int32_t PW_in_size; +int32_t Cpt_Filename=0l; +uint32_t PW_i; +uint32_t PW_j,PW_k,PW_l,PW_m,PW_n,PW_o; +uint8_t *in_data; +/*uint8_t OutName[5]={'.','-','-','-',0x00};*/ +char OutName_final[33]; +char Depacked_OutName[33]; +uint8_t Save_Status = GOOD; +uint32_t PW_WholeSampleSize=0; +char Extensions[_KNOWN_FORMATS+1][33]; +uint8_t CONVERT = BAD; +uint8_t Amiga_EXE_Header = GOOD; diff --git a/prowizard/misc/misc.c b/prowizard/misc/misc.c index 1ade02dd..114c3de1 100644 --- a/prowizard/misc/misc.c +++ b/prowizard/misc/misc.c @@ -5,10 +5,9 @@ * at now, when this fonction is called, no global var has been used ... * and can be here :). (save for the input file pointer ...) */ -#if 0 void Support_Types ( void ) { - long types_file_size, cpt; + int32_t types_file_size, cpt; char read_line[_TYPES_LINE_LENGHT]; FILE *types_file; @@ -37,7 +36,7 @@ void Support_Types ( void ) continue; if ( sizeof ( read_line ) < 2 ) { - printf ( "!!! Damaged \"%s\" file at non-commented line %ld\n" + printf ( "!!! Damaged \"%s\" file at non-commented line %u\n" , _TYPES_FILENAME , PW_i+1 ); PW_i = 99999l; break; @@ -56,7 +55,7 @@ void Support_Types ( void ) if ( PW_i != _KNOWN_FORMATS ) { - printf ( "!!! Damaged \"%s\" file. Missing up %ld extensions definitions\n" + printf ( "!!! Damaged \"%s\" file. Missing up %u extensions definitions\n" , _TYPES_FILENAME , _KNOWN_FORMATS-(PW_i+1)); Support_Types_FileDefault (); return; @@ -64,9 +63,8 @@ void Support_Types ( void ) fclose ( types_file ); } -#endif -/*Uchar *XighExtensions[_KNOWN_FORMATS+1];*/ +/*uint8_t *XighExtensions[_KNOWN_FORMATS+1];*/ /* * fill the global "Extension" with default extensions if a pb happened @@ -205,7 +203,7 @@ void Support_Types_FileDefault ( void ) strcpy ( Extensions[123], "SPv3" ); strcpy ( Extensions[124], "AtomikPackerData" ); strcpy ( Extensions[125], "AutomationPackerData" ); - // strcpy ( Extensions[125], "TreasurePattern" ); + /* strcpy ( Extensions[125], "TreasurePattern" );*/ strcpy ( Extensions[126], "SGTPacker" ); strcpy ( Extensions[127], "GNUPacker12" ); strcpy ( Extensions[128], "CrunchmaniaSimple" ); @@ -213,9 +211,42 @@ void Support_Types_FileDefault ( void ) strcpy ( Extensions[130], "TitanicsPlayer" ); strcpy ( Extensions[131], "NewtronOld" ); strcpy ( Extensions[132], "NovoTrade" ); - strcpy ( Extensions[133], "Skizzo" ); + strcpy ( Extensions[133], "GnoiPacker" ); strcpy ( Extensions[134], "StoneArtsPlayer" ); - strcpy ( Extensions[135], "---" ); + strcpy ( Extensions[135], "SLAM" ); + strcpy ( Extensions[136], "S3M" ); + strcpy ( Extensions[137], "MOSH" ); + strcpy ( Extensions[138], "BinaryPacker" ); + strcpy ( Extensions[139], "HCD" ); + strcpy ( Extensions[140], "Tetrapack101" ); + strcpy ( Extensions[141], "StruggleGame" ); + strcpy ( Extensions[142], "BKCloneFLT" ); + strcpy ( Extensions[143], "Oktalizer" ); + strcpy ( Extensions[144], "AHX" ); + strcpy ( Extensions[145], "Sidmon1" ); + strcpy ( Extensions[146], "Sidmon2" ); + strcpy ( Extensions[147], "PerfSong" ); + strcpy ( Extensions[148], "MASMDataCruncher" ); + strcpy ( Extensions[149], "ImpulseTracker" ); + strcpy ( Extensions[150], "HighPresCruncher" ); + strcpy ( Extensions[151], "SP20" ); + strcpy ( Extensions[152], "B9AB" ); + strcpy ( Extensions[153], "HVL" ); + strcpy ( Extensions[154], "BKClone5" ); + strcpy ( Extensions[155], "xVdg" ); + strcpy ( Extensions[156], "DAT" ); + strcpy ( Extensions[157], "LSDDataCruncher" ); + strcpy ( Extensions[158], "JamDataCruncher" ); + strcpy ( Extensions[159], "MI10" ); + strcpy ( Extensions[160], "BHC3CruncherData" ); + strcpy ( Extensions[161], "IFF" ); + strcpy ( Extensions[162], "SA" ); + strcpy ( Extensions[163], "DM1" ); + strcpy ( Extensions[164], "PMd3" ); + strcpy ( Extensions[165], "PMD3" ); + strcpy ( Extensions[166], "BHC2CruncherData" ); + strcpy ( Extensions[167], "Pac1" ); + strcpy ( Extensions[168], "---" ); } @@ -225,26 +256,27 @@ void Support_Types_FileDefault ( void ) * saving what's found. Mainly music file here. * PW_Start_Address & OutputSize are global .. not everybody likes * that :(. I just cant seem to manage it otherwise. + * + * 20070825 : catching NULL off PW__fopen() for WinUAE */ void Save_Rip ( char * format_to_save, int FMT_EXT ) { Save_Status = BAD; - pw_write_log ( "%s found at %ld !. its size is : %ld\n", format_to_save , PW_Start_Address , OutputSize ); - if ( (PW_Start_Address + (long)OutputSize) > PW_in_size ) + pw_write_log ( "%s found at %d !. its size is : %u\n", format_to_save , PW_Start_Address , OutputSize ); + if ( (PW_Start_Address + (int32_t)OutputSize) > PW_in_size ) { - pw_write_log ( "!!! Truncated, missing (%ld byte(s) !)\n" + pw_write_log ( "!!! Truncated, missing (%u byte(s) !)\n" , (PW_Start_Address+OutputSize)-PW_in_size ); PW_i += 2 ; return; } BZERO ( OutName_final, sizeof OutName_final); - sprintf ( OutName_final , "%ld.%s" , Cpt_Filename , Extensions[FMT_EXT] ); + sprintf ( OutName_final , "%d.%s" , Cpt_Filename , Extensions[FMT_EXT] ); pw_write_log ( " saving in file \"%s\" ... " , OutName_final ); Cpt_Filename += 1; - PW_out = moduleripper2_fopen ( OutName_final , "w+b", format_to_save, PW_Start_Address, OutputSize); - //PW_out = PW_fopen ( OutName_final , "w+b" ); - if (!PW_out) - return; + PW_out = moduleripper2_fopen ( OutName_final , "w+b", format_to_save, PW_Start_Address, OutputSize ); + if (PW_out == NULL) + return; fwrite ( &in_data[PW_Start_Address] , OutputSize , 1 , PW_out ); fclose ( PW_out ); pw_write_log ( "done\n" ); @@ -252,7 +284,6 @@ void Save_Rip ( char * format_to_save, int FMT_EXT ) { pw_write_log ( " converting to Protracker ... " ); } - //fflush ( stdout ); Save_Status = GOOD; } @@ -260,23 +291,24 @@ void Save_Rip ( char * format_to_save, int FMT_EXT ) * Special cases for files with header to rebuild ... * */ -void Save_Rip_Special ( char * format_to_save, int FMT_EXT, Uchar * Header_Block , Ulong Block_Size ) +void Save_Rip_Special ( char * format_to_save, int FMT_EXT, uint8_t * Header_Block , uint32_t Block_Size ) { Save_Status = BAD; - pw_write_log ( "%s found at %ld !. its size is : %ld\n", format_to_save , PW_Start_Address , OutputSize ); - if ( (PW_Start_Address + (long)OutputSize) > PW_in_size ) + pw_write_log ( "%s found at %d !. its size is : %u\n", format_to_save , PW_Start_Address , OutputSize ); + if ( (PW_Start_Address + (int32_t)OutputSize) > PW_in_size ) { - pw_write_log ( "!!! Truncated, missing (%ld byte(s) !)\n" + pw_write_log ( "!!! Truncated, missing (%u byte(s) !)\n" , (PW_Start_Address+OutputSize)-PW_in_size ); PW_i += 2 ; return; } BZERO (OutName_final, sizeof OutName_final); - sprintf ( OutName_final , "%ld.%s" , Cpt_Filename , Extensions[FMT_EXT] ); + sprintf ( OutName_final , "%d.%s" , Cpt_Filename , Extensions[FMT_EXT] ); pw_write_log ( " saving in file \"%s\" ... " , OutName_final ); Cpt_Filename += 1; -// PW_out = PW_fopen ( OutName_final , "w+b" ); PW_out = moduleripper2_fopen ( OutName_final , "w+b", format_to_save, PW_Start_Address, OutputSize ); + if (PW_out == NULL) + return; fwrite ( Header_Block , Block_Size , 1 , PW_out ); fwrite ( &in_data[PW_Start_Address] , OutputSize , 1 , PW_out ); fclose ( PW_out ); @@ -287,8 +319,7 @@ void Save_Rip_Special ( char * format_to_save, int FMT_EXT, Uchar * Header_Block } pw_write_log ( " Header of this file was missing and has been rebuilt !\n" ); if ( FMT_EXT == DragPack252) - pw_write_log ( " WARNING !: it's a fake header since in this case !!\n" ); - //fflush ( stdout ); + pw_write_log ( " WARNING !: it's a fake header in this case !!\n" ); Amiga_EXE_Header = GOOD; Save_Status = GOOD; } @@ -296,7 +327,7 @@ void Save_Rip_Special ( char * format_to_save, int FMT_EXT, Uchar * Header_Block /* writing craps in converted MODs */ -void Crap ( char *Format , Uchar Delta , Uchar Pack , FILE *out ) +void Crap ( char *Format , uint8_t Delta , uint8_t Pack , FILE *out ) { fseek ( out , 560 , SEEK_SET ); fprintf ( out , "[ Converted with ]" ); @@ -323,7 +354,7 @@ void Crap ( char *Format , Uchar Delta , Uchar Pack , FILE *out ) } /* writing craps in converted MODs */ -void Crap15 ( char *Format , Uchar Delta , Uchar Pack , FILE *out ) +void Crap15 ( char *Format , uint8_t Delta , uint8_t Pack , FILE *out ) { fseek ( out , 260 , SEEK_SET ); fprintf ( out , "[ Converted with ]" ); @@ -342,13 +373,13 @@ void Crap15 ( char *Format , Uchar Delta , Uchar Pack , FILE *out ) * Special version of Test() for cruncher data (Ice! etc...) * only one file and not hundreds ... */ -short testSpecialCruncherData ( long Pack_addy , long Unpack_addy ) +int16_t testSpecialCruncherData ( int32_t Pack_addy , int32_t Unpack_addy ) { PW_Start_Address = PW_i; /* a small test preventing hangover :) ... */ /* e.g. addressing of unassigned data */ - if ( ( (long)PW_i + Pack_addy ) > PW_in_size ) + if ( ( (int32_t)PW_i + Pack_addy ) > PW_in_size ) { /*printf ( "#0\n" );*/ return BAD; @@ -408,6 +439,7 @@ void Rip_SpecialCruncherData ( char *Packer_Name , int Header_Size , int Packer_ PW_l *= 4; PW_l += 10; OutputSize = PW_l; + Header_Size = 6; break; default: OutputSize = PW_l + Header_Size; @@ -422,7 +454,7 @@ void Rip_SpecialCruncherData ( char *Packer_Name , int Header_Size , int Packer_ Save_Rip ( Packer_Name, Packer_Extension_Define ); if ( Save_Status == GOOD ) -// PW_i += (OutputSize - 2); /* 0 should do but call it "just to be sure" :) */ +/* PW_i += (OutputSize - 2); */ /* 0 should do but call it "just to be sure" :) */ PW_i += (Header_Size + 1); /* test to overcome fake datas */ PW_WholeSampleSize = 0; @@ -430,40 +462,40 @@ void Rip_SpecialCruncherData ( char *Packer_Name , int Header_Size , int Packer_ /* yet again on Xigh's suggestion. How to handle 'correctly' a file size */ -long PWGetFileSize (char * infile) +int32_t PWGetFileSize (char * infile) { - long i; - struct stat *Stat; - Stat = (struct stat *) malloc ( sizeof (struct stat)); - stat ( infile, Stat ); - i = (long)Stat->st_size; - free ( Stat ); - return i; + struct stat sb; + + if (stat ( infile, &sb ) < 0) { + /* xigh: TODO: Error */ + return -1; + } + return (int32_t) sb.st_size; } -#if 0 /* Same as fopen() but saves a lot of tests, done only here. */ /* Done to check if the output file could be created */ -FILE * PW_fopen (char *filename, char fopenargs[3] ) +FILE * PW_fopen (char *filename, char *fopenargs ) { - FILE *local_out; - local_out = fopen (filename, fopenargs); - if (local_out == NULL) - { - printf ("!!couldn't create the file \"%s\"!\nexiting...",filename); - exit (-1); - } - return local_out; + return moduleripper_fopen (filename, fopenargs); } -#endif -FILE * PW_fopen (char *filename, char *fopenargs) + +/* replacement for printf() for WinUAE */ +/* written by Toni Wilen ... thx :) */ +/*void write_log (const char *format, ...) { - return moduleripper_fopen (filename, fopenargs); -} +char buffer[WRITE_LOG_BUF_SIZE]; +va_list parms; +va_start (parms, format); + +count = _vsnprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms); +printf(buffer); +va_end (parms); +}*/ /* fills a var with all the pitch for PTK */ /* doing a function instead of a lot of includes ...*/ -void fillPTKtable (Uchar poss[37][2]) +void fillPTKtable (uint8_t poss[37][2]) { poss[0][0]=0x00, poss[0][1]=0x00; @@ -511,6 +543,51 @@ void fillPTKtable (Uchar poss[37][2]) #ifndef htonl unsigned int htonl(unsigned int v) { - return ((v >> 24) & 0x000000ff) | ((v >> 8) & 0x0000ff00) | ((v << 8) & 0x00ff0000) | ((v << 24) & 0xff000000); + return ((v >> 24) & 0x000000ff) | ((v >> 8) & 0x0000ff00) | ((v << 8) & 0x00ff0000) | ((v << 24) & 0xff000000); } #endif + + + +int16_t testDietDataPacker ( void ) +{ + PW_Start_Address = PW_i; + + PW_l = (in_data[PW_Start_Address+9]*256*256) + + (in_data[PW_Start_Address+11]*256) + + in_data[PW_Start_Address+10] + 5 + 12; + + if ( PW_l > PW_in_size ) + { + /* should be enough :))) */ + /*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + + return GOOD; + /* PW_l is the size of the pack */ +} + + +void Rip_DietDataPacker ( void ) +{ + /* PW_l is still the whole size */ + + OutputSize = PW_l; + + CONVERT = BAD; + + if ((in_data[PW_Start_Address+6] == 0x45) && + (in_data[PW_Start_Address+7] == 0x4F) && + (in_data[PW_Start_Address+8] == 0x53)) + { + in_data[PW_Start_Address+6] = 0x64; + in_data[PW_Start_Address+7] = 0x6C; + in_data[PW_Start_Address+8] = 0x7A; + } + + Save_Rip ( "Diet Packer Data-file", Diet ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} diff --git a/prowizard/misc/testbag.c b/prowizard/misc/testbag.c index 10149bb4..3b2a987d 100644 --- a/prowizard/misc/testbag.c +++ b/prowizard/misc/testbag.c @@ -8,12 +8,12 @@ /* start : if mod can possibly fit from the beginning of the file */ /* e.g. M.K. before 1080th byte */ -short test_1_start ( Ulong LIMIT ) +int16_t test_1_start ( uint32_t LIMIT ) { return ( PW_i < LIMIT) ? BAD : GOOD; } -short test_smps ( long smpsiz, long lstart, long lsiz, Uchar vol, Uchar fine ) +int16_t test_smps ( int32_t smpsiz, int32_t lstart, int32_t lsiz, uint8_t vol, uint8_t fine ) { if ( lstart > smpsiz ) return BAD; @@ -21,7 +21,7 @@ short test_smps ( long smpsiz, long lstart, long lsiz, Uchar vol, Uchar fine ) return BAD; if ( (lstart + lsiz) > smpsiz+2 ) return BAD; - if ( (lstart != 0) && ( lsiz <= 2 ) ) + if ( (lstart != 0) && ( lsiz < 2 ) ) return BAD; if ( ((lstart != 0) || (lsiz > 2)) && (smpsiz = 0) ) return BAD; diff --git a/prowizard/prowiz.c b/prowizard/prowiz.c index e889b7c5..b97774b9 100644 --- a/prowizard/prowiz.c +++ b/prowizard/prowiz.c @@ -1,26 +1,24 @@ /* * Pro-Wizard_1.c * - * 1997-2007 (c) Sylvain "Asle" Chipaux + * 1997-2016 (c) Sylvain "Asle" Chipaux * */ -#include "include/globals.h" -#include "include/extern.h" -#include "include/vars.h" +#include "globals.h" +#include "extern.h" +#include "vars.h" #if 0 int main ( int ac , char **av ) #else -int prowizard_search (Uchar *in_data_p, int PW_in_size_p) +int prowizard_search (uint8_t *in_data_p, int PW_in_size_p) #endif { - Support_Types_FileDefault (); - in_data = in_data_p; - PW_in_size = PW_in_size_p; + #if 0 - printf ( "\n\n-<([ Pro-Wizard v1.62 ])>-\n\n" ); + printf ( "\n\n-<([ Pro-Wizard v1.70a ])>-\n\n" ); if ( ac != 2 ) { @@ -43,7 +41,7 @@ int prowizard_search (Uchar *in_data_p, int PW_in_size_p) /* get input file size */ PW_in_size = PWGetFileSize (av[1]); fseek ( PW_in , 0 , 0 ); /* probably useless */ - printf ( "input file size : %ld\n" , PW_in_size ); + printf ( "input file size : %d\n" , PW_in_size ); if ( PW_in_size < MINIMAL_FILE_LENGHT ) { printf ( "! input file size is too small ...\n" ); @@ -52,7 +50,7 @@ int prowizard_search (Uchar *in_data_p, int PW_in_size_p) } /* alloc mem */ - in_data = (Uchar *) malloc ( PW_in_size ); + in_data = (uint8_t *) malloc ( PW_in_size ); if ( in_data == NULL ) { perror ( "Couldn't allocate memory" ); @@ -60,8 +58,13 @@ int prowizard_search (Uchar *in_data_p, int PW_in_size_p) } fread ( in_data , PW_in_size , 1 , PW_in ); fclose ( PW_in ); +#else + Support_Types_FileDefault (); + in_data = in_data_p; + PW_in_size = PW_in_size_p; #endif + /********************************************************************/ /************************** SEARCH ******************************/ /********************************************************************/ @@ -83,24 +86,26 @@ int prowizard_search (Uchar *in_data_p, int PW_in_size_p) /* do ..). */ /*******************************************************************/ + if ( in_data[PW_i] <= 0x40 ) { /* try to get rid of those 00 hanging all the time everywhere :( */ if ( in_data[PW_i] == 0x00 ) { - for ( PW_j = 0 ; PW_j= 1) && (in_data[PW_i-1] == 0x03) ) @@ -2461,7 +2866,6 @@ int prowizard_search (Uchar *in_data_p, int PW_in_size_p) { Rip_PHA (); Depack_PHA (); - break; } } break; @@ -2490,10 +2894,11 @@ int prowizard_search (Uchar *in_data_p, int PW_in_size_p) } /* end of switch */ } + #if 0 free ( in_data ); printf ( "\n" ); - printf ( " 1997-2007 (c) Sylvain \"Asle\" Chipaux (asle@free.fr)\n\n"); + printf ( " 1997-2016 (c) Sylvain \"Asle\" Chipaux (asle@free.fr)\n\n"); /* getchar();*/ exit ( 0 ); #endif diff --git a/prowizard/rippers/AC1D_packer.c b/prowizard/rippers/AC1D_packer.c index b582f851..32d037bf 100644 --- a/prowizard/rippers/AC1D_packer.c +++ b/prowizard/rippers/AC1D_packer.c @@ -1,15 +1,15 @@ -/* testAC1D() */ -/* Rip_AC1D() */ +/* testAC1D() */ +/* Rip_AC1D() */ /* Depack_AC1D() */ #include "globals.h" #include "extern.h" -short testAC1D ( void ) +int16_t testAC1D ( void ) { /* test #1 */ - /* if ( PW_i<2 )*/ + /* if ( PW_i<2 )*/ if ( test_1_start(2) == BAD ) return BAD; @@ -24,6 +24,7 @@ short testAC1D ( void ) return BAD; } + /* test #4 */ for ( PW_k = 0 ; PW_k < 31 ; PW_k ++ ) { @@ -62,44 +63,44 @@ void Rip_AC1D ( void ) Save_Rip ( "AC1D Packed module", AC1D_packer ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ + PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ } /* -* ac1d.c 1996-1997 (c) Asle / ReDoX -* -* Converts AC1D packed MODs back to PTK MODs -* thanks to Gryzor and his ProWizard tool ! ... without it, this prog -* would not exist !!! -* -* Last update: 30/11/99 -* - removed open() (and other fread()s and the like) -* - general Speed & Size Optmizings -* 20051002 : testing fopen() ... + * ac1d.c 1996-1997 (c) Asle / ReDoX + * + * Converts AC1D packed MODs back to PTK MODs + * thanks to Gryzor and his ProWizard tool ! ... without it, this prog + * would not exist !!! + * + * Last update: 30/11/99 + * - removed open() (and other fread()s and the like) + * - general Speed & Size Optmizings + * 20051002 : testing fopen() ... */ void Depack_AC1D ( void ) { - Uchar NO_NOTE=0xff; - Uchar c1,c2,c3,c4; - Uchar *Whatever; - Uchar Nbr_Pat; - Uchar poss[37][2]; - Uchar Note,Smp,Fx,FxVal; - long Sample_Data_Address; - long WholeSampleSize=0; - long Pattern_Addresses[128]; - long Pattern_Sizes[128]; - long siztrack1,siztrack2,siztrack3; - long i,j,k; - long Where = PW_Start_Address; + uint8_t NO_NOTE=0xff; + uint8_t c1,c2,c3,c4; + uint8_t *Whatever; + uint8_t Nbr_Pat; + uint8_t poss[37][2]; + uint8_t Note,Smp,Fx,FxVal; + int32_t Sample_Data_Address; + int32_t WholeSampleSize=0; + int32_t Pattern_Addresses[128]; + int32_t Pattern_Sizes[128]; + int32_t siztrack1,siztrack2,siztrack3; + int32_t i,j,k; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); memset (Pattern_Addresses , 0 , 128*4); @@ -118,7 +119,7 @@ void Depack_AC1D ( void ) /*printf ( "adress of sample datas : %ld\n" , Sample_Data_Address );*/ /* write title */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -244,11 +245,11 @@ void Depack_AC1D ( void ) fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); /* crap ... */ - Crap ( " AC1D Packer " , BAD , BAD , out ); + Crap ( " AC1D Packer " , BAD , BAD , out ); fflush ( out ); fclose ( out ); printf ( "done\n" ); return; /* useless ... but */ -} \ No newline at end of file +} diff --git a/prowizard/rippers/AMF.c b/prowizard/rippers/AMF.c new file mode 100644 index 00000000..21792417 --- /dev/null +++ b/prowizard/rippers/AMF.c @@ -0,0 +1,192 @@ +/* (06 dec 2008) + AMF "advanced module format" (Dual Module Player internal format) + dirty AMF->MOD depack, when possible. + (c) Sylvain "Asle" Chipaux +*/ +/* testAMF() */ +/* Rip_AMF() */ +/* Depack_AMF() */ + + +#include "globals.h" +#include "extern.h" + + +int16_t testAMF ( void ) +{ + PW_Start_Address = PW_i; + /* test 1 */ + if ( (PW_Start_Address+75)>=PW_in_size ) + { +/*printf ( "#1 (PW_i:%ld)\n" , PW_i );*/ + return BAD; + } + + /* test 2 */ + PW_j = in_data[PW_Start_Address+36]; /* nbr of samples */ + PW_k = in_data[PW_Start_Address+40]; /* nbr of voices */ + if ( (PW_j>0x1F) || (PW_k>0x04) ) /* yes, 4 voices only .. I _want_ PTK ..*/ + { +/*printf ( "#2 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + + return GOOD; +} + + +void Rip_AMF ( void ) +{ + /* PW_j is still the number of samples */ + /* PW_k is still the number of voices */ + +/* TODO */ + + /*PW_WholeSampleSize is already the whole sample size */ + /*for ( PW_j=0 ; PW_j<31 ; PW_j++ ) + PW_WholeSampleSize += (((in_data[PW_Start_Address+42+PW_j*30]*256)+in_data[PW_Start_Address+43+PW_j*30])*2);*/ + + OutputSize = PW_WholeSampleSize + PW_l; + + CONVERT = GOOD; + Save_Rip ( "Eureka Packed module", Eureka_packer ); + + if ( Save_Status == GOOD ) + PW_i += (OutputSize - 46); /* 45 should do but call it "just to be sure" :) */ +} + + +/* + * AMF.c 2008 (c) Sylvain "Asle" Chipaux + * + * Converts MODs packed DMP replayer +*/ + +void Depack_AMF ( void ) +{ + uint8_t *Whatever; + uint8_t c1=0x00; + uint8_t Pat_Max=0x00; + int32_t Sample_Start_Address=0; + int32_t WholeSampleSize=0; + int32_t Track_Address[128][4]; + int32_t i=0,j=0,k; + int32_t Where = PW_Start_Address; + FILE *out; + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + /* read header ... same as ptk */ + fwrite ( &in_data[Where] , 1080 , 1 , out ); + + /* now, let's sort out that a bit :) */ + /* first, the whole sample size */ + for ( i=0 ; i<31 ; i++ ) + WholeSampleSize += (((in_data[Where+i*30+42]*256)+in_data[Where+i*30+43])*2); + /*printf ( "Whole sample size : %ld\n" , WholeSampleSize );*/ + + /* next, the size of the pattern list */ + /*printf ( "Size of pattern list : %d\n" , in_data[Where+950] );*/ + + /* now, the pattern list .. and the max */ + Pat_Max = 0x00; + for ( i=0 ; i<128 ; i++ ) + { + if ( in_data[Where+952+i] > Pat_Max ) + Pat_Max = in_data[Where+952+i]; + } + Pat_Max += 1; + /*printf ( "Number of patterns : %d\n" , Pat_Max );*/ + + /* write ptk's ID */ + Whatever = (uint8_t *) malloc (1024); + BZERO ( Whatever , 1024 ); + Whatever[0] = 'M'; + Whatever[1] = '.'; + Whatever[2] = 'K'; + Whatever[3] = '.'; + fwrite ( Whatever , 4 , 1 , out ); + + + /* read sample data address */ + Where = PW_Start_Address+1080; + Sample_Start_Address = (in_data[Where]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]; + Where += 4; + /*printf ( "Address of sample data : %ld\n" , Sample_Start_Address );*/ + + /* read tracks addresses */ + for ( i=0 ; i PW_in_size) { @@ -68,27 +68,29 @@ void Rip_AmBk ( void ) */ void Depack_AmBk ( void ) { - /*Uchar c1,c2,c3,c4;*/ - Uchar *Whatever,*address; - Uchar poss[37][2]; - /*Uchar Note,Smp,Fx,FxVal;*/ - long i,j,k; - long Where = PW_Start_Address; - long INST_HDATA_ADDY,SONGS_DATA_ADDY,PAT_DATA_ADDY;/*,INST_DATA_ADDY;*/ - long BANK_LEN; - long smps_addys[31],smp_sizes[31]; + /*uint8_t c1,c2,c3,c4;*/ + uint8_t *Whatever,*address, *Header; + uint8_t poss[37][2]; + /*uint8_t Note,Smp,Fx,FxVal;*/ + int32_t i,j,k; + int32_t Where = PW_Start_Address; + int32_t INST_HDATA_ADDY,SONGS_DATA_ADDY,PAT_DATA_ADDY;/*,INST_DATA_ADDY;*/ + int32_t BANK_LEN; + int32_t smps_addys[31],smp_sizes[31]; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); fillPTKtable(poss); - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO (Whatever,1024); + Header = (uint8_t *) malloc (1084); + BZERO (Header,1084); BANK_LEN = ((in_data[Where + 0x09]*256*256)+ (in_data[Where + 0x0a]*256)+ @@ -113,12 +115,13 @@ void Depack_AmBk ( void ) if ( j > 1 ) { printf ( "\n!!! unsupported feature in depack_AmBk() - send this file to asle@free.fr !\n" ); - free(Whatever); return; } j = ((in_data[Where+2]*256*256*256)+(in_data[Where+3]*256*256)+(in_data[Where+4]*256)+in_data[Where+5]); - fwrite ( &in_data[Where + j + 0x0c], 16, 1, out ); - fwrite ( Whatever, 4, 1, out ); + for (i=0; i<16; i++) + Header[i] = in_data[Where + j + 0x0c + i]; + /*fwrite ( &in_data[Where + j + 0x0c], 16, 1, out );*/ + /*fwrite ( Whatever, 4, 1, out );*/ Where = PW_Start_Address + INST_HDATA_ADDY; /*printf ( "\naddy of instrument headers : %ld\n", Where );*/ @@ -129,58 +132,63 @@ void Depack_AmBk ( void ) Where += 2; for ( i=0 ; i=smps_addys[i]) { k -= smps_addys[i]; k/=2; - /* PC only code !!! */ - address = (Uchar *) &k; - Whatever[32] = *(address+1); - Whatever[33] = *address; - fwrite ( &Whatever[32], 2, 1, out ); + /* PC only code !!! */ + address = (uint8_t *) &k; + Header[46+(i*30)] = *(address+1); + Header[47+(i*30)] = *address; } /* loop size */ if ( (in_data[Where + 0x0a] == 0x00) && (in_data[Where + 0x0b] <= 0x02) ) { - Whatever[29] = 0x01; - fwrite ( &Whatever[28], 2, 1, out ); + Header[49+(i*30)] = 0x01; } else - fwrite ( &in_data[Where + 0x0a], 2, 1, out ); + { + Header[48+(i*30)] = in_data[Where + 0x0a]; + Header[49+(i*30)] = in_data[Where + 0x0b]; + } Where += 32; /*printf ( "where out : %x\n", ftell (out ));*/ } - /* padding to 31 samples */ - while (i++ < 31) - fwrite ( Whatever, 30, 1, out ); /* end of sample header */ + fwrite (Header, 1084, 1, out); + + + + + free(Header); + free(Whatever); + /* crap ... */ /* Crap ( " AmBk " , BAD , BAD , out );*/ diff --git a/prowizard/rippers/AMOS-PowerPackerBank.c b/prowizard/rippers/AMOS-PowerPackerBank.c index b9899a41..d020d159 100644 --- a/prowizard/rippers/AMOS-PowerPackerBank.c +++ b/prowizard/rippers/AMOS-PowerPackerBank.c @@ -5,7 +5,7 @@ #include "globals.h" #include "extern.h" -short testPPbk ( void ) +int16_t testPPbk ( void ) { PW_Start_Address = PW_i; diff --git a/prowizard/rippers/BP-Soundmonitor.c b/prowizard/rippers/BP-Soundmonitor.c index 676fe2b3..d0d8eda4 100644 --- a/prowizard/rippers/BP-Soundmonitor.c +++ b/prowizard/rippers/BP-Soundmonitor.c @@ -5,7 +5,7 @@ #include "extern.h" -short testBP ( void ) +int16_t testBP ( void ) { /* test 1 */ if ( (PW_i < 26) || ((PW_Start_Address+512)>PW_in_size) ) @@ -39,18 +39,22 @@ short testBP ( void ) for ( PW_k=0 ; PW_k PW_j ) + if ( (in_data[PW_Start_Address+512+PW_k*16]*256 + in_data[PW_Start_Address+513+PW_k*16]) > PW_j ) + { PW_j = (in_data[PW_Start_Address+512+PW_k*16]*256 + in_data[PW_Start_Address+513+PW_k*16]); - if ( (in_data[PW_Start_Address+516+PW_k*16]*256 + - in_data[PW_Start_Address+517+PW_k*16]) > PW_j ) + } + if ( (in_data[PW_Start_Address+516+PW_k*16]*256 + in_data[PW_Start_Address+517+PW_k*16]) > PW_j ) + { PW_j = (in_data[PW_Start_Address+516+PW_k*16]*256 + in_data[PW_Start_Address+517+PW_k*16]); - if ( (in_data[PW_Start_Address+520+PW_k*16]*256 + - in_data[PW_Start_Address+521+PW_k*16]) > PW_j ) + } + if ( (in_data[PW_Start_Address+520+PW_k*16]*256 + in_data[PW_Start_Address+521+PW_k*16]) > PW_j ) + { PW_j = (in_data[PW_Start_Address+520+PW_k*16]*256 + in_data[PW_Start_Address+521+PW_k*16]); - if ( (in_data[PW_Start_Address+524+PW_k*16]*256 + - in_data[PW_Start_Address+525+PW_k*16]) > PW_j ) + } + if ( (in_data[PW_Start_Address+524+PW_k*16]*256 + in_data[PW_Start_Address+525+PW_k*16]) > PW_j ) + { PW_j = (in_data[PW_Start_Address+524+PW_k*16]*256 + in_data[PW_Start_Address+525+PW_k*16]); + } } return GOOD; diff --git a/prowizard/rippers/BSI-FutureComposer.c b/prowizard/rippers/BSI-FutureComposer.c index 34127e27..0edf2c37 100644 --- a/prowizard/rippers/BSI-FutureComposer.c +++ b/prowizard/rippers/BSI-FutureComposer.c @@ -4,7 +4,7 @@ #include "globals.h" #include "extern.h" -short testBSIFutureComposer ( void ) +int16_t testBSIFutureComposer ( void ) { PW_Start_Address = PW_i; diff --git a/prowizard/rippers/Bytekiller.c b/prowizard/rippers/Bytekiller.c index d096c904..4d5d8594 100644 --- a/prowizard/rippers/Bytekiller.c +++ b/prowizard/rippers/Bytekiller.c @@ -2,14 +2,18 @@ /* testByteKiller_20() */ /* testByteKiller30() */ /* testbytekillerpro10() */ +/* testBKCloneFLT */ +/* testBKClone5 20130416*/ /* Rip_ByteKiller() */ /* Rip_ByteKiller30() */ /* Rip_bytekillerpro10 */ +/* Rip_BKCloneFLT */ +/* Rip_BKClone5 20130416*/ #include "globals.h" #include "extern.h" -short testByteKiller_13 ( void ) +int16_t testByteKiller_13 ( void ) { /* if ( PW_i < 135 )*/ if ( test_1_start (135) == BAD ) @@ -91,7 +95,7 @@ short testByteKiller_13 ( void ) -short testByteKiller_20 ( void ) +int16_t testByteKiller_20 ( void ) { if ( test_1_start(127) == BAD ) { @@ -107,8 +111,6 @@ short testByteKiller_20 ( void ) (in_data[PW_Start_Address+4] != 0x4D ) || (in_data[PW_Start_Address+5] != 0xF9 ) || (in_data[PW_Start_Address+6] != 0x00 ) || - (in_data[PW_Start_Address+7] != 0xDF ) || - (in_data[PW_Start_Address+8] != 0xF1 ) || (in_data[PW_Start_Address+10] != 0x41 ) || (in_data[PW_Start_Address+11] != 0xFA ) || (in_data[PW_Start_Address+12] != 0x00 ) || @@ -168,7 +170,7 @@ short testByteKiller_20 ( void ) } -short testByteKiller30 ( void ) +int16_t testByteKiller30 ( void ) { PW_Start_Address = PW_i; @@ -238,7 +240,7 @@ short testByteKiller30 ( void ) /* PW_l is the size of the pack */ } -short testbytekillerpro10 ( void ) +int16_t testbytekillerpro10 ( void ) { PW_Start_Address = PW_i; @@ -307,12 +309,152 @@ short testbytekillerpro10 ( void ) } +int16_t testBKCloneFLT ( void ) +{ + PW_Start_Address = PW_i; + + if ((PW_i + 308) > PW_in_size) + return BAD; + + if ( (in_data[PW_Start_Address+14] != 0x24 ) || + (in_data[PW_Start_Address+15] != 0x60 ) || + (in_data[PW_Start_Address+16] != 0xd5 ) || + (in_data[PW_Start_Address+17] != 0xc9 ) || + (in_data[PW_Start_Address+18] != 0x4a ) || + (in_data[PW_Start_Address+19] != 0xa0 ) || + (in_data[PW_Start_Address+20] != 0x20 ) || + (in_data[PW_Start_Address+21] != 0x20 ) || + (in_data[PW_Start_Address+22] != 0x13 ) || + (in_data[PW_Start_Address+23] != 0xf9 ) || + (in_data[PW_Start_Address+24] != 0x00 ) || + (in_data[PW_Start_Address+25] != 0xdf ) || + (in_data[PW_Start_Address+26] != 0xf0 ) || + (in_data[PW_Start_Address+27] != 0x06 ) || + (in_data[PW_Start_Address+28] != 0x00 ) || + (in_data[PW_Start_Address+29] != 0xdf ) ) + { + /* should be enough :))) */ +/*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + + } + + + /* packed size */ + PW_l = ( (in_data[PW_Start_Address+304]*256*256*256) + + (in_data[PW_Start_Address+305]*256*256) + + (in_data[PW_Start_Address+306]*256) + + in_data[PW_Start_Address+307] ); + + PW_l += 348; + + + if ( PW_i >= 36 ) + { + if ( (in_data[PW_Start_Address-36] != 0x00 ) || + (in_data[PW_Start_Address-35] != 0x00 ) || + (in_data[PW_Start_Address-34] != 0x03 ) || + (in_data[PW_Start_Address-33] != 0xF3 ) || + (in_data[PW_Start_Address-32] != 0x00 ) || + (in_data[PW_Start_Address-31] != 0x00 ) || + (in_data[PW_Start_Address-30] != 0x00 ) || + (in_data[PW_Start_Address-29] != 0x00 ) || + (in_data[PW_Start_Address-28] != 0x00 ) || + (in_data[PW_Start_Address-27] != 0x00 ) || + (in_data[PW_Start_Address-26] != 0x00 ) || + (in_data[PW_Start_Address-25] != 0x02 ) || + (in_data[PW_Start_Address-24] != 0x00 ) || + (in_data[PW_Start_Address-23] != 0x00 ) || + (in_data[PW_Start_Address-22] != 0x00 ) || + (in_data[PW_Start_Address-21] != 0x00 ) ) + { + Amiga_EXE_Header = BAD; + } + else + Amiga_EXE_Header = GOOD; + } + else + Amiga_EXE_Header = BAD; + + return GOOD; + /* PW_l is the size of the pack */ +} + +/* exe found in Anarchy demo Seeing Is Believing */ +/* added 20130415 */ +int16_t testBKClone5 ( void ) +{ + PW_Start_Address = PW_i; + + if ((PW_i + 284) > PW_in_size) + return BAD; + + if ( (in_data[PW_Start_Address+18] != 0xD5 ) || + (in_data[PW_Start_Address+19] != 0xC9 ) || + (in_data[PW_Start_Address+20] != 0x20 ) || + (in_data[PW_Start_Address+21] != 0x20 ) || + (in_data[PW_Start_Address+22] != 0x47 ) || + (in_data[PW_Start_Address+23] != 0xFA ) || + (in_data[PW_Start_Address+24] != 0x00 ) || + (in_data[PW_Start_Address+25] != 0xE0 ) || + (in_data[PW_Start_Address+26] != 0x72 ) || + (in_data[PW_Start_Address+27] != 0x03 ) || + (in_data[PW_Start_Address+28] != 0x4E ) || + (in_data[PW_Start_Address+29] != 0x93 ) ) + { + /* should be enough :))) */ +/*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + + } + + + /* packed size */ + PW_l = ( (in_data[PW_Start_Address+6]*256*256*256) + + (in_data[PW_Start_Address+7]*256*256) + + (in_data[PW_Start_Address+8]*256) + + in_data[PW_Start_Address+9] ); + + PW_l += 284; + + + if ( PW_i >= 32 ) + { + if ( (in_data[PW_Start_Address-32] != 0x00 ) || + (in_data[PW_Start_Address-31] != 0x00 ) || + (in_data[PW_Start_Address-30] != 0x03 ) || + (in_data[PW_Start_Address-29] != 0xF3 ) || + (in_data[PW_Start_Address-28] != 0x00 ) || + (in_data[PW_Start_Address-27] != 0x00 ) || + (in_data[PW_Start_Address-26] != 0x00 ) || + (in_data[PW_Start_Address-25] != 0x00 ) || + (in_data[PW_Start_Address-24] != 0x00 ) || + (in_data[PW_Start_Address-23] != 0x00 ) || + (in_data[PW_Start_Address-22] != 0x00 ) || + (in_data[PW_Start_Address-21] != 0x01 ) || + (in_data[PW_Start_Address-20] != 0x00 ) || + (in_data[PW_Start_Address-19] != 0x00 ) || + (in_data[PW_Start_Address-18] != 0x00 ) || + (in_data[PW_Start_Address-17] != 0x00 ) ) + { + Amiga_EXE_Header = BAD; + } + else + Amiga_EXE_Header = GOOD; + } + else + Amiga_EXE_Header = BAD; + + return GOOD; + /* PW_l is the size of the pack */ +} + void Rip_ByteKiller ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -321,7 +463,7 @@ void Rip_ByteKiller ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -335,7 +477,7 @@ void Rip_ByteKiller ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 60; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); @@ -389,8 +531,8 @@ void Rip_ByteKiller30 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -399,7 +541,7 @@ void Rip_ByteKiller30 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -411,7 +553,7 @@ void Rip_ByteKiller30 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); @@ -434,8 +576,8 @@ void Rip_bytekillerpro10 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -444,7 +586,7 @@ void Rip_bytekillerpro10 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 50; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -458,7 +600,7 @@ void Rip_bytekillerpro10 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 60; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); @@ -508,3 +650,101 @@ void Rip_bytekillerpro10 ( void ) PW_i += 54; /* 51 should do but call it "just to be sure" :) */ } + +void Rip_BKCloneFLT ( void ) +{ + /* PW_l is still the whole size */ + + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; + + OutputSize = PW_l; + + CONVERT = BAD; + + if ( Amiga_EXE_Header == BAD ) + { + OutputSize -= 40; + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); + BZERO ( Amiga_EXE_Header_Block , 36 ); + Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; + Amiga_EXE_Header_Block[3] = 0xF3; + Amiga_EXE_Header_Block[11] = 0x02; + Amiga_EXE_Header_Block[19] = 0x01; + Amiga_EXE_Header_Block[27] = 0x01; + Amiga_EXE_Header_Block[31] = 0xE9; + + /* WARNING !!! WORKS ONLY ON PC !!! */ + /* 68k machines code : c1 = *(Whatever+2); */ + /* 68k machines code : c2 = *(Whatever+3); */ + PW_j = PW_l - 40; + PW_j /= 4; + Whatever = (uint8_t *) &PW_j; + Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); + Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); + Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); + Amiga_EXE_Header_Block[23] = Amiga_EXE_Header_Block[35] = *Whatever; + + /* also the last 4 bytes could have been 'removed' ... Here they are */ + /* I know, now, it's not safe method ... */ + in_data[PW_Start_Address+OutputSize-4] = 0x00; + in_data[PW_Start_Address+OutputSize-3] = 0x00; + in_data[PW_Start_Address+OutputSize-2] = 0x03; + in_data[PW_Start_Address+OutputSize-1] = 0xF2; + + Save_Rip_Special ( "ByteKiller Clone FLT Exe-file", BKCloneFLT, Amiga_EXE_Header_Block , 36 ); + free ( Amiga_EXE_Header_Block ); + } + else + { + PW_Start_Address -= 36; + Save_Rip ( "ByteKiller Clone FLT Exe-file", BKCloneFLT ); + } + + if ( Save_Status == GOOD ) + PW_i += 37; +} + +void Rip_BKClone5 ( void ) +{ + /* PW_l is still the whole size */ + + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; + + OutputSize = PW_l + 36; /* + 36 for header/footer sizes */ + + CONVERT = BAD; + + if ( Amiga_EXE_Header == BAD ) + { + OutputSize -= 32; + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); + BZERO ( Amiga_EXE_Header_Block , 32 ); + Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; + Amiga_EXE_Header_Block[3] = 0xF3; + Amiga_EXE_Header_Block[11] = 0x01; + Amiga_EXE_Header_Block[27] = 0xE9; + + /* WARNING !!! WORKS ONLY ON PC !!! */ + /* 68k machines code : c1 = *(Whatever+2); */ + /* 68k machines code : c2 = *(Whatever+3); */ + PW_j = PW_l - 36; + PW_j /= 4; + Whatever = (uint8_t *) &PW_j; + Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); + Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); + Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); + Amiga_EXE_Header_Block[23] = Amiga_EXE_Header_Block[31] = *Whatever; + Save_Rip_Special ( "Unknown ByteKiller Clone 5 Exe-file", BKClone5, Amiga_EXE_Header_Block , 32 ); + free ( Amiga_EXE_Header_Block ); + } + else + { + PW_Start_Address -= 32; + Save_Rip ( "Unknown ByteKiller Clone 5 Exe-file", BKClone5 ); + } + + if ( Save_Status == GOOD ) + PW_i += 36; /* 32 should do but call it "just to be sure" :) */ +} diff --git a/prowizard/rippers/ChipTracker.c b/prowizard/rippers/ChipTracker.c index 60b8dc4e..ce99a7e6 100644 --- a/prowizard/rippers/ChipTracker.c +++ b/prowizard/rippers/ChipTracker.c @@ -9,7 +9,7 @@ #include "globals.h" #include "extern.h" -short testKRIS ( void ) +int16_t testKRIS ( void ) { /* test 1 */ if ( (PW_i<952) || ((PW_Start_Address+977)>PW_in_size) ) @@ -41,6 +41,8 @@ short testKRIS ( void ) /* * Update: 20/12/2000 * - debug .. correct size calculated now. + * Update: 01/09/2010 + * - debug .. pattern data size scan only on patternlist size */ void Rip_KRIS ( void ) { @@ -52,7 +54,9 @@ void Rip_KRIS ( void ) /*printf ("\nKRIS:smpsiz:%ld\n", PW_WholeSampleSize);*/ PW_l = 0; /*printf ("KRIS:");*/ - for ( PW_k=0 ; PW_k<512 ; PW_k++ ) + + /* 20100901 : 128 replaced by patternlist size */ + for ( PW_k=0 ; PW_k<(in_data[PW_Start_Address+956]*4) ; PW_k++ ) { /*printf ( "%2x-%2x ",in_data[PW_Start_Address+958+PW_k*2],in_data[PW_Start_Address+959+PW_k*2]);*/ if ( (in_data[PW_Start_Address+958+PW_k*2]*256)+in_data[PW_Start_Address+959+PW_k*2] > PW_l ) @@ -66,7 +70,7 @@ void Rip_KRIS ( void ) Save_Rip ( "KRIS Tracker module", KRIS_tracker ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 954); /* 953 should do but call it "just to be sure" :) */ + PW_i += 954; /* 953 should do but call it "just to be sure" :) */ } @@ -88,26 +92,28 @@ void Rip_KRIS ( void ) void Depack_KRIS ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00; - Uchar poss[37][2]; - Uchar Max=0x00; - Uchar Note,Smp,Fx,FxVal; - Uchar TrackData[512][256]; - Uchar PatternTableSize=0x00; - Uchar PatternTable[128]; - short TrackAddressTable[128][4]; - long i=0,j=0,k=0; - long WholeSampleSize=0; - long Where = PW_Start_Address; - short MaxTrackAddress=0; - FILE *out; /*,*debug;*/ + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00; + uint8_t poss[37][2]; + uint8_t Max=0x00; + uint8_t Note,Smp,Fx,FxVal; + uint8_t TrackData[512][256]; + uint8_t PatternTableSize=0x00; + uint8_t PatternTable[128]; + int16_t TrackAddressTable[128][4]; + int32_t i=0,j=0,k=0; + int32_t WholeSampleSize=0; + int32_t Where = PW_Start_Address; + int16_t MaxTrackAddress=0; + FILE *out; + /*FILE *debug;*/ if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); + /*debug = fopen ( "debug.txt" , "w+b" );*/ fillPTKtable(poss); @@ -115,14 +121,13 @@ void Depack_KRIS ( void ) BZERO ( TrackData , 512*256 ); BZERO ( PatternTable , 128 ); -/* debug = fopen ( "debug" , "w+b" );*/ /* title */ fwrite ( &in_data[Where] , 20 , 1 , out ); Where += 22; /* 20 + 2 */ /* 31 samples */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO (Whatever , 1024); for ( i=0 ; i<31 ; i++ ) { @@ -165,7 +170,7 @@ void Depack_KRIS ( void ) /* pattern table (read,count and write) */ c1 = 0x00; k=0; - for ( i=0 ; i<128 ; i++ , k++ ) + for ( i=0 ; i PW_in_size) + { + return BAD; + } + + PW_l = ( (in_data[PW_Start_Address+PW_j]*256*256*256) + + (in_data[PW_Start_Address+PW_j+1]*256*256) + + (in_data[PW_Start_Address+PW_j+2]*256) + + in_data[PW_Start_Address+PW_j+3] ); + + PW_l += (40 + PW_j); + if ((PW_l%4) != 0) + PW_l += 2; + + } + else if (PW_case == 2) + { + if ( (in_data[PW_Start_Address+36] != 0x00 ) || + (in_data[PW_Start_Address+37] != 0x07 ) || + (in_data[PW_Start_Address+38] != 0xf7 ) || + (in_data[PW_Start_Address+39] != 0x00 ) || + (in_data[PW_Start_Address+40] != 0x20 ) || + (in_data[PW_Start_Address+41] != 0x4c ) ) { /* should be enough :))) */ /*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ return BAD; } + PW_j = 374; + if ((PW_Start_Address+PW_j) > PW_in_size) + { + return BAD; + } + + PW_l = ( (in_data[PW_Start_Address+PW_j]*256*256*256) + + (in_data[PW_Start_Address+PW_j+1]*256*256) + + (in_data[PW_Start_Address+PW_j+2]*256) + + in_data[PW_Start_Address+PW_j+3] ); + PW_l += 378; + if (((PW_l/4)*4) != PW_l) + PW_l += 2; } + else + return BAD; - /* packed size */ - PW_j = ( (in_data[PW_Start_Address+6]*256) + - in_data[PW_Start_Address+7] )+10; + if ((PW_Start_Address+PW_j) > PW_in_size) + { + return BAD; + } PW_l = ( (in_data[PW_Start_Address+PW_j]*256*256*256) + (in_data[PW_Start_Address+PW_j+1]*256*256) + @@ -93,8 +152,8 @@ void Rip_CrunchmaniaAddr ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -103,7 +162,7 @@ void Rip_CrunchmaniaAddr ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -115,7 +174,7 @@ void Rip_CrunchmaniaAddr ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/Crunchmania-Simple.c b/prowizard/rippers/Crunchmania-Simple.c index 18dfdac1..654d687a 100644 --- a/prowizard/rippers/Crunchmania-Simple.c +++ b/prowizard/rippers/Crunchmania-Simple.c @@ -5,7 +5,7 @@ #include "extern.h" -short testcrunchmaniaSimple ( void ) +int16_t testcrunchmaniaSimple ( void ) { PW_Start_Address = PW_i; @@ -76,8 +76,8 @@ void Rip_CrunchmaniaSimple ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -92,7 +92,7 @@ void Rip_CrunchmaniaSimple ( void ) in_data[PW_Start_Address+367] ); OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -109,7 +109,7 @@ void Rip_CrunchmaniaSimple ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 48; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[34] = *(Whatever+1); @@ -119,7 +119,7 @@ void Rip_CrunchmaniaSimple ( void ) PW_n += 2; PW_n += 372; PW_n /= 4; - Whatever = (Uchar *) &PW_n; + Whatever = (uint8_t *) &PW_n; Amiga_EXE_Header_Block[20] = *(Whatever+3); Amiga_EXE_Header_Block[21] = *(Whatever+2); Amiga_EXE_Header_Block[22] = *(Whatever+1); diff --git a/prowizard/rippers/DM1.c b/prowizard/rippers/DM1.c new file mode 100644 index 00000000..b5e9ba68 --- /dev/null +++ b/prowizard/rippers/DM1.c @@ -0,0 +1,73 @@ +/* + Delta Music 1 ("shot in the dark" try) + 20160309 - Asle +*/ +/* testDM1() */ +/* Rip_DM1() */ + + + +#include "globals.h" +#include "extern.h" + + +int16_t testDM1 ( void ) +{ + int32_t t[64],a; + PW_Start_Address = PW_i; + + /* file size */ + if ( (PW_Start_Address + 104) > PW_in_size ) + { + /*printf ( "#1 (start:%d) (size:%d)\n" , PW_Start_Address , PW_in_size-PW_Start_Address);*/ + return BAD; + } + + /* get track sizes */ + for ( a=0; a<4; a++) + { + t[a] = (( in_data[PW_Start_Address+6+(a*4)]*256)+ + in_data[PW_Start_Address+7+(a*4)] ); + if (t[a] > 0x7fff) return BAD; + } + + /* get note block size */ + t[4] = (( in_data[PW_Start_Address+22]*256) + in_data[PW_Start_Address+23] ); + + + /* get sounds sizes */ + for ( a=0; a<20; a++) + { + t[a+40] = (( in_data[PW_Start_Address+25+(a*4)]*256*256)+ + ( in_data[PW_Start_Address+26+(a*4)]*256)+ + in_data[PW_Start_Address+27+(a*4)] ); + if (t[a+40] > 0xffff) return BAD; + } + + /* file size */ + PW_l = t[0] + t[1] + t[2] + t[3] + t[4] + 104; + if ( (PW_Start_Address + PW_l) > PW_in_size) + { + printf ( "#1,3 (start:%d) (t[0]:%x)(t[1]:%x)(t[2]:%x)(t[3]:%x)(t[4]:%x)\n" , PW_Start_Address , t[0],t[1],t[2],t[3],t[4]); + return BAD; + } + + for ( a=40; a<60; a++)PW_l += t[a]; + + return GOOD; +} + + + +void Rip_DM1 ( void ) +{ + /* PW_l contains the whole size */ + OutputSize = PW_l; + + CONVERT = BAD; + Save_Rip ( "Delta Music 1", DM1 ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + diff --git a/prowizard/rippers/DefjamCruncher32-pro.c b/prowizard/rippers/DefjamCruncher32-pro.c index 208982c0..c049adea 100644 --- a/prowizard/rippers/DefjamCruncher32-pro.c +++ b/prowizard/rippers/DefjamCruncher32-pro.c @@ -7,7 +7,7 @@ #include "extern.h" -short testDefjam32 ( void ) +int16_t testDefjam32 ( void ) { PW_Start_Address = PW_i-2; @@ -55,6 +55,7 @@ short testDefjam32 ( void ) in_data[PW_Start_Address+23] ); PW_l += 692; + /*printf ( "testdefjam32():%ld (start:%ld)",PW_l,PW_Start_Address );*/ if ( PW_i >= 32 ) { @@ -88,7 +89,7 @@ short testDefjam32 ( void ) } -short testDefjam32pro ( void ) +int16_t testDefjam32pro ( void ) { PW_Start_Address = PW_i; @@ -151,7 +152,7 @@ short testDefjam32pro ( void ) } -short testDefjam32t ( void ) +int16_t testDefjam32t ( void ) { PW_Start_Address = PW_i; @@ -217,8 +218,8 @@ void Rip_Defjam32 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -227,7 +228,7 @@ void Rip_Defjam32 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -239,18 +240,12 @@ void Rip_Defjam32 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); Amiga_EXE_Header_Block[23] = Amiga_EXE_Header_Block[31] = *Whatever; - /* also the last 4 bytes are 'removed' frequently ... Here they are */ - in_data[PW_Start_Address+OutputSize-4] = 0x00; - in_data[PW_Start_Address+OutputSize-3] = 0x00; - in_data[PW_Start_Address+OutputSize-2] = 0x03; - in_data[PW_Start_Address+OutputSize-1] = 0xF2; - Save_Rip_Special ( "Defjam Cruncher 3.2 / pro / t Exe-file", Defjam_32, Amiga_EXE_Header_Block , 32 ); free ( Amiga_EXE_Header_Block ); } diff --git a/prowizard/rippers/DigiBooster17.c b/prowizard/rippers/DigiBooster17.c index 03f8a03b..14088ed5 100644 --- a/prowizard/rippers/DigiBooster17.c +++ b/prowizard/rippers/DigiBooster17.c @@ -5,7 +5,7 @@ #include "extern.h" -short testDigiBooster17 ( void ) +int16_t testDigiBooster17 ( void ) { PW_Start_Address = PW_i; diff --git a/prowizard/rippers/DigitalIllusion.c b/prowizard/rippers/DigitalIllusion.c index a41fc56c..002795e1 100644 --- a/prowizard/rippers/DigitalIllusion.c +++ b/prowizard/rippers/DigitalIllusion.c @@ -12,7 +12,7 @@ #include "extern.h" -short testDI ( void ) +int16_t testDI ( void ) { /* test #1 */ if ( PW_i < 17 ) @@ -165,25 +165,26 @@ void Rip_DI ( void ) * - removed open() (and other fread()s and the like) * - general Speed & Size Optmizings * 20051002 : testing fopen() + * 20100119 : cleaned up a bit - header is one fwrite. */ void Depack_DI ( void ) { - Uchar Note,Smp,Fx,FxVal; - Uchar poss[37][2]; - Uchar *Whatever; - long i=0,k=0; - Ushort Pattern_Addresses_Table[128]; - long Add_Pattern_Table=0; - long Add_Pattern_Data=0; - long Add_Sample_Data=0; - long Total_Sample_Size=0; - long Where = PW_Start_Address; + uint8_t Note,Smp,Fx,FxVal; + uint8_t poss[37][2]; + uint8_t *Whatever, c1; + int32_t i=0,k=0; + uint16_t Pattern_Addresses_Table[128]; + int32_t Add_Pattern_Table=0; + int32_t Add_Pattern_Data=0; + int32_t Add_Sample_Data=0; + int32_t Total_Sample_Size=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); fillPTKtable(poss); @@ -191,9 +192,8 @@ void Depack_DI ( void ) BZERO ( Pattern_Addresses_Table , 128*2 ); /* title */ - Whatever = (Uchar *) malloc (1024); - BZERO ( Whatever , 1024 ); - fwrite ( Whatever , 20 , 1 , out ); + Whatever = (uint8_t *) malloc (1085); + BZERO ( Whatever , 1085 ); k = (in_data[Where]*256)+in_data[Where+1]; Where += 2; @@ -203,78 +203,72 @@ void Depack_DI ( void ) (in_data[Where+2]*256)+ in_data[Where+3]; Where += 4; - /*printf ( "Pattern table address : %ld\n" , Add_Pattern_Table );*/ + /*printf ( "Pattern table address : %d\n" , Add_Pattern_Table );*/ Add_Pattern_Data = (in_data[Where+1]*256*256)+ (in_data[Where+2]*256)+ in_data[Where+3]; Where += 4; - /*printf ( "Pattern data address : %ld\n" , Add_Pattern_Data );*/ + printf ( "Pattern data address : %d\n" , Add_Pattern_Data ); Add_Sample_Data = (in_data[Where+1]*256*256)+ (in_data[Where+2]*256)+ in_data[Where+3]; Where += 4; - /*printf ( "Sample data address : %ld\n" , Add_Sample_Data );*/ + printf ( "Sample data address : %d\n" , Add_Sample_Data ); for ( i=0 ; i Whatever[256] ) - Whatever[256] = Whatever[i]; + Whatever[i+952]=in_data[Where]; + if (in_data[Where] > c1) + c1 = in_data[Where]; + i+=1;Where += 1; } - fwrite ( Whatever , 128 , 1 , out ); + Whatever[950] = (uint8_t)i; + Whatever[951] = 0x7f; + + printf ( "\nHighest pattern number : %d (Where:%x)\n" , c1,Where ); - /*printf ( "Number of pattern : %d\n" , Whatever[257] );*/ - /*printf ( "Highest pattern number : %d\n" , Whatever[256] );*/ + Whatever[1080] = 'M'; + Whatever[1081] = '.'; + Whatever[1082] = 'K'; + Whatever[1083] = '.'; - Whatever[0] = 'M'; - Whatever[1] = '.'; - Whatever[2] = 'K'; - Whatever[3] = '.'; - fwrite ( Whatever , 4 , 1 , out ); + fwrite ( Whatever , 1084 , 1 , out ); Where = k; - for ( i=0 ; i<=Whatever[256] ; i++ ) + for ( i=0 ; i<=c1 ; i++ ) { Pattern_Addresses_Table[i] = (in_data[Where]*256)+in_data[Where+1]; Where += 2; } - for ( i=0 ; i<=Whatever[256] ; i++ ) + for ( i=0 ; i<=c1 ; i++ ) { Where = PW_Start_Address + Pattern_Addresses_Table[i]; for ( k=0 ; k<256 ; k++ ) /* 256 = 4(voices) * 64(rows) */ @@ -284,24 +278,24 @@ void Depack_DI ( void ) if ( (Whatever[10] & 0x80) == 0 ) { Whatever[11] = in_data[Where++]; - Note = ( ((Whatever[10] << 4) & 0x30) | ( ( Whatever[11]>>4 ) & 0x0f ) ); - Whatever[0] = poss[Note][0]; - Whatever[1] = poss[Note][1]; - Smp = (Whatever[10] >> 2) & 0x1f; - Whatever[0] |= (Smp & 0xf0); - Whatever[2] = (Smp << 4) & 0xf0; - Fx = Whatever[11] & 0x0f; - Whatever[2] |= Fx; - FxVal = 0x00; - Whatever[3] = FxVal; - fwrite ( Whatever , 4 , 1 , out ); - continue; + Note = ( ((Whatever[10] << 4) & 0x30) | ( ( Whatever[11]>>4 ) & 0x0f ) ); + Whatever[0] = poss[Note][0]; + Whatever[1] = poss[Note][1]; + Smp = (Whatever[10] >> 2) & 0x1f; + Whatever[0] |= (Smp & 0xf0); + Whatever[2] = (Smp << 4) & 0xf0; + Fx = Whatever[11] & 0x0f; + Whatever[2] |= Fx; + FxVal = 0x00; + Whatever[3] = FxVal; + fwrite ( Whatever , 4 , 1 , out ); + continue; } if ( Whatever[10] == 0xff ) { Whatever[0] = Whatever[1] = Whatever[2] = Whatever[3] = 0x00; - fwrite ( Whatever , 4 , 1 , out ); - continue; + fwrite ( Whatever , 4 , 1 , out ); + continue; } Whatever[11] = in_data[Where++]; Whatever[12] = in_data[Where++]; diff --git a/prowizard/rippers/DoubleAction.c b/prowizard/rippers/DoubleAction.c index 82bcd745..12b78408 100644 --- a/prowizard/rippers/DoubleAction.c +++ b/prowizard/rippers/DoubleAction.c @@ -5,7 +5,7 @@ #include "extern.h" -short testDoubleAction10 ( void ) +int16_t testDoubleAction10 ( void ) { PW_Start_Address = PW_i; @@ -74,7 +74,7 @@ void Rip_DoubleAction10 ( void ) { /* PW_l is still the whole size */ -/* Uchar * Amiga_EXE_Header_Block;*/ +/* uint8_t * Amiga_EXE_Header_Block;*/ OutputSize = PW_l; @@ -82,7 +82,7 @@ void Rip_DoubleAction10 ( void ) if ( Amiga_EXE_Header == BAD ) { /* OutputSize -= 24; */ -/* Amiga_EXE_Header_Block = (Uchar *) malloc ( 24 ); */ +/* Amiga_EXE_Header_Block = (uint8_t *) malloc ( 24 ); */ /* BZERO ( Amiga_EXE_Header_Block , 24 ); */ /* Amiga_EXE_Header_Block[2] = 0x03; */ /* Amiga_EXE_Header_Block[3] = 0xF3; */ @@ -94,7 +94,7 @@ void Rip_DoubleAction10 ( void ) /* Save_Rip_Special ( "Double Action 1.0 Exe-file", Double_Action, Amiga_EXE_Header_Block , 24 ); */ /* free ( Amiga_EXE_Header_Block ); */ - printf ("Double Action 1.0 Exe-file without header detected at %ld. Can't rebuild it, sorry\n", PW_Start_Address); + printf ("Double Action 1.0 Exe-file without header detected at %d. Can't rebuild it, sorry\n", PW_Start_Address); } else { diff --git a/prowizard/rippers/Dragpack100.c b/prowizard/rippers/Dragpack100.c index 2239c96c..23dd5669 100644 --- a/prowizard/rippers/Dragpack100.c +++ b/prowizard/rippers/Dragpack100.c @@ -5,7 +5,7 @@ #include "extern.h" -short testDragpack100 ( void ) +int16_t testDragpack100 ( void ) { PW_Start_Address = PW_i; @@ -13,14 +13,14 @@ short testDragpack100 ( void ) (in_data[PW_Start_Address+17] != 0x18 ) || (in_data[PW_Start_Address+18] != 0x22 ) || (in_data[PW_Start_Address+19] != 0x18 ) || - (in_data[PW_Start_Address+22] != 0x2A ) || - (in_data[PW_Start_Address+23] != 0x18 ) || - (in_data[PW_Start_Address+24] != 0x24 ) || - (in_data[PW_Start_Address+25] != 0x49 ) || - (in_data[PW_Start_Address+26] != 0xD1 ) || - (in_data[PW_Start_Address+27] != 0xC0 ) || - (in_data[PW_Start_Address+30] != 0xD5 ) || - (in_data[PW_Start_Address+31] != 0xC1 ) ) + (in_data[PW_Start_Address+20] != 0x2A ) || + (in_data[PW_Start_Address+21] != 0x18 ) || + (in_data[PW_Start_Address+22] != 0x24 ) || + (in_data[PW_Start_Address+23] != 0x49 ) || + (in_data[PW_Start_Address+24] != 0xD1 ) || + (in_data[PW_Start_Address+25] != 0xC0 ) || + (in_data[PW_Start_Address+26] != 0xD5 ) || + (in_data[PW_Start_Address+27] != 0xC1 ) ) { /* should be enough :))) */ /*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ @@ -73,8 +73,8 @@ void Rip_Dragpack100 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -83,7 +83,7 @@ void Rip_Dragpack100 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 40; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 40 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 40 ); BZERO ( Amiga_EXE_Header_Block , 40 ); Amiga_EXE_Header_Block[2] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -99,7 +99,7 @@ void Rip_Dragpack100 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 804; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[24] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[25] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[26] = Amiga_EXE_Header_Block[30] = *(Whatever+1); @@ -110,7 +110,7 @@ void Rip_Dragpack100 ( void ) else { PW_Start_Address -= 40; - Save_Rip ( "DragPack 1.00 Exe-file", ByteKiller ); + Save_Rip ( "DragPack 1.00 Exe-file", DragPack100 ); } if ( Save_Status == GOOD ) diff --git a/prowizard/rippers/Dragpack252.c b/prowizard/rippers/Dragpack252.c index 36f0288d..1104a2d4 100644 --- a/prowizard/rippers/Dragpack252.c +++ b/prowizard/rippers/Dragpack252.c @@ -5,7 +5,7 @@ #include "extern.h" -short testDragpack252 ( void ) +int16_t testDragpack252 ( void ) { PW_Start_Address = PW_i; @@ -75,8 +75,8 @@ void Rip_Dragpack252 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -86,7 +86,7 @@ void Rip_Dragpack252 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -98,7 +98,7 @@ void Rip_Dragpack252 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/EurekaPacker.c b/prowizard/rippers/EurekaPacker.c index 7475414e..118b0e2a 100644 --- a/prowizard/rippers/EurekaPacker.c +++ b/prowizard/rippers/EurekaPacker.c @@ -14,7 +14,7 @@ * (30/08/10) * changed #4.3 as the "remaining" patternlist isn't always 0x00 */ -short testEUREKA ( void ) +int16_t testEUREKA ( void ) { /* test 1 */ if ( (PW_i < 45) || ((PW_Start_Address+950)>=PW_in_size) ) @@ -188,20 +188,20 @@ void Rip_EUREKA ( void ) void Depack_EUREKA ( void ) { - Uchar *Whatever; - Uchar c1=0x00; - Uchar Pat_Max=0x00; - long Sample_Start_Address=0; - long WholeSampleSize=0; - long Track_Address[128][4]; - long i=0,j=0,k; - long Where = PW_Start_Address; + uint8_t *Whatever; + uint8_t c1=0x00; + uint8_t Pat_Max=0x00; + int32_t Sample_Start_Address=0; + int32_t WholeSampleSize=0; + int32_t Track_Address[128][4]; + int32_t i=0,j=0,k; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read header ... same as ptk */ @@ -227,7 +227,7 @@ void Depack_EUREKA ( void ) /*printf ( "Number of patterns : %d\n" , Pat_Max );*/ /* write ptk's ID */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); Whatever[0] = 'M'; Whatever[1] = '.'; diff --git a/prowizard/rippers/FC-M-Packer.c b/prowizard/rippers/FC-M-Packer.c index 2e7c1d2c..29a8b944 100644 --- a/prowizard/rippers/FC-M-Packer.c +++ b/prowizard/rippers/FC-M-Packer.c @@ -6,7 +6,7 @@ #include "extern.h" -short testFC_M ( void ) +int16_t testFC_M ( void ) { /* test 1 */ PW_Start_Address = PW_i; @@ -70,16 +70,16 @@ void Rip_FC_M ( void ) */ void Depack_FC_M ( void ) { - Uchar *Whatever; - long i=0; - long WholeSampleSize=0; - long Where = PW_Start_Address; + uint8_t *Whatever; + int32_t i=0; + int32_t WholeSampleSize=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* bypass "FC-M" ID */ @@ -93,7 +93,7 @@ void Depack_FC_M ( void ) Where += 34; /* read and write sample descriptions */ - Whatever = (Uchar *)malloc(256); + Whatever = (uint8_t *)malloc(256); BZERO ( Whatever , 256 ); for ( i=0 ; i<31 ; i++ ) { @@ -111,7 +111,7 @@ void Depack_FC_M ( void ) } /*printf ( "Whole sample size : %ld\n" , WholeSampleSize );*/ - /* bypass "LONG" chunk */ + /* bypass "int32_t " chunk */ Where += 4; /* read and write pattern table lenght */ diff --git a/prowizard/rippers/FastTracker2.c b/prowizard/rippers/FastTracker2.c index 1979e6f0..cefcf2f3 100644 --- a/prowizard/rippers/FastTracker2.c +++ b/prowizard/rippers/FastTracker2.c @@ -6,7 +6,7 @@ #include "extern.h" -short testXM ( void ) +int16_t testXM ( void ) { /* test #1 */ PW_Start_Address = PW_i; @@ -61,6 +61,7 @@ void Rip_XM ( void ) /* getting siz of one pattern */ PW_m = (in_data[PW_Start_Address+PW_l+8]*256) + in_data[PW_Start_Address+PW_l+7]; /* adding it to current pointer + 9 being the pat header siz */ + fflush (stdout); PW_l += (PW_m + 9); } @@ -68,12 +69,14 @@ void Rip_XM ( void ) /* get whole insts data siz */ for ( PW_o=0 ; PW_o16)break; PW_l += PW_m; /* so that it points on first sample header */ for ( PW_n=0 ; PW_n PW_in_size ) @@ -131,13 +131,13 @@ void Rip_FuchsTracker ( void ) void Depack_FuchsTracker ( void ) { - Uchar *Whatever; - Uchar c1=0x00; - long WholeSampleSize=0; - long SampleSizes[16]; - long LoopStart[16]; - unsigned long i=0,j=0,k; - long Where = PW_Start_Address; + uint8_t *Whatever; + uint8_t c1=0x00; + int32_t WholeSampleSize=0; + int32_t SampleSizes[16]; + int32_t LoopStart[16]; + uint32_t i=0,j=0,k; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -146,11 +146,11 @@ void Depack_FuchsTracker ( void ) BZERO ( SampleSizes , 16*4 ); BZERO ( LoopStart , 16*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* write empty ptk header */ - Whatever = (Uchar *) malloc ( 1080 ); + Whatever = (uint8_t *) malloc ( 1080 ); BZERO ( Whatever , 1080 ); fwrite ( Whatever , 1080 , 1 , out ); @@ -240,8 +240,8 @@ void Depack_FuchsTracker ( void ) j /= 2; /* use of htonl() suggested by Xigh !.*/ k = htonl(j); - Whatever[0] = *((Uchar *)&k+2); - Whatever[1] = *((Uchar *)&k+3); + Whatever[0] = *((uint8_t *)&k+2); + Whatever[1] = *((uint8_t *)&k+3); fwrite ( Whatever , 2 , 1 , out ); } @@ -299,7 +299,7 @@ void Depack_FuchsTracker ( void ) /* read pattern data */ free ( Whatever ); - Whatever = (Uchar *) malloc ( j ); + Whatever = (uint8_t *) malloc ( j ); /* convert shits */ for ( i=0 ; iPW_in_size) ) @@ -16,6 +18,7 @@ short testGMC ( void ) } PW_Start_Address = PW_i-7; + /* samples descriptions */ PW_WholeSampleSize=0; PW_j=0; @@ -89,11 +92,27 @@ short testGMC ( void ) { for ( PW_n=0 ; PW_n<256 ; PW_n++ ) { - if ( ( in_data[PW_Start_Address+444+PW_k*1024+PW_n*4] > 0x03 ) || - ( (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) >= 0x90 )) + if ( in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)] > 0x03 ) { -/*printf ( "#5,0 Start:%ld (PW_k:%ld)\n" , PW_Start_Address , PW_k);*/ - return BAD; +/*printf ( "#5,0 Start:%d (PW_k:%d)(where:%d)\n" , PW_Start_Address , PW_k,PW_Start_Address+444+(PW_k*1024)+(PW_n*4) );*/ + return BAD; + } + /* 20010902:new test if note pitch too small */ + if ( (in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)] == 0x00) && + (in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)+1] < 0x71) && + (in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)+1] > 0x00) ) + { +/*printf ( "#5,0,1 Start:%d (PW_k:%d)(PW_n:%d)(pitch:%x-%x)\n" + , PW_Start_Address , PW_k,PW_n,in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)],in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)+1]);*/ + return BAD; + } + /* 20100902 - wrong test with 0x90 instead of 0x09 - less fake found now */ + if ( ((in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)+2]&0x0f) >= 0x09 ) && + ((in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)+2]&0x0f) != 0x0f ) ) + { +/*printf ( "#5,0,2 Start:%d (PW_k:%d)(PW_n:%d)(fx:%x)(Where:%d)\n" + , PW_Start_Address , PW_k,PW_n,in_data[PW_Start_Address+444+(PW_k*1024)+(PW_n*4)+2],444+(PW_k*1024)+(PW_n*4)+2);*/ + return BAD; } /* 20100822 - following test is removed as there seem to exist GMC with sample number higher than the actual number of sample saved ... @@ -103,41 +122,41 @@ short testGMC ( void ) printf ( "#5,1 Start:%ld (PW_j:%ld) (where:%ld) (value:%x)\n" , PW_Start_Address , PW_j , PW_Start_Address+444+PW_k*1024+PW_n*4+2 , ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0xf0)>>4) ); - return BAD; + return BAD; }*/ /* test volume effect if value is > 64 */ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 3) && (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > 0x64) ) { -/*printf ( "#5,2 Start:%ld (PW_j:%ld)\n" , PW_Start_Address , PW_j);*/ - return BAD; +/*printf ( "#5,2 Start:%d (PW_j:%d)\n" , PW_Start_Address , PW_j);*/ + return BAD; } if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 4) && (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > 0x63) ) { -/*printf ( "#5,3 Start:%ld (PW_j:%ld)\n" , PW_Start_Address , PW_j);*/ - return BAD; +/*printf ( "#5,3 Start:%d (PW_j:%d)\n" , PW_Start_Address , PW_j);*/ + return BAD; } if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 5) && (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > PW_o+1) ) { -/*printf ( "#5,4 Start:%ld (effect:5)(PW_o:%ld)(4th note byte:%x)\n" , PW_Start_Address , PW_j , in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3]);*/ - return BAD; +/*printf ( "#5,4 Start:%d (effect:5)(PW_o:%d)(4th note byte:%x)\n" , PW_Start_Address , PW_j , in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3]);*/ + return BAD; } if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 6) && (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] >= 0x02) ) { -/*printf ( "#5,5 Start:%ld (at:%ld)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/ - return BAD; +/*printf ( "#5,5 Start:%d (at:%d)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/ + return BAD; } if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 7) && (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] >= 0x02) ) { -/*printf ( "#5,6 Start:%ld (at:%ld)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/ - return BAD; +/*printf ( "#5,6 Start:%d (at:%d)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/ + return BAD; } if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4]&0x0f) > 0x00) || (in_data[PW_Start_Address+445+PW_k*1024+PW_n*4] > 0x00) ) - PW_m = 1; + PW_m = 1; } } if ( PW_m == 0 ) @@ -181,21 +200,21 @@ void Rip_GMC ( void ) void Depack_GMC ( void ) { - Uchar *Whatever; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j=0; - long Where = PW_Start_Address; + uint8_t *Whatever; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc ( 1084 ); + Whatever = (uint8_t *) malloc ( 1084 ); BZERO ( Whatever , 1084 ); /* read and write whole header */ @@ -270,6 +289,9 @@ void Depack_GMC ( void ) { switch ( Whatever[(j*4)+2]&0x0f ) { + case 0: /* no fx -> empty fxval */ + Whatever[(j*4)+3] = 0x00; + break; case 3: /* replace by C */ Whatever[(j*4)+2] += 0x09; break; diff --git a/prowizard/rippers/GNUPacker12.c b/prowizard/rippers/GNUPacker12.c index 89d6cbbf..bcb4b960 100644 --- a/prowizard/rippers/GNUPacker12.c +++ b/prowizard/rippers/GNUPacker12.c @@ -5,7 +5,7 @@ #include "extern.h" -short testGNUPacker12 ( void ) +int16_t testGNUPacker12 ( void ) { PW_Start_Address = PW_i; @@ -77,8 +77,8 @@ void Rip_GNUPacker12 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -87,7 +87,7 @@ void Rip_GNUPacker12 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -99,7 +99,7 @@ void Rip_GNUPacker12 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/GPMO.c b/prowizard/rippers/GPMO.c index f5965e08..cc5e55e8 100644 --- a/prowizard/rippers/GPMO.c +++ b/prowizard/rippers/GPMO.c @@ -7,7 +7,7 @@ #include "extern.h" -short testGPMO ( void ) +int16_t testGPMO ( void ) { /* test 1 */ if ( PW_i < 1080 ) @@ -133,17 +133,17 @@ void Rip_GPMO ( void ) void Depack_GPMO ( void ) { - Uchar *Whatever; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0; - long Where=PW_Start_Address; + uint8_t *Whatever; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0; + int32_t Where=PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* get whole sample size and patch vols (/2)*/ @@ -160,7 +160,7 @@ void Depack_GPMO ( void ) Where += 952; /* write ID */ - Whatever = (Uchar *) malloc (4); + Whatever = (uint8_t *) malloc (4); Whatever[0] = 'M'; Whatever[1] = '.'; Whatever[2] = 'K'; diff --git a/prowizard/rippers/GnuPlayer.c b/prowizard/rippers/GnuPlayer.c index 83e5c1d4..98cac488 100644 --- a/prowizard/rippers/GnuPlayer.c +++ b/prowizard/rippers/GnuPlayer.c @@ -11,7 +11,7 @@ #include "extern.h" -short testGnuPlayer ( void ) +int16_t testGnuPlayer ( void ) { /* test #1 */ if ( PW_i < 0x92 ) @@ -84,23 +84,23 @@ void Rip_GnuPlayer ( void ) void Depack_GnuPlayer ( void ) { - Uchar *Whatever; - long i=0,j=0,k=0,l=0; - long Where = PW_Start_Address; - Uchar * Pattern; - Uchar poss[37][2]; + uint8_t *Whatever; + int32_t i=0,j=0,k=0,l=0; + int32_t Where = PW_Start_Address; + uint8_t * Pattern; + uint8_t poss[37][2]; FILE *out;/*,*info;*/ - long SizOfTrack,len1,len2; - long SmpSizes[31]; - long NbrSmp = 0; - short SfxNbr=0; + int32_t SizOfTrack,len1,len2; + int32_t SmpSizes[31]; + int32_t NbrSmp = 0; + int16_t SfxNbr=0; if ( Save_Status == BAD ) return; fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /*info = fopen ( "info", "w+b" );*/ @@ -115,9 +115,9 @@ void Depack_GnuPlayer ( void ) */ /*take care of pattern right now*/ - Pattern = (Uchar *) malloc (65536); + Pattern = (uint8_t *) malloc (65536); BZERO (Pattern, 65536); - Where = PW_Start_Address + 0x96; + Where += 0x96; /* track 1 & 2 */ SizOfTrack = (in_data[Where]*256) + in_data[Where+1]; /* size of track 1 */ /*fprintf ( info, "Size of track 1 : %ld (%x)\n", SizOfTrack,SizOfTrack );*/ @@ -127,57 +127,57 @@ void Depack_GnuPlayer ( void ) switch (in_data[Where+i]) { case 0: /* track end */ - /*fprintf ( info, "[%3ld][%4ld] <-- end of track\n\n", i,l );*/ - i = SizOfTrack; - break; + /*fprintf ( info, "[%3ld][%4ld] <-- end of track\n\n", i,l );*/ + i = SizOfTrack; + break; case 1: /* set volume */ - SfxNbr += 1; - /*fprintf ( info, "[%3ld][%4ld] C fx (arg:%2d) [sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ - Pattern[l+2] |= 0x0C; - Pattern[l+3] = in_data[Where+1+i]; - Pattern[l+6] |= 0x0C; - Pattern[l+7] = in_data[Where+1+i]; - break; + SfxNbr += 1; + /*fprintf ( info, "[%3ld][%4ld] C fx (arg:%2d) [sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ + Pattern[l+2] |= 0x0C; + Pattern[l+3] = in_data[Where+1+i]; + Pattern[l+6] |= 0x0C; + Pattern[l+7] = in_data[Where+1+i]; + break; case 2: /* same a A */ - SfxNbr += 1; - /*fprintf ( info, "[%3ld][%4ld] A fx (arg:%2d) [sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ - Pattern[l+2] += 0x0A; - Pattern[l+3] = in_data[Where+1+i]; - Pattern[l+6] += 0x0A; - Pattern[l+7] = in_data[Where+1+i]; - break; + SfxNbr += 1; + /*fprintf ( info, "[%3ld][%4ld] A fx (arg:%2d) [sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ + Pattern[l+2] += 0x0A; + Pattern[l+3] = in_data[Where+1+i]; + Pattern[l+6] += 0x0A; + Pattern[l+7] = in_data[Where+1+i]; + break; case 3: /* set speed */ - SfxNbr += 1; - /*fprintf ( info, "[%3ld][%4ld] F fx (arg:%2d) [sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ - if ( SfxNbr == 1 ) - { - Pattern[l+2] |= 0x0f; - Pattern[l+3] = in_data[Where+1+i]; - } - else /* if SfxNbr == 3, I'm in trouble :( */ - { - Pattern[l+6] |= 0x0f; - Pattern[l+7] = in_data[Where+1+i]; - } - break; + SfxNbr += 1; + /*fprintf ( info, "[%3ld][%4ld] F fx (arg:%2d) [sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ + if ( SfxNbr == 1 ) + { + Pattern[l+2] |= 0x0f; + Pattern[l+3] = in_data[Where+1+i]; + } + else /* if SfxNbr == 3, I'm in trouble :( */ + { + Pattern[l+6] |= 0x0f; + Pattern[l+7] = in_data[Where+1+i]; + } + break; case 4: /* bypass rows */ - /*fprintf ( info, "[%3ld][%4ld] bypass rows : %d\n",i,l,in_data[Where+1+i]);*/ - l += (in_data[Where+i+1] * 16); - SfxNbr = 0; - break; + /*fprintf ( info, "[%3ld][%4ld] bypass rows : %d\n",i,l,in_data[Where+1+i]);*/ + l += (in_data[Where+i+1] * 16); + SfxNbr = 0; + break; case 5: /* set note */ - /*fprintf ( info, "[%3ld][%4ld] set note with smp nbr %d\n",i,l,in_data[Where+1+i]);*/ - Pattern[l] = (in_data[Where+1+i]&0xf0); - Pattern[l] |= in_data[PW_Start_Address + 0x90]; - Pattern[l+1] = in_data[PW_Start_Address + 0x91]; - Pattern[l+4] = (in_data[Where+1+i]&0xf0); - Pattern[l+4] |= in_data[PW_Start_Address + 0x90]; - Pattern[l+5] = in_data[PW_Start_Address + 0x91]; - Pattern[l+2] |= (in_data[Where+1+i]<<4); - Pattern[l+6] |= (in_data[Where+1+i]<<4); - break; + /*fprintf ( info, "[%3ld][%4ld] set note with smp nbr %d\n",i,l,in_data[Where+1+i]);*/ + Pattern[l] = (in_data[Where+1+i]&0xf0); + Pattern[l] |= in_data[PW_Start_Address + 0x90]; + Pattern[l+1] = in_data[PW_Start_Address + 0x91]; + Pattern[l+4] = (in_data[Where+1+i]&0xf0); + Pattern[l+4] |= in_data[PW_Start_Address + 0x90]; + Pattern[l+5] = in_data[PW_Start_Address + 0x91]; + Pattern[l+2] |= (in_data[Where+1+i]<<4); + Pattern[l+6] |= (in_data[Where+1+i]<<4); + break; default : - printf ( "\nunsupported case in Depack_GnuPlayer(). Please send this file to \"asle@free.fr\" :)\n" ); + printf ( "\nunsupported case in Depack_GnuPlayer(). Please send this file to \"asle@free.fr\" :)\n" ); break; } } @@ -193,57 +193,57 @@ void Depack_GnuPlayer ( void ) switch (in_data[Where+i]) { case 0: /* track end */ - /*fprintf ( info, "[%3ld][%4ld] <-- end of track\n\n", i,l );*/ - i = SizOfTrack; - break; + /*fprintf ( info, "[%3ld][%4ld] <-- end of track\n\n", i,l );*/ + i = SizOfTrack; + break; case 1: /* set volume */ - SfxNbr += 1; - /*fprintf ( info, "[%3ld][%4ld] C fx (arg:%d) [Sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ - Pattern[l+10] |= 0x0C; - Pattern[l+11] = in_data[Where+1+i]; - Pattern[l+14] |= 0x0C; - Pattern[l+15] = in_data[Where+1+i]; - break; + SfxNbr += 1; + /*fprintf ( info, "[%3ld][%4ld] C fx (arg:%d) [Sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ + Pattern[l+10] |= 0x0C; + Pattern[l+11] = in_data[Where+1+i]; + Pattern[l+14] |= 0x0C; + Pattern[l+15] = in_data[Where+1+i]; + break; case 2: /* same a A */ - SfxNbr += 1; - /*fprintf ( info, "[%3ld][%4ld] A fx (arg:%2d) [Sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ - Pattern[l+10] |= 0x0A; - Pattern[l+11] = in_data[Where+1+i]; - Pattern[l+14] |= 0x0A; - Pattern[l+15] = in_data[Where+1+i]; - break; + SfxNbr += 1; + /*fprintf ( info, "[%3ld][%4ld] A fx (arg:%2d) [Sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ + Pattern[l+10] |= 0x0A; + Pattern[l+11] = in_data[Where+1+i]; + Pattern[l+14] |= 0x0A; + Pattern[l+15] = in_data[Where+1+i]; + break; case 3: /* set speed */ - SfxNbr += 1; - /*fprintf ( info, "[%3ld][%4ld] F fx (arg:%2d) [Sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ - if ( SfxNbr == 1 ) - { - Pattern[l+10] |= 0x0f; - Pattern[l+11] = in_data[Where+1+i]; - } - else - { - Pattern[l+14] |= 0x0f; - Pattern[l+15] = in_data[Where+1+i]; - } - break; + SfxNbr += 1; + /*fprintf ( info, "[%3ld][%4ld] F fx (arg:%2d) [Sfx %d]\n",i,l,in_data[Where+1+i],SfxNbr);*/ + if ( SfxNbr == 1 ) + { + Pattern[l+10] |= 0x0f; + Pattern[l+11] = in_data[Where+1+i]; + } + else + { + Pattern[l+14] |= 0x0f; + Pattern[l+15] = in_data[Where+1+i]; + } + break; case 4: /* bypass rows */ - /*fprintf ( info, "[%3ld][%4ld] bypass rows : %d\n",i,l,in_data[Where+1+i]);*/ - l += (in_data[Where+i+1] * 16); - SfxNbr = 0; - break; + /*fprintf ( info, "[%3ld][%4ld] bypass rows : %d\n",i,l,in_data[Where+1+i]);*/ + l += (in_data[Where+i+1] * 16); + SfxNbr = 0; + break; case 5: /* set note */ - /*fprintf ( info, "[%3ld][%4ld] set note with smp nbr %d\n",i,l,in_data[Where+1+i]);*/ - Pattern[l+8] = (in_data[Where+1+i]&0xf0); - Pattern[l+8] |= in_data[PW_Start_Address + 0x90]; - Pattern[l+9] = in_data[PW_Start_Address + 0x91]; - Pattern[l+12] = (in_data[Where+1+i]&0xf0); - Pattern[l+12] |= in_data[PW_Start_Address + 0x90]; - Pattern[l+13] = in_data[PW_Start_Address + 0x91]; - Pattern[l+10] |= (in_data[Where+1+i]<<4); - Pattern[l+14] |= (in_data[Where+1+i]<<4); - break; + /*fprintf ( info, "[%3ld][%4ld] set note with smp nbr %d\n",i,l,in_data[Where+1+i]);*/ + Pattern[l+8] = (in_data[Where+1+i]&0xf0); + Pattern[l+8] |= in_data[PW_Start_Address + 0x90]; + Pattern[l+9] = in_data[PW_Start_Address + 0x91]; + Pattern[l+12] = (in_data[Where+1+i]&0xf0); + Pattern[l+12] |= in_data[PW_Start_Address + 0x90]; + Pattern[l+13] = in_data[PW_Start_Address + 0x91]; + Pattern[l+10] |= (in_data[Where+1+i]<<4); + Pattern[l+14] |= (in_data[Where+1+i]<<4); + break; default : - printf ( "\nunsupported case in Depack_GnuPlayer(). Please send this file to \"asle@free.fr\" :)\n" ); + printf ( "\nunsupported case in Depack_GnuPlayer(). Please send this file to \"asle@free.fr\" :)\n" ); break; } } @@ -252,15 +252,17 @@ void Depack_GnuPlayer ( void ) /*fprintf ( info, "\nWhere before first sample : %ld (%x)\n", Where,Where );*/ /* sample header stuff */ - Whatever = (Uchar *) malloc ( 2048 ); + Whatever = (uint8_t *) malloc ( 2048 ); BZERO (Whatever, 2048); /*get nbr of non-null samples */ + l = 0; for ( i=0 ; i< 31 ; i++) { k = (in_data[PW_Start_Address + 20 + (i*4)]*256) + in_data[PW_Start_Address + 21 + (i*4)]; if ( k != 0 ) NbrSmp += 1; - SmpSizes[i] = k; + SmpSizes[i] = k*2; + l += SmpSizes[i]; Whatever[22+(i*30)] = in_data[PW_Start_Address + 20 + (i*4)]; Whatever[23+(i*30)] = in_data[PW_Start_Address + 21 + (i*4)]; @@ -269,11 +271,12 @@ void Depack_GnuPlayer ( void ) Whatever[27+(i*30)] = in_data[PW_Start_Address + 23 + (i*4)]; Whatever[29+(i*30)] = 0x01; } + /*printf ("\nwhole sample size : %ld\n",l);*/ k = MAXI(len1,len2); Whatever[930] = k; Whatever[931] = 0x7f; for ( i=0; i %ld)\n" , i,out_end,Where,l+24636,ftell(out));*/ + l += SmpSizes[i]; /*fflush ( info );*/ Whatever[k++] = in_data[Where++]; while ( k < out_end ) { samp = (in_data[Where]>>4)&0x0f; if ( samp & 0x08 ) samp -= 0x10; - Whatever[k++] = (Whatever[k-1] + samp); + k+=1; + Whatever[k] = (Whatever[k-1] + samp); samp = in_data[Where] & 0x0f; if ( samp & 0x08 ) samp -= 0x10; - Whatever[k++] = (Whatever[k-1] + samp); + k+=1; + Whatever[k] = (Whatever[k-1] + samp); Where += 1; } Where -= 1; - fwrite ( &Whatever[0], out_end, 1, out ); + /*printf ("output pos:%ld, sizeout:%ld\n",ftell(out), SmpSizes[i]);*/ + /*fwrite ( &Whatever[0], out_end, 1, out );*/ + /*printf ("%ld then ",ftell(out));*/ + fwrite ( &Whatever[0], SmpSizes[i], 1, out ); + fflush(out); + /*printf ("%ld (%ld)\n",ftell(out),SmpSizes[i]);*/ } free ( Whatever ); diff --git a/prowizard/rippers/HCD.c b/prowizard/rippers/HCD.c new file mode 100644 index 00000000..cfa4ff26 --- /dev/null +++ b/prowizard/rippers/HCD.c @@ -0,0 +1,161 @@ +/* testHCD() */ +/* Rip_HCD() */ +/* Depack_HCD() */ + + +#include "globals.h" +#include "extern.h" + + +int16_t testHCD ( void ) +{ + /* test 1 */ + if ( PW_i < 1080 ) + { + return BAD; + } + + /* test 2 */ + PW_Start_Address = PW_i-1080; + PW_WholeSampleSize = 0; + for ( PW_k=0 ; PW_k<31 ; PW_k++ ) + { + /* size */ + PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); + /* loop start */ + PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2)-0x68A; + /* loop size */ + PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); + + if ( test_smps(PW_j*2, PW_m, PW_n, in_data[PW_Start_Address+45+30*PW_k], in_data[PW_Start_Address+44+30*PW_k] ) == BAD ) + { + /*printf ( "start : %ld\n", PW_Start_Address );*/ + return BAD; + } + + PW_WholeSampleSize += PW_j; + } + + /* test #3 pattern list size */ + PW_l = in_data[PW_Start_Address+950]; + if ( (PW_l>127) || (PW_l==0) ) + { + /*printf ( "#4,0 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + /* PW_l holds the size of the pattern list */ + PW_k=0; + for ( PW_j=0 ; PW_j<128 ; PW_j++ ) + { + if ( in_data[PW_Start_Address+952+PW_j] > PW_k ) + PW_k = in_data[PW_Start_Address+952+PW_j]; + if ( in_data[PW_Start_Address+952+PW_j] > 127 ) + { + /*printf ( "#4,1 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + } + /* PW_k holds the highest pattern number */ + PW_k += 1; + + return GOOD; +} + + + +void Rip_HCD ( void ) +{ + OutputSize = (PW_k*1024) + 1084 + PW_WholeSampleSize; + + CONVERT = GOOD; + Save_Rip ( "HCD-Protector module", HCD ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + + + +/* + * HCD.c 2008 (c) Sylvain "Asle" Chipaux + + same header as PTK save for the sample loop start which is +0x0345 + pattern data is <<3 +*/ +void Depack_HCD ( void ) +{ + uint8_t *Whatever; + uint8_t poss[37][2]; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where=PW_Start_Address; + FILE *out; + + fillPTKtable(poss); + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + /* header */ + Whatever = (uint8_t *) malloc (2048); + for ( i=0; i<1084 ; i++ ) + { + Whatever[i] = in_data[Where+i]; + } + + /* fix loop start */ + for (i=46 ; i<950 ; i+=30) + { + Whatever[i] -= 0x03; + Whatever[i+1] -= 0x45; + WholeSampleSize += (((in_data[Where+i-4]*256)+in_data[Where+i-3])*2); + } + + /*write header*/ + fwrite ( Whatever , 1084 , 1 , out ); + + /* get number of pattern */ + Max = 0x00; + for ( i=952 ; i<1080 ; i++ ) + { + if ( Whatever[i] > Max ) + Max = Whatever[i]; + } + /*printf ( "Number of pattern : %d\n" , Max );*/ + + /* pattern data */ + Where += 1084; + for ( i=0 ; i<=Max ; i++ ) + { + for ( j=0 ; j<256 ; j++ ) + { + /*d = ((uint32_t *) in_data)[0] >> 3;*/ + Whatever[j*4] = in_data[Where]>>3; + Whatever[j*4+1] = (in_data[Where+1]>>3)|(in_data[Where]<<5); + Whatever[j*4+2] = (in_data[Where+2]>>3)|(in_data[Where+1]<<5); + Whatever[j*4+3] = (in_data[Where+3]>>3)|(in_data[Where+2]<<5); + Where += 4; + } + fwrite ( Whatever , 1024 , 1 , out ); + } + free ( Whatever ); + + + /* sample data */ + fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); + + + /* crap */ + Crap ( " HCD Protector " , BAD , BAD , out ); + + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ +} + diff --git a/prowizard/rippers/HQC2.c b/prowizard/rippers/HQC2.c index 5262e273..440f43e0 100644 --- a/prowizard/rippers/HQC2.c +++ b/prowizard/rippers/HQC2.c @@ -5,7 +5,7 @@ #include "extern.h" -short testHQCCruncher2 ( void ) +int16_t testHQCCruncher2 ( void ) { PW_Start_Address = PW_i - 64; @@ -80,8 +80,8 @@ void Rip_HQCCruncher2 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -95,7 +95,7 @@ void Rip_HQCCruncher2 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 50; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -109,7 +109,7 @@ void Rip_HQCCruncher2 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 60; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); diff --git a/prowizard/rippers/HeatseekerMC10.c b/prowizard/rippers/HeatseekerMC10.c index 04c0e5f4..a387d164 100644 --- a/prowizard/rippers/HeatseekerMC10.c +++ b/prowizard/rippers/HeatseekerMC10.c @@ -10,7 +10,7 @@ #include "extern.h" -short testHEATSEEKER ( void ) +int16_t testHEATSEEKER ( void ) { int nbr_notes=0; @@ -176,13 +176,13 @@ void Rip_HEATSEEKER ( void ) void Depack_HEATSEEKER ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - Uchar Pat_Max=0x00; - Uchar *Whatever; - long Track_Addresses[512]; - long i=0,j=0,k=0,l=0,m; - long WholeSampleSize=0; - long Where = PW_Start_Address; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t Pat_Max=0x00; + uint8_t *Whatever; + int32_t Track_Addresses[512]; + int32_t i=0,j=0,k=0,l=0,m; + int32_t WholeSampleSize=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -190,11 +190,11 @@ void Depack_HEATSEEKER ( void ) BZERO ( Track_Addresses , 512*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* write title */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); diff --git a/prowizard/rippers/HighPresCr.c b/prowizard/rippers/HighPresCr.c new file mode 100644 index 00000000..a7718aa4 --- /dev/null +++ b/prowizard/rippers/HighPresCr.c @@ -0,0 +1,127 @@ +/* testHighPressureCruncher() */ +/* Rip_HighPressureCruncher() */ + +#include "globals.h" +#include "extern.h" + + +int16_t testHighPressureCruncher ( void ) +{ + PW_Start_Address = PW_i; + + if ( (in_data[PW_Start_Address+23] != 0x84 ) || + (in_data[PW_Start_Address+24] != 0x28 ) || + (in_data[PW_Start_Address+25] != 0x00 ) || + (in_data[PW_Start_Address+26] != 0xD5 ) || + (in_data[PW_Start_Address+27] != 0xC4 ) || + (in_data[PW_Start_Address+28] != 0x61 ) || + (in_data[PW_Start_Address+29] != 0x00 ) || + (in_data[PW_Start_Address+30] != 0x00 ) || + (in_data[PW_Start_Address+31] != 0x7C ) || + (in_data[PW_Start_Address+32] != 0xD3 ) || + (in_data[PW_Start_Address+33] != 0xC0 ) || + (in_data[PW_Start_Address+34] != 0x26 ) || + (in_data[PW_Start_Address+35] != 0x00 ) || + (in_data[PW_Start_Address+36] != 0x08 ) || + (in_data[PW_Start_Address+37] != 0x79 ) || + (in_data[PW_Start_Address+38] != 0x00 ) || + (in_data[PW_Start_Address+39] != 0x01 ) || + (in_data[PW_Start_Address+40] != 0x00 ) || + (in_data[PW_Start_Address+41] != 0xBF ) || + (in_data[PW_Start_Address+42] != 0xE0 ) || + (in_data[PW_Start_Address+43] != 0x01 ) || + (in_data[PW_Start_Address+44] != 0x18 ) ) + { + /* should be enough :))) */ + /*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + + } + + + /* packed size */ + PW_l = ( (in_data[PW_Start_Address+176]*256*256*256) + + (in_data[PW_Start_Address+177]*256*256) + + (in_data[PW_Start_Address+178]*256) + + in_data[PW_Start_Address+179] ); + + PW_l += 548; + /*printf ( "testHighPressureCruncher():%ld (start:%ld)",PW_l,PW_Start_Address );*/ + + if ( PW_i >= 36 ) + { + if ( (in_data[PW_Start_Address-36] != 0x00 ) || + (in_data[PW_Start_Address-35] != 0x00 ) || + (in_data[PW_Start_Address-34] != 0x03 ) || + (in_data[PW_Start_Address-33] != 0xF3 ) || + (in_data[PW_Start_Address-32] != 0x00 ) || + (in_data[PW_Start_Address-31] != 0x00 ) || + (in_data[PW_Start_Address-30] != 0x00 ) || + (in_data[PW_Start_Address-29] != 0x00 ) || + (in_data[PW_Start_Address-28] != 0x00 ) || + (in_data[PW_Start_Address-27] != 0x00 ) || + (in_data[PW_Start_Address-26] != 0x00 ) || + (in_data[PW_Start_Address-25] != 0x02 ) || + (in_data[PW_Start_Address-24] != 0x00 ) || + (in_data[PW_Start_Address-23] != 0x00 ) || + (in_data[PW_Start_Address-22] != 0x00 ) || + (in_data[PW_Start_Address-21] != 0x00 ) ) + { + Amiga_EXE_Header = BAD; + } + else + Amiga_EXE_Header = GOOD; + } + else + Amiga_EXE_Header = BAD; + + return GOOD; + /* PW_l is the size of the pack */ +} + + +void Rip_HighPressureCruncher ( void ) +{ + /* PW_l is still the whole size */ + + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; + + OutputSize = PW_l; + + CONVERT = BAD; + + if ( Amiga_EXE_Header == BAD ) + { + OutputSize -= 36; + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); + BZERO ( Amiga_EXE_Header_Block , 36 ); + Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; + Amiga_EXE_Header_Block[3] = 0xF3; + Amiga_EXE_Header_Block[11] = 0x02; + Amiga_EXE_Header_Block[13] = Amiga_EXE_Header_Block[27] = 0x01; + Amiga_EXE_Header_Block[31] = 0xE9; + + /* WARNING !!! WORKS ONLY ON PC !!! */ + /* 68k machines code : c1 = *(Whatever+2); */ + /* 68k machines code : c2 = *(Whatever+3); */ + PW_j = PW_l - 60; + PW_j /= 4; + Whatever = (uint8_t *) &PW_j; + Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); + Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); + Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); + Amiga_EXE_Header_Block[23] = Amiga_EXE_Header_Block[35] = *Whatever; + + Save_Rip_Special ( "High Pressure Cruncher Exe-file", HighPresCruncher, Amiga_EXE_Header_Block , 36 ); + free ( Amiga_EXE_Header_Block ); + } + else + { + PW_Start_Address -= 36; + Save_Rip ( "High Pressure Cruncher Exe-file", HighPresCruncher ); + } + + if ( Save_Status == GOOD ) + PW_i += 1; +} diff --git a/prowizard/rippers/HornetPacker.c b/prowizard/rippers/HornetPacker.c index 86febf4c..e774b1e9 100644 --- a/prowizard/rippers/HornetPacker.c +++ b/prowizard/rippers/HornetPacker.c @@ -6,7 +6,7 @@ #include "extern.h" -short testHRT ( void ) +int16_t testHRT ( void ) { /* test 1 */ if ( PW_i < 1080 ) @@ -67,12 +67,12 @@ void Rip_HRT ( void ) void Depack_HRT ( void ) { - Uchar *Whatever; - Uchar poss[37][2]; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j=0; - long Where = PW_Start_Address; + uint8_t *Whatever; + uint8_t poss[37][2]; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -80,11 +80,11 @@ void Depack_HRT ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read header */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); for ( i=0 ; i<950 ; i++ ) Whatever[i] = in_data[Where++]; diff --git a/prowizard/rippers/IFF.c b/prowizard/rippers/IFF.c new file mode 100644 index 00000000..cf798d3e --- /dev/null +++ b/prowizard/rippers/IFF.c @@ -0,0 +1,85 @@ +/* testIFF() */ +/* Rip_IFF() */ + +#include "globals.h" +#include "extern.h" + + +int16_t testIFF ( void ) +{ + PW_Start_Address = PW_i; + + if ( PW_Start_Address + 20 > PW_in_size ) + { +/*printf ( "#1 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + +/* ILBM -> picture */ + if ( (in_data[PW_Start_Address+8] != 'I' ) || + (in_data[PW_Start_Address+9] != 'L' ) || + (in_data[PW_Start_Address+10] != 'B' ) || + (in_data[PW_Start_Address+11] != 'M' )) + { +/*printf ( "#2 Start:%d\n" , PW_Start_Address );*/ + return BAD; + } + + PW_m = 16; + while (1) + { + /* size of hunk */ + PW_l = ( (in_data[PW_Start_Address+PW_m]*256*256*256) + + (in_data[PW_Start_Address+PW_m+1]*256*256) + + (in_data[PW_Start_Address+PW_m+2]*256) + + in_data[PW_Start_Address+PW_m+3] ); + if (((PW_l/2)*2) != PW_l) PW_l += 1; +/*printf ("at %x (%x) - ",(PW_Start_Address+PW_m),PW_l);*/ + + PW_m += 4; + PW_m += PW_l; + + if ((PW_Start_Address+PW_m + 8 > PW_in_size)||(PW_l == 0)) + { +/* printf ( "#3 Start:%d\n" , PW_Start_Address );*/ + return BAD; + } + + if ((in_data[PW_Start_Address+PW_m] == 'B') && + (in_data[PW_Start_Address+PW_m+1] == 'O') && + (in_data[PW_Start_Address+PW_m+2] == 'D') && + (in_data[PW_Start_Address+PW_m+3] == 'Y')) + break; +/*printf ("%02x %02x %02x %02x\n",in_data[PW_Start_Address+PW_m],in_data[PW_Start_Address+PW_m+1],in_data[PW_Start_Address+PW_m+2],in_data[PW_Start_Address+PW_m+3]);*/ + + PW_m += 4; + + } + + PW_k = ( (in_data[PW_Start_Address+PW_m+4]*256*256*256) + + (in_data[PW_Start_Address+PW_m+5]*256*256) + + (in_data[PW_Start_Address+PW_m+6]*256) + + in_data[PW_Start_Address+PW_m+7] ); + PW_l = PW_m + 8 + PW_k; +/*printf ("\nPW_l %d\n",PW_l); +printf ("PW_m %d\n",PW_m); +printf ("PW_Start_Address %d\n",PW_Start_Address); +printf ("PW_k %d\n",PW_k);*/ + + return GOOD; + /* PW_l is the size of the picture */ +} + +void Rip_IFF ( void ) +{ + /* PW_l is still the whole size */ + + OutputSize = PW_l; + + CONVERT = BAD; + + Save_Rip ( "IFF graphic", IFF ); + + if ( Save_Status == GOOD ) + PW_i += 4; +} diff --git a/prowizard/rippers/IT.c b/prowizard/rippers/IT.c new file mode 100644 index 00000000..de4a1a94 --- /dev/null +++ b/prowizard/rippers/IT.c @@ -0,0 +1,182 @@ +/* testIT() */ +/* Rip_IT() */ + +/* +first try : 20110808 +*/ + + +#include "globals.h" +#include "extern.h" + + +int16_t testIT ( void ) +{ + /* test #1 */ + PW_Start_Address = PW_i; + if ( (PW_Start_Address + 0xc0) > PW_in_size) + { + /*printf ( "#1 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + /* must be < 10 */ + if ( (in_data[PW_Start_Address + 41] >= 0x0f) || (in_data[PW_Start_Address + 43] >= 0x0F) ) + { + /*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + + PW_k = 0xc0 + (in_data[PW_Start_Address + 33]*256)+in_data[PW_Start_Address + 32]; + if ( PW_k > PW_in_size) + { + /*printf ( "#3 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + PW_j = PW_k + ((in_data[PW_Start_Address + 35]*256)+in_data[PW_Start_Address + 34])*4; + if ( PW_j > PW_in_size) + { + /*printf ( "#4 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + PW_l = PW_j + ((in_data[PW_Start_Address + 37]*256)+in_data[PW_Start_Address + 36])*4; + if ( PW_l > PW_in_size) + { + /*printf ( "#4 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + + return GOOD; +/* PW_k => inst addresses*/ +/* PW_j => smp headers addresses*/ +/* PW_l => patterns addresses */ +} + + +/* + * IT ripper + * 20110808 - Sylvain "Asle" Chipaux + * + * let's try it + * OK, what's is the size of one compressed sample ?!?!? +*/ +void Rip_IT ( void ) +{ +/* +from the test part -> + PW_k => inst addresses + PW_j => smp headers addresses + PW_l => patterns addresses +*/ + + int32_t PtrInst = PW_k; + int32_t NbrInst = (in_data[PW_Start_Address + 35]*256)+in_data[PW_Start_Address + 34]; + int32_t LenInst = 0; + int32_t PtrSmpHead = PW_j; + int32_t NbrSmpHead = (in_data[PW_Start_Address + 37]*256)+in_data[PW_Start_Address + 36]; +/* int32_t LenSmpHead = 0;*/ + int32_t PtrPatt = PW_l; +/* int32_t NbrPatt = (in_data[PW_Start_Address + 39]*256)+in_data[PW_Start_Address + 38];*/ +/* int32_t LenPatt = 0;*/ + int32_t currentptr; + int32_t max = 0; +/* int32_t whole_inst_size=0;*/ +/* int32_t whole_head_size=0;*/ + uint8_t COMPRESSED = 1; + + printf ("\nPtrInst:%x\nPtrSmpHead:%x\nPtrPatt:%x\n",PtrInst,PtrSmpHead,PtrPatt); + + /* let's get the highest address of an instrument (if any is set) */ + if (NbrInst > 0) + { + currentptr = PW_Start_Address + PtrInst; + for ( PW_k=0 ; PW_k max ) + { + max = tmp_addy + 554; + } + /* inst have constant size */ + + LenInst = NbrInst*554; + + } + } + + /* let's get the highest address of a sample (if any is set) */ + if (NbrSmpHead > 0) + { + currentptr = PW_Start_Address + PtrSmpHead; + for ( PW_k=0 ; PW_k max ) + max = tmp_addy+0x50; + if ( tmp_addy2 >= max ) + { + int32_t tmp_size = (in_data[PW_Start_Address+tmp_addy+0x33]*256*256*256)+ + (in_data[PW_Start_Address+tmp_addy+0x32]*256*256)+ + (in_data[PW_Start_Address+tmp_addy+0x31]*256)+ + in_data[PW_Start_Address+tmp_addy+0x30]; + if ((in_data[PW_Start_Address+tmp_addy+0x12]&0x02) == 0x02) /* 16 bits ? */ + tmp_size *= 2; + /* OK, what's the size of 'compressed' samples ?!? */ + if ((in_data[PW_Start_Address+tmp_addy+0x12]&0x08) == 0x08) /* compressed ? */ + { + printf ("*"); + COMPRESSED = 2; + tmp_size /= 2; /* just to be sure */ + } + else + COMPRESSED = 1; + printf ("- size:%x)",tmp_size); + max = tmp_addy2+tmp_size; + } + printf ("\n"); + + /* here, max is now after the farthest sample data */ + + } + } + +/* PATTERNS could be _after_ the samples ... never seen but ... +shall have to be handled, some day */ + + OutputSize = max; + + CONVERT = BAD; + if (COMPRESSED == 2) + { + printf ("found Impulse Tracker module at %d with last sample compressed - can't save\n",PW_Start_Address); + Save_Status = GOOD; + } + else + { + Save_Rip ( "Impulse Tracker module", ImpulseTracker ); + } + + if ( Save_Status == GOOD ) + PW_i += 1; +} diff --git a/prowizard/rippers/JamCracker.c b/prowizard/rippers/JamCracker.c index 1943f9bd..7749b70d 100644 --- a/prowizard/rippers/JamCracker.c +++ b/prowizard/rippers/JamCracker.c @@ -5,7 +5,7 @@ #include "extern.h" -short testJamCracker ( void ) +int16_t testJamCracker ( void ) { PW_Start_Address = PW_i; diff --git a/prowizard/rippers/KefrensSoundMachine.c b/prowizard/rippers/KefrensSoundMachine.c index f1e3827a..aea811ae 100644 --- a/prowizard/rippers/KefrensSoundMachine.c +++ b/prowizard/rippers/KefrensSoundMachine.c @@ -6,7 +6,7 @@ #include "extern.h" -short testKSM ( void ) +int16_t testKSM ( void ) { PW_Start_Address = PW_i; if ( (PW_Start_Address + 1536) > PW_in_size) @@ -99,23 +99,23 @@ void Rip_KSM ( void ) void Depack_KSM ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00,c5; - Uchar Track_Numbers[128][4]; - Uchar Track_Numbers_Real[128][4]; - Uchar Track_Datas[4][192]; - Uchar Max=0x00; - Uchar poss[37][2]; - Uchar PatPos; - Uchar Status=ON; - Uchar transco[]={'a','b','c','d','e','f','g','h','i','j' + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00,c5; + uint8_t Track_Numbers[128][4]; + uint8_t Track_Numbers_Real[128][4]; + uint8_t Track_Datas[4][192]; + uint8_t Max=0x00; + uint8_t poss[37][2]; + uint8_t PatPos; + uint8_t Status=ON; + uint8_t transco[]={'a','b','c','d','e','f','g','h','i','j' ,'k','l','m','n','o','p','q','r','s','t' ,'u','v','w','x','y','z' ,'-',':','!','~','1','2','3','4','5','6' ,'7','8','9','0',' ',';'}; - long Where=PW_Start_Address; - long WholeSampleSize=0; - unsigned long i=0,j=0,k=0,l; + int32_t Where=PW_Start_Address; + int32_t WholeSampleSize=0; + uint32_t i=0,j=0,k=0,l; FILE *out; if ( Save_Status == BAD ) @@ -126,11 +126,11 @@ void Depack_KSM ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( &in_data[Where+2] , 13 , 1 , out ); fwrite ( Whatever , 7 , 1 , out ); /* fill-up there */ @@ -192,8 +192,8 @@ void Depack_KSM ( void ) /* use of htonl() suggested by Xigh !.*/ j/=2; l = htonl(j); - c1 = *((Uchar *)&l+2); - c2 = *((Uchar *)&l+3); + c1 = *((uint8_t *)&l+2); + c2 = *((uint8_t *)&l+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); } diff --git a/prowizard/rippers/MED-Octamed.c b/prowizard/rippers/MED-Octamed.c index 018a9458..ec2e15f4 100644 --- a/prowizard/rippers/MED-Octamed.c +++ b/prowizard/rippers/MED-Octamed.c @@ -6,7 +6,7 @@ /* valid for MMD0 & MMD1 */ -short testMMD0 ( void ) +int16_t testMMD0 ( void ) { PW_Start_Address = PW_i; if ( (PW_Start_Address + 52) > PW_in_size ) diff --git a/prowizard/rippers/MOD-compatible.c b/prowizard/rippers/MOD-compatible.c index 7fa7ee15..375d67be 100644 --- a/prowizard/rippers/MOD-compatible.c +++ b/prowizard/rippers/MOD-compatible.c @@ -12,7 +12,7 @@ #include "extern.h" -short testMOD ( int nbrchannels ) +int16_t testMOD ( int nbrchannels ) { /* test 1 */ if ( PW_i < 1080 ) diff --git a/prowizard/rippers/MasterCruncher30-Address.c b/prowizard/rippers/MasterCruncher30-Address.c index d74cfe84..6eef7001 100644 --- a/prowizard/rippers/MasterCruncher30-Address.c +++ b/prowizard/rippers/MasterCruncher30-Address.c @@ -4,7 +4,7 @@ #include "globals.h" #include "extern.h" -short testMasterCruncher30addr ( void ) +int16_t testMasterCruncher30addr ( void ) { PW_Start_Address = PW_i; @@ -82,7 +82,7 @@ void Rip_MasterCruncher30addr ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; + uint8_t * Amiga_EXE_Header_Block; OutputSize = PW_l; @@ -91,7 +91,7 @@ void Rip_MasterCruncher30addr ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; diff --git a/prowizard/rippers/MaxPacker12.c b/prowizard/rippers/MaxPacker12.c index 66a0e265..8a8b5da7 100644 --- a/prowizard/rippers/MaxPacker12.c +++ b/prowizard/rippers/MaxPacker12.c @@ -7,7 +7,7 @@ -short testMaxPacker12 ( void ) +int16_t testMaxPacker12 ( void ) { PW_Start_Address = PW_i; @@ -85,8 +85,8 @@ void Rip_MaxPacker12 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -95,7 +95,7 @@ void Rip_MaxPacker12 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -107,7 +107,7 @@ void Rip_MaxPacker12 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/MegaCruncher-Object.c b/prowizard/rippers/MegaCruncher-Object.c index 9ac929b6..c0640d58 100644 --- a/prowizard/rippers/MegaCruncher-Object.c +++ b/prowizard/rippers/MegaCruncher-Object.c @@ -5,7 +5,7 @@ #include "extern.h" -short testMegaCruncherObj ( void ) +int16_t testMegaCruncherObj ( void ) { PW_Start_Address = PW_i; @@ -81,8 +81,8 @@ void Rip_MegaCruncherObj ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -91,7 +91,7 @@ void Rip_MegaCruncherObj ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -105,7 +105,7 @@ void Rip_MegaCruncherObj ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 204; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); diff --git a/prowizard/rippers/MegaCruncher.c b/prowizard/rippers/MegaCruncher.c index cb32efdc..f91bd682 100644 --- a/prowizard/rippers/MegaCruncher.c +++ b/prowizard/rippers/MegaCruncher.c @@ -6,7 +6,7 @@ #include "extern.h" -short testMegaCruncher10 ( void ) +int16_t testMegaCruncher10 ( void ) { PW_Start_Address = PW_i; @@ -73,7 +73,7 @@ short testMegaCruncher10 ( void ) } -short testMegaCruncher12 ( void ) +int16_t testMegaCruncher12 ( void ) { PW_Start_Address = PW_i; @@ -145,8 +145,8 @@ void Rip_MegaCruncher ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -155,7 +155,7 @@ void Rip_MegaCruncher ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -169,7 +169,7 @@ void Rip_MegaCruncher ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 60; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); diff --git a/prowizard/rippers/ModuleProtector.c b/prowizard/rippers/ModuleProtector.c index 39e4589f..4b64cd5f 100644 --- a/prowizard/rippers/ModuleProtector.c +++ b/prowizard/rippers/ModuleProtector.c @@ -11,8 +11,10 @@ #include "extern.h" -short testMP_noID ( void ) +int16_t testMP_noID ( void ) { + /* TODO : test notes */ + /* test #1 */ if ( (PW_i < 3) || ((PW_i+375)>PW_in_size)) { @@ -34,7 +36,7 @@ short testMP_noID ( void ) if ( test_smps(PW_k, PW_m, PW_n, in_data[PW_Start_Address+3+8*PW_j], in_data[PW_Start_Address+2+8*PW_j] ) == BAD ) { - /* printf ( "#2 Start:%ld (siz:%ld)(lstart:%ld)(lsiz:%ld)\n", PW_Start_Address,PW_k,PW_m,PW_n );*/ + /*printf ( "#2 Start:%ld (siz:%ld)(lstart:%ld)(lsiz:%ld)\n", PW_Start_Address,PW_k,PW_m,PW_n );*/ return BAD; } } @@ -61,15 +63,14 @@ short testMP_noID ( void ) PW_k = in_data[PW_Start_Address+250+PW_j]; if ( in_data[PW_Start_Address+250+PW_j] > 0x7f ) { - /*printf( "#4 (Start:%ld)\n",PW_Start_Address );*/ +/*printf( "#4 (Start:%ld)\n",PW_Start_Address );*/ + return BAD; + } + if ( (PW_j > PW_l+10) && (in_data[PW_Start_Address+250+PW_j] != 0x00) ) + { +/*printf( "#4,1 (Start:%ld)(unclean patternlist at %ld:%x)\n",PW_Start_Address, 250+PW_j,in_data[PW_Start_Address+250+PW_j]);*/ return BAD; } - if ( PW_j > PW_l+3 ) - if (in_data[PW_Start_Address+250+PW_j] != 0x00) - { - /*printf( "#4,1 (Start:%ld)\n",PW_Start_Address );*/ - return BAD; - } } PW_k += 1; @@ -84,9 +85,14 @@ short testMP_noID ( void ) for ( PW_j=0 ; PW_j<((256*PW_k)-4) ; PW_j++ ) { PW_l = in_data[PW_Start_Address+378+PW_j*4+4]; - if ( PW_l > 19 ) /* 0x13 */ + if ( (PW_l&0xf0) > 0x10 ) { - /*printf( "#5 (Start:%ld)(byte0:%x)(Where:%ld)\n",PW_Start_Address,in_data[PW_Start_Address+378+PW_j*4],PW_Start_Address+378+PW_j*4 );*/ +/*printf( "#5 (Start:%ld)(byte0:%x)(Where:%ld)\n",PW_Start_Address,in_data[PW_Start_Address+378+PW_j*4],PW_Start_Address+378+PW_j*4 );*/ + return BAD; + } + if ( (PW_l&0x0f) > 0x03 ) + { +/*printf( "#5,0 (Start:%ld)(byte0:%x)(Where:%ld)\n",PW_Start_Address,in_data[PW_Start_Address+378+PW_j*4],PW_Start_Address+378+PW_j*4 );*/ return BAD; } PW_l = in_data[PW_Start_Address+378+PW_j*4]&0x0f; @@ -97,16 +103,19 @@ short testMP_noID ( void ) PW_m = 1; if ( PW_n != 0 ) PW_o = 1; - if ( (PW_l > 0) && (PW_l<0x71) ) + /*20100905 : more accurate test to lower fake finding */ + if ( (PW_l<0x100) && (PW_l != 0x00) && (PW_l != 0x71) &&(PW_l != 0x78) &&(PW_l != 0x7f) &&(PW_l != 0x87) &&(PW_l != 0x8f) && + (PW_l != 0x97) && (PW_l != 0xa0) &&(PW_l != 0xaa) &&(PW_l != 0xb4) &&(PW_l != 0xbe) &&(PW_l != 0xca) && + (PW_l != 0xd6) && (PW_l != 0xe2) && (PW_l != 0xf0) && (PW_l != 0xfe)) { - /*printf ( "#5,1 (Start:%ld)(where:%ld)(note:%ld)\n" , PW_Start_Address,PW_Start_Address+378+PW_j*4, PW_l );*/ +/*printf ( "#5,1 (Start:%ld)(where:%ld)(note:%lx)\n" , PW_Start_Address,PW_Start_Address+378+PW_j*4, PW_l );*/ return BAD; } } if ( (PW_m == 0) || (PW_o == 0) ) { /* no note ... odd */ - /*printf ("#5,2 (Start:%ld)\n",PW_Start_Address);*/ +/*printf ("#5,2 (Start:%ld)\n",PW_Start_Address);*/ return BAD; } @@ -118,7 +127,7 @@ short testMP_noID ( void ) +(((in_data[PW_Start_Address+6+PW_j*8]*256)+in_data[PW_Start_Address+7+PW_j*8])*2); if ( PW_l > (PW_k+2) ) { - /*printf( "#6 (Start:%ld)\n",PW_Start_Address );*/ +/*printf( "#6 (Start:%ld)\n",PW_Start_Address );*/ return BAD; } } @@ -127,7 +136,7 @@ short testMP_noID ( void ) } -short testMP_withID ( void ) +int16_t testMP_withID ( void ) { /* test #1 */ PW_Start_Address = PW_i; @@ -249,61 +258,68 @@ void Rip_MP_withID ( void ) * Last update: 28/11/99 * - removed open() (and other fread()s and the like) * - general Speed & Size Optmizings + * + * 20100119 : clean up - only one fwrite for header */ void Depack_MP ( void ) { - Uchar *Whatever; - long i=0; - long Total_Sample_Size=0; - long Where = PW_Start_Address; + uint8_t *Whatever; + int32_t i=0,j=0; + int32_t WholeSampleSize=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Whatever = (Uchar *) malloc (64); - BZERO ( Whatever , 64 ); + Whatever = (uint8_t *) malloc (1085); + BZERO ( Whatever , 1085 ); - /* title */ - fwrite ( Whatever , 20 , 1 , out ); + /* empty title */ if ( (in_data[Where] == 'T') && (in_data[Where+1] == 'R') && (in_data[Where+2] == 'K') && (in_data[Where+3] == '1') ) Where += 4; for ( i=0 ; i<31 ; i++ ) { - /*sample name*/ - fwrite ( Whatever , 22 , 1 , out ); - - Total_Sample_Size += (((in_data[Where]*256)+in_data[Where+1])*2); - fwrite ( &in_data[Where] , 8 , 1 , out ); + WholeSampleSize += (((in_data[Where]*256)+in_data[Where+1])*2); + Whatever[i*30 + 42] = in_data[Where]; + Whatever[i*30 + 43] = in_data[Where+1]; + Whatever[i*30 + 44] = in_data[Where+2]; + Whatever[i*30 + 45] = in_data[Where+3]; + Whatever[i*30 + 46] = in_data[Where+4]; + Whatever[i*30 + 47] = in_data[Where+5]; + Whatever[i*30 + 48] = in_data[Where+6]; + Whatever[i*30 + 49] = in_data[Where+7]; Where += 8; } - /*printf ( "Whole sample size : %ld\n" , Total_Sample_Size );*/ + /*printf ( "Whole sample size : %ld\n" , WholeSampleSize );*/ /* pattern table lenght & Ntk byte */ - fwrite ( &in_data[Where] , 2 , 1 , out ); - Where += 2; + Whatever[950] = in_data[Where++]; + Whatever[951] = in_data[Where++]; - Whatever[32] = 0x00; + j = 0; for ( i=0 ; i<128 ; i++ ) { - if ( in_data[Where+i] > Whatever[32] ) - Whatever[32] = in_data[Where+i]; + Whatever[952+i] = in_data[Where+i]; + if ( in_data[Where+i] > j ) + j = in_data[Where+i]; } - fwrite ( &in_data[Where] , 128 , 1 , out ); Where += 128; /*printf ( "Number of pattern : %d\n" , Max+1 );*/ - Whatever[0] = 'M'; - Whatever[1] = '.'; - Whatever[2] = 'K'; - Whatever[3] = '.'; - fwrite ( Whatever , 4 , 1 , out ); + Whatever[1080] = 'M'; + Whatever[1081] = '.'; + Whatever[1082] = 'K'; + Whatever[1083] = '.'; + + fwrite ( Whatever , 1084 , 1 , out ); + free ( Whatever ); /* bypass 4 unknown empty bytes */ if ( (in_data[Where]==0x00)&&(in_data[Where+1]==0x00)&&(in_data[Where+2]==0x00)&&(in_data[Where+3]==0x00) ) @@ -312,13 +328,12 @@ void Depack_MP ( void ) /*printf ( "! four empty bytes bypassed at the beginning of the pattern data\n" );*/ /* pattern data */ - i = (Whatever[32]+1)*1024; + i = (j+1)*1024; fwrite ( &in_data[Where] , i , 1 , out ); Where += i; - free ( Whatever ); /* sample data */ - fwrite ( &in_data[Where] , Total_Sample_Size , 1 , out ); + fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); Crap ( " Module Protector " , BAD , BAD , out ); diff --git a/prowizard/rippers/Mugician.c b/prowizard/rippers/Mugician.c index 954c396b..732d780c 100644 --- a/prowizard/rippers/Mugician.c +++ b/prowizard/rippers/Mugician.c @@ -4,7 +4,7 @@ #include "globals.h" #include "extern.h" -short testMUGICIAN ( void ) +int16_t testMUGICIAN ( void ) { if ( PW_i<2 ) { diff --git a/prowizard/rippers/NP3.c b/prowizard/rippers/NP3.c index d58d5728..5f30d6d5 100644 --- a/prowizard/rippers/NP3.c +++ b/prowizard/rippers/NP3.c @@ -5,7 +5,7 @@ #include "globals.h" #include "extern.h" -short testNoisepacker3 ( void ) +int16_t testNoisepacker3 ( void ) { if ( PW_i < 9 ) { @@ -210,30 +210,33 @@ void Rip_Noisepacker3 ( void ) */ void Depack_Noisepacker3 ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - Uchar Nbr_Pos; - Uchar Nbr_Smp; - Uchar poss[36][2]; - Uchar Pat_Max=0x00; - long Where=PW_Start_Address; - long WholeSampleSize=0; - long TrackDataSize; - long Track_Addresses[128][4]; - long Unknown1; - long i=0,j=0,k; - long Track_Data_Start_Address; - long SampleDataAddress=0; + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t Nbr_Pos; + uint8_t Nbr_Smp; + uint8_t poss[37][2]; + uint8_t Pat_Max=0x00; + int32_t Where=PW_Start_Address; + int32_t WholeSampleSize=0; + int32_t TrackDataSize; + int32_t Track_Addresses[128][4]; + int32_t Unknown1; + int32_t i=0,j=0,k; + int32_t Track_Data_Start_Address; + int32_t SampleDataAddress=0; FILE *out; +/* FILE *DEBUG;*/ if ( Save_Status == BAD ) return; +/* DEBUG = fopen ("debug.txt","w+b");*/ + fillPTKtable(poss); BZERO ( Track_Addresses , 128*4*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read number of sample */ @@ -241,7 +244,7 @@ void Depack_Noisepacker3 ( void ) /*printf ( "\nNumber of sample : %d (%x)\n" , Nbr_Smp , Nbr_Smp );*/ /* write title */ - Whatever = (Uchar *) malloc ( 1084 ); + Whatever = (uint8_t *) malloc ( 1084 ); BZERO ( Whatever , 1084 ); /*fwrite ( Whatever , 20 , 1 , out );*/ @@ -335,6 +338,7 @@ void Depack_Noisepacker3 ( void ) /* the track data now ... */ for ( i=0 ; i ",Whatever[k*16+j*4]);*/ Whatever[k*16+j*4] |= poss[c4][0]; +/*fprintf (DEBUG,"%2x (note:%2x)\n",Whatever[k*16+j*4],poss[c4][0]);*/ Whatever[k*16+j*4+1] = poss[c4][1]; if ( (c2&0x0f) == 0x08 ) c2 &= 0xf0; @@ -392,6 +400,7 @@ void Depack_Noisepacker3 ( void ) } Whatever[k*16+j*4+2] = c2; Whatever[k*16+j*4+3] = c3; +/*fprintf (DEBUG,"%2x-%2x-%2x\n",Whatever[k*16+j*4+1], Whatever[k*16+j*4+2], Whatever[k*16+j*4+3]);*/ if ( (c2&0x0f) == 0x0D ) k = 100; /* to leave the loop */ } @@ -411,6 +420,7 @@ void Depack_Noisepacker3 ( void ) Crap ( " NoisePacker v3 " , BAD , BAD , out ); +/* fclose (DEBUG);*/ fclose ( out ); printf ( "done\n" ); diff --git a/prowizard/rippers/Newtron.c b/prowizard/rippers/Newtron.c index 38ac7d4a..9a9a361a 100644 --- a/prowizard/rippers/Newtron.c +++ b/prowizard/rippers/Newtron.c @@ -10,7 +10,7 @@ #include "extern.h" -short testNewtron ( void ) +int16_t testNewtron ( void ) { /* test #1 */ if ( (PW_i < 7) || ((PW_i+373+1024+2)>PW_in_size)) @@ -134,19 +134,19 @@ void Rip_Newtron ( void ) void Depack_Newtron ( void ) { - Uchar *Whatever; - long i=0; - long Total_Sample_Size=0; - long Where = PW_Start_Address; + uint8_t *Whatever; + int32_t i=0; + int32_t Total_Sample_Size=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Whatever = (Uchar *) malloc (64); + Whatever = (uint8_t *) malloc (64); BZERO ( Whatever , 64 ); /* title */ diff --git a/prowizard/rippers/NewtronOld.c b/prowizard/rippers/NewtronOld.c index a8d7eef0..7393c97f 100644 --- a/prowizard/rippers/NewtronOld.c +++ b/prowizard/rippers/NewtronOld.c @@ -1,5 +1,44 @@ /* * newtronold.c ... 21 jan 2007 + + Newtron Old format +Created by ?!? +Analysed by Sylvain "Asle" Chipaux (asle@free.fr) + +Source : + - Little Joe & Newtron Musicdisk + + +Offset size (byte) Comment +------ ----------- ------- + + 0 2 patternlist address (-8) [A] + 2 2 size of patternlist [B] + 4 4 ? + + ************************************** + * the following is repeated [A]/8 times * + * with 8 bytes description for 1 smp * +****************************************************** + * + 8 2 Sample Size / 2 * + 10 1 Finetune (0 -> F) * + 11 1 Volume (0 - 40h) * + 12 2 Loop Start / 2 * + 14 2 Loop Size / 2 * + * +****************************************************** + +[A] [B] Pattern table + +[A]+[B] ? Pattern datas + (Pattern datas are stored like Ptk) + (one pattern is 1024 ($400) bytes). + + + Follow the Sample datas stored like ProTracker. +Nothing is packed.. + */ /* testNewtronOld() */ /* Rip_NewtronOld() */ @@ -9,8 +48,10 @@ #include "globals.h" #include "extern.h" - -short testNewtronOld ( void ) +/* + * additional tests - 20100207 +*/ +int16_t testNewtronOld ( void ) { /* test #1 */ if ( (PW_i < 11) || ((PW_i+6+1+1024+2)>PW_in_size)) @@ -25,10 +66,10 @@ short testNewtronOld ( void ) return BAD; } - /* test #2 */ PW_l=(in_data[PW_Start_Address]*256)+in_data[PW_Start_Address+1]+8; - PW_l = (PW_l/8)-1; + /* test #2 samples */ PW_WholeSampleSize = 0; + PW_l = (PW_l/8)-1; for ( PW_j=0 ; PW_j 0x7f) || (PW_l == 0x00) ) { @@ -102,12 +143,18 @@ short testNewtronOld ( void ) /* PW_WholeSampleSize is the whole sample size */ PW_k += PW_l; /* PW_k is now the pat data addy */ + /*printf ( "\nPW_k:%lx\n",PW_k );*/ for ( PW_j=0 ; PW_j<(256*PW_m) ; PW_j++ ) { - PW_l = in_data[PW_Start_Address+PW_k+PW_j*4]; - if ( PW_l > 19 ) /* 0x13 */ + unsigned char c = in_data[PW_Start_Address+PW_k+(PW_j*4)]; + if ((c&0x0f) > 0x03) + { + /*printf( "#7,1 (start:%ld)(where:%lx)(c:%x)\n",PW_Start_Address,PW_Start_Address+PW_k+(PW_j*4),c );*/ + return BAD; + } + if ((c&0xf0) > 0x10) { - /*printf( "#7,0\n" );*/ + /*printf( "#7,2 (start:%ld)(where:%lx)(c:%x)\n",PW_Start_Address,PW_Start_Address+PW_k+(PW_j*4),c );*/ return BAD; } PW_n = in_data[PW_Start_Address+PW_k+PW_j*4]&0x0f; @@ -145,30 +192,30 @@ void Rip_NewtronOld ( void ) * * Converts Newtron Old packed MODs back to PTK MODs * + * clean up - 20100207 */ void Depack_NewtronOld ( void ) { - Uchar *Whatever; - long i=0,j=0; - long Total_Sample_Size=0; - long Where = PW_Start_Address; - long patlistaddy=0; - Uchar patsize = 0; - Uchar max=0x00; + uint8_t *Whatever; + int32_t i=0,j=0; + int32_t Total_Sample_Size=0; + int32_t Where = PW_Start_Address; + int32_t patlistaddy=0; + uint8_t patsize = 0; + uint8_t max=0x00; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Whatever = (Uchar *) malloc (130); - BZERO ( Whatever , 130 ); + Whatever = (uint8_t *) malloc (1085); + BZERO ( Whatever , 1085 ); /* title */ - fwrite ( Whatever , 20 , 1 , out ); /* size of header */ patlistaddy = (in_data[Where]*256)+in_data[Where+1]+8; @@ -179,41 +226,44 @@ void Depack_NewtronOld ( void ) for ( i=0 ; i max ) max = in_data[Where+i]; - Whatever[i] = in_data[Where+i]; + Whatever[952+i] = in_data[Where+i]; } - fwrite ( &Whatever[0] , 128 , 1 , out ); Where += patsize; /*printf ( "Number of pattern : %d\n" , Max+1 );*/ - Whatever[0] = 'M'; - Whatever[1] = '.'; - Whatever[2] = 'K'; - Whatever[3] = '.'; - fwrite ( Whatever , 4 , 1 , out ); + Whatever[1080] = 'M'; + Whatever[1081] = '.'; + Whatever[1082] = 'K'; + Whatever[1083] = '.'; + fwrite ( Whatever , 1084 , 1 , out ); /* pattern data */ i = (max+1)*1024; diff --git a/prowizard/rippers/NoiseFromHeaven.c b/prowizard/rippers/NoiseFromHeaven.c index 15d471aa..84359dcb 100644 --- a/prowizard/rippers/NoiseFromHeaven.c +++ b/prowizard/rippers/NoiseFromHeaven.c @@ -8,7 +8,7 @@ /* Noise from Heaven Chipdisk (21 oct 2001) by Iris */ -short testNFH ( void ) +int16_t testNFH ( void ) { /* test 1 */ if ( PW_i < 1080 ) @@ -119,12 +119,12 @@ void Rip_NFH ( void ) */ void Depack_NFH ( void ) { - Uchar *Whatever; - Uchar poss[37][2]; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j=0; - long Where=PW_Start_Address; + uint8_t *Whatever; + uint8_t poss[37][2]; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where=PW_Start_Address; FILE *out; fillPTKtable(poss); @@ -132,7 +132,7 @@ void Depack_NFH ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read and write whole header */ @@ -148,7 +148,7 @@ void Depack_NFH ( void ) Where += 952 /* after size of pattern list .. before pattern list itself */; /* write ID */ - Whatever = (Uchar *) malloc (4); + Whatever = (uint8_t *) malloc (4); Whatever[0] = 'M'; Whatever[1] = '.'; Whatever[2] = 'K'; diff --git a/prowizard/rippers/NoisePacker1.c b/prowizard/rippers/NoisePacker1.c index 5a3396b8..1518eb40 100644 --- a/prowizard/rippers/NoisePacker1.c +++ b/prowizard/rippers/NoisePacker1.c @@ -6,7 +6,7 @@ #include "extern.h" -short testNoisepacker1 ( void ) +int16_t testNoisepacker1 ( void ) { if ( PW_i < 15 ) { @@ -170,19 +170,19 @@ void Rip_Noisepacker1 ( void ) */ void Depack_Noisepacker1 ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - Uchar Nbr_Pos; - Uchar poss[37][2]; - Uchar Pat_Max=0x00; - long Max_Add=0; - long WholeSampleSize=0; - long TrackDataSize; - long Track_Addresses[128][4]; - long Unknown1; - long i=0,j=0,k; - long Track_Data_Start_Address; - long Where = PW_Start_Address; + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t Nbr_Pos; + uint8_t poss[37][2]; + uint8_t Pat_Max=0x00; + int32_t Max_Add=0; + int32_t WholeSampleSize=0; + int32_t TrackDataSize; + int32_t Track_Addresses[128][4]; + int32_t Unknown1; + int32_t i=0,j=0,k; + int32_t Track_Data_Start_Address; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -192,11 +192,11 @@ void Depack_Noisepacker1 ( void ) BZERO ( Track_Addresses , 128*4*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read number of sample */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); Whatever[128] = ((in_data[Where]<<4)&0xf0) | ((in_data[Where+1]>>4)&0x0f); Where += 3; diff --git a/prowizard/rippers/NoisePacker2.c b/prowizard/rippers/NoisePacker2.c index 3243d04d..37b34f9b 100644 --- a/prowizard/rippers/NoisePacker2.c +++ b/prowizard/rippers/NoisePacker2.c @@ -5,7 +5,7 @@ #include "globals.h" #include "extern.h" -short testNoisepacker2 ( void ) +int16_t testNoisepacker2 ( void ) { if ( PW_i < 15 ) { @@ -88,7 +88,7 @@ short testNoisepacker2 ( void ) /* PW_l is now the size of the header 'til the end of sample descriptions */ if ( PW_l+PW_Start_Address > PW_in_size ) { -/* printf ( "#5,4 Start:%ld\n", PW_Start_Address);*/ +/*printf ( "#5,4 Start:%ld\n", PW_Start_Address);*/ return BAD; } @@ -114,7 +114,7 @@ short testNoisepacker2 ( void ) /* PW_j is now available for use :) */ if ( PW_l+PW_Start_Address>PW_in_size) { -/* printf ( "#6,1 Start:%ld\n", PW_Start_Address);*/ +/*printf ( "#6,1 Start:%ld\n", PW_Start_Address);*/ return BAD; } @@ -132,7 +132,7 @@ short testNoisepacker2 ( void ) { if ( PW_Start_Address + PW_l + PW_m > PW_in_size ) { - /* printf ( "#8,0 Start:%ld\n", PW_Start_Address);*/ + /*printf ( "#8,0 Start:%ld\n", PW_Start_Address);*/ return BAD; } if ( in_data[PW_Start_Address+PW_l+PW_m] > 0x49 ) @@ -143,7 +143,7 @@ short testNoisepacker2 ( void ) if ( (((in_data[PW_Start_Address+PW_l+PW_m]<<4)&0x10)| ((in_data[PW_Start_Address+PW_l+PW_m+1]>>4)&0x0f)) > PW_j ) { -/*printf ( "#8,1 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)(PW_j:%ld)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m,PW_j );*/ +/*printf ( "NP2#8,1 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)(PW_j:%ld)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m,PW_j );*/ return BAD; } PW_n = (in_data[PW_Start_Address+PW_l+PW_m+1]&0x0F); @@ -187,20 +187,20 @@ void Rip_Noisepacker2 ( void ) */ void Depack_Noisepacker2 ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - Uchar Nbr_Pos; - Uchar Nbr_Smp; - Uchar poss[37][2]; - Uchar Pat_Max=0x00; - long Where=PW_Start_Address; - long Max_Add=0; - long WholeSampleSize=0; - long TrackDataSize; - long Track_Addresses[128][4]; - long Unknown1; - long i=0,j=0,k; - long Track_Data_Start_Address; + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t Nbr_Pos; + uint8_t Nbr_Smp; + uint8_t poss[37][2]; + uint8_t Pat_Max=0x00; + int32_t Where=PW_Start_Address; + int32_t Max_Add=0; + int32_t WholeSampleSize=0; + int32_t TrackDataSize; + int32_t Track_Addresses[128][4]; + int32_t Unknown1; + int32_t i=0,j=0,k; + int32_t Track_Data_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -210,7 +210,7 @@ void Depack_Noisepacker2 ( void ) BZERO ( Track_Addresses , 128*4*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read number of sample */ @@ -218,7 +218,7 @@ void Depack_Noisepacker2 ( void ) /*printf ( "Number of sample : %d (%x)\n" , Nbr_Smp , Nbr_Smp );*/ /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -271,6 +271,8 @@ void Depack_Noisepacker2 ( void ) /* read pattern table */ Pat_Max = 0x00; + /* 20100823 - BZERO ... */ + BZERO (Whatever,1024); for ( i=0 ; i PW_in_size) - { - /*printf ("[1] PW_Start_Address : %ld\n", PW_Start_Address);*/ - return BAD; - } - PW_j = (in_data[PW_Start_Address+20]*256)+in_data[PW_Start_Address+21] + 4; - if ((PW_i + PW_j + 4) > PW_in_size) - { - /*printf ("[2] PW_Start_Address : %ld\n", PW_Start_Address);*/ - return BAD; - } - PW_k = (in_data[PW_Start_Address+28]*256)+in_data[PW_Start_Address+29] + PW_j + 4; - if ((PW_i + PW_k + 2) > PW_in_size) - { - /*printf ("[3] PW_Start_Address : %ld\n", PW_Start_Address);*/ - return BAD; - } - /* PW_j is on "BODY" tag */ - /* PW_k is on "SAMP" tag */ - - /* test #2 let's verify */ - if ( (in_data[PW_Start_Address+PW_j] != 'B') && - (in_data[PW_Start_Address+PW_j+1] != 'O') && - (in_data[PW_Start_Address+PW_j+2] != 'D') && - (in_data[PW_Start_Address+PW_j+3] != 'Y')) - { - /*printf ("[4] PW_Start_Address : %ld\n", PW_Start_Address);*/ - return BAD; - } - if ( (in_data[PW_Start_Address+PW_k] != 'S') && - (in_data[PW_Start_Address+PW_k+1] != 'A') && - (in_data[PW_Start_Address+PW_k+2] != 'M') && - (in_data[PW_Start_Address+PW_k+3] != 'P')) - { - /*printf ("[5] (start)%ld, (BODY)%lx, (at)%lx\n", PW_Start_Address,PW_j,PW_k);*/ - return BAD; - } - - /* no much but should be enough :) */ - return GOOD; -} - - -void Rip_NovoTrade ( void ) -{ - /* get nbr sample */ - PW_j = (in_data[PW_Start_Address+22]*256)+in_data[PW_Start_Address+23]; - /* get BODY addy */ - PW_m = (in_data[PW_Start_Address+20]*256)+in_data[PW_Start_Address+21] + 4; - /* get SAMP addy */ - PW_k = (in_data[PW_Start_Address+28]*256)+in_data[PW_Start_Address+29] + PW_m + 4; - PW_WholeSampleSize = 0; - for ( PW_l=0 ; PW_l PW_in_size) + { + /*printf ("[1] PW_Start_Address : %ld\n", PW_Start_Address);*/ + return BAD; + } + PW_j = (in_data[PW_Start_Address+20]*256)+in_data[PW_Start_Address+21] + 4; + if ((PW_i + PW_j + 4) > PW_in_size) + { + /*printf ("[2] PW_Start_Address : %ld\n", PW_Start_Address);*/ + return BAD; + } + PW_k = (in_data[PW_Start_Address+28]*256)+in_data[PW_Start_Address+29] + PW_j + 4; + if ((PW_i + PW_k + 2) > PW_in_size) + { + /*printf ("[3] PW_Start_Address : %ld\n", PW_Start_Address);*/ + return BAD; + } + /* PW_j is on "BODY" tag */ + /* PW_k is on "SAMP" tag */ + + /* test #2 let's verify */ + if ( (in_data[PW_Start_Address+PW_j] != 'B') && + (in_data[PW_Start_Address+PW_j+1] != 'O') && + (in_data[PW_Start_Address+PW_j+2] != 'D') && + (in_data[PW_Start_Address+PW_j+3] != 'Y')) + { + /*printf ("[4] PW_Start_Address : %ld\n", PW_Start_Address);*/ + return BAD; + } + if ( (in_data[PW_Start_Address+PW_k] != 'S') && + (in_data[PW_Start_Address+PW_k+1] != 'A') && + (in_data[PW_Start_Address+PW_k+2] != 'M') && + (in_data[PW_Start_Address+PW_k+3] != 'P')) + { + /*printf ("[5] (start)%ld, (BODY)%lx, (at)%lx\n", PW_Start_Address,PW_j,PW_k);*/ + return BAD; + } + + /* no much but should be enough :) */ + return GOOD; +} + + +void Rip_NovoTrade ( void ) +{ + /* get nbr sample */ + PW_j = (in_data[PW_Start_Address+22]*256)+in_data[PW_Start_Address+23]; + /* get BODY addy */ + PW_m = (in_data[PW_Start_Address+20]*256)+in_data[PW_Start_Address+21] + 4; + /* get SAMP addy */ + PW_k = (in_data[PW_Start_Address+28]*256)+in_data[PW_Start_Address+29] + PW_m + 4; + PW_WholeSampleSize = 0; + for ( PW_l=0 ; PW_l0x0F) + { +/*fprintf(DEBUG,"[%-2ld] %2x-%2x <-- unknown case\n",k,in_data[Where],in_data[Where+1],in_data[Where+1]+1);*/ + /* bypass notes .. guess */ + Where += 2; + continue; + } +/*fprintf(DEBUG,"[%-2ld] %2x-%2x\n",k,in_data[Where],in_data[Where+1]);*/ + + Where += 2; + if ((c1 & 0x01) == 0x01) + { + Whatever[k*16] = in_data[Where]; + Whatever[k*16+1] = in_data[Where+1]; + Whatever[k*16+2] = in_data[Where+2]; + Whatever[k*16+3] = in_data[Where+3]; + Where += 4; + } + if ((c1 & 0x02) == 0x02) + { + Whatever[k*16+4] = in_data[Where]; + Whatever[k*16+5] = in_data[Where+1]; + Whatever[k*16+6] = in_data[Where+2]; + Whatever[k*16+7] = in_data[Where+3]; + Where += 4; + } + if ((c1 & 0x04) == 0x04) + { + Whatever[k*16+8] = in_data[Where]; + Whatever[k*16+9] = in_data[Where+1]; + Whatever[k*16+10] = in_data[Where+2]; + Whatever[k*16+11] = in_data[Where+3]; + Where += 4; + } + if ((c1 & 0x08) == 0x08) + { + Whatever[k*16+12] = in_data[Where]; + Whatever[k*16+13] = in_data[Where+1]; + Whatever[k*16+14] = in_data[Where+2]; + Whatever[k*16+15] = in_data[Where+3]; + Where += 4; + } +/*fprintf(DEBUG,"[->] %2x%2x%2x%2x - %2x%2x%2x%2x - %2x%2x%2x%2x - %2x%2x%2x%2x\n" + ,Whatever[k*16],Whatever[k*16+1],Whatever[k*16+2],Whatever[k*16+3] + ,Whatever[k*16+4],Whatever[k*16+5],Whatever[k*16+6],Whatever[k*16+7] + ,Whatever[k*16+8],Whatever[k*16+9],Whatever[k*16+10],Whatever[k*16+11] + ,Whatever[k*16+12],Whatever[k*16+13],Whatever[k*16+14],Whatever[k*16+15] + );*/ + } +/*fprintf(DEBUG,"\nEND OF LOOP ?!?\n");*/ + fwrite ( Whatever , 1024 , 1 , out ); + } + free ( Whatever ); + + + Where = PW_Start_Address + SAMPaddy + 4; + fwrite ( &in_data[Where] , Total_Sample_Size , 1 , out ); + + Crap ( " NovoTrade Packer " , BAD , BAD , out ); + + /* fflush ( DEBUG ); + fclose ( DEBUG );*/ + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ + +} diff --git a/prowizard/rippers/Perfsong.c b/prowizard/rippers/Perfsong.c new file mode 100644 index 00000000..053fe609 --- /dev/null +++ b/prowizard/rippers/Perfsong.c @@ -0,0 +1,342 @@ +/* testPERFSONG */ +/* Rip_PERFSONG */ +/* Depack_PERFSONG */ + +#include "globals.h" +#include "extern.h" + + +int16_t testPERFSONG() +{ + /* test 1 */ + PW_Start_Address = PW_i; + if ((PW_in_size - PW_Start_Address) < 12) + { + return BAD; + } + + /* whole file size */ + PW_j = (in_data[PW_Start_Address+8]*256*256*256) + +(in_data[PW_Start_Address+9]*256*256) + +(in_data[PW_Start_Address+10]*256) + +in_data[PW_Start_Address+11] + 12; + + /*test 2*/ + /* too big a file ? or too small ? */ + if (((PW_Start_Address + PW_j) > PW_in_size) || (PW_j<802)) + { + return BAD; + } + /* PW_j is the whole packed file size */ + + + + return GOOD; +} + + + + +void Rip_PERFSONG ( void ) +{ + /* PW_j is the whole file size */ + + OutputSize = PW_j; + + CONVERT = GOOD; + Save_Rip ( "Perfect Song module", PerfSong ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + + + +/* + * PERFSONG.c 20100120 (c) Asle / ReDoX + * + * Perfect Song Player to Protracker. + * format/replayer by Seg/Darkness (~1997) + * +*/ + +void Depack_PERFSONG ( void ) +{ + uint8_t c1=0x00,c2=0x00; + uint8_t poss[37][2]; + uint8_t Max=0x00; + uint8_t Note,Smp,Fx,FxVal; + uint8_t *Whatever; + int32_t i=0,j=0,k=0,l,z; + int32_t Where=PW_Start_Address; + int32_t SmpAddresses[31]; + int32_t SmpSizes[31]; + int32_t BNRFullSize=0; + FILE *out; + + fillPTKtable(poss); + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + Whatever = (uint8_t *) malloc (1085); + BZERO ( Whatever , 1085 ); + + /* retrieve full size to fetch sample text at the end */ + BNRFullSize = (in_data[Where+8]*256*256*256)+ + (in_data[Where+1+8]*256*256)+ + (in_data[Where+2+8]*256)+ + in_data[Where+3+8] + 12; + BNRFullSize -= 702; /* to reach the beginning of the text area */ + printf ( "BNRFullSize at : %d\n",BNRFullSize ); + + /* get title */ + for (l=0; l<20 ; l++) + Whatever[l] = in_data[Where+BNRFullSize+l]; + BNRFullSize += 0x14; + + /* 31 samples */ + Where += 12; /* points on first psmp desc */ + for ( i=0 ; i<31 ; i++ ) + { + /* read sample address */ + SmpAddresses[i]=(in_data[Where]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]; + + /* read loop start address */ + j=(in_data[Where+4]*256*256*256)+ + (in_data[Where+5]*256*256)+ + (in_data[Where+6]*256)+ + in_data[Where+7]; + /* get smptext */ + for (l=0; l<21 ; l++) + Whatever[i*30+20+l] = in_data[PW_Start_Address+BNRFullSize+l]; + BNRFullSize += 0x16; + /* read & write sample size */ + Whatever[i*30+42] = in_data[Where+8]; + Whatever[i*30+43] = in_data[Where+9]; + SmpSizes[i] = (((Whatever[i*30+42]*256)+Whatever[i*30+43])*2); + Whatever[i*30+44] = in_data[Where+12]; /* fine ? */ + Whatever[i*30+45] = in_data[Where+13]; /* vol */ + Whatever[i*30+48] = in_data[Where+10]; /*replen*/ + Whatever[i*30+49] = in_data[Where+11]; + + /* calculate loop start value */ + k = (j - SmpAddresses[i])/2; + + /* write loop start */ + /* use of htonl() suggested by Xigh !.*/ + z = htonl(k); + Whatever[i*30+46] = *((uint8_t *)&z+2); + Whatever[i*30+47] = *((uint8_t *)&z+3); + + Where += 16; + } + + /* patternlist size */ + Whatever[950] = in_data[Where+1]+1; + Whatever[951] = 0x7f; + Where += 2; + + /* pattern table */ + Max = 0x00; + for ( c1=0 ; c1<128 ; c1++ ) + { + j=(in_data[Where]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]; + Whatever[952+c1] = (j-0x3fe)/1024; + if ( Whatever[952+c1] > Max ) + Max = Whatever[952+c1]; + Where += 4; + } + Max += 1; + /*printf ( "number of pattern : %d\n" , Max );*/ + + /* write Protracker's ID */ + Whatever[1080] = 'M'; + Whatever[1081] = '.'; + Whatever[1082] = 'K'; + Whatever[1083] = '.'; + + fwrite ( Whatever , 1084 , 1 , out ); + + /* pattern data */ + /* Where is already pointing on the 1st note of the 1st pattern */ + for ( i=0 ; i> 4)&0x0f; + FxVal = c1|c2; + break; + + case 0x28: /* vibrato + volume slide DOWN */ + Fx = 0x06; + break; + + case 0x2c: /* vibrato + volume slide DOWN */ + Fx = 0x06; + break; + + case 0x30: /* tremolo */ + Fx = 0x07; + break; + + case 0x38: /* sample offset */ + Fx = 0x09; + break; + + case 0x3C: /* volume slide up */ + Fx = 0x0A; + c1 = (FxVal << 4)&0xf0; + c2 = (FxVal >> 4)&0x0f; + FxVal = c1|c2; + break; + + case 0x40: /* volume slide down */ + Fx = 0x0A; + break; + + case 0x44: /* position jump */ + Fx = 0x0B; + break; + + case 0x48: /* set volume */ + Fx = 0x0C; + break; + + case 0x4C: /* pattern break */ + Fx = 0x0D; + break; + + case 0x50: /* set speed */ + Fx = 0x0F; + break; + + case 0x58: /* set filter */ + Fx = 0x0E; + FxVal = 0x01; + break; + + case 0x5C: /* fine slide up */ + Fx = 0x0E; + FxVal |= 0x10; + break; + + case 0x60: /* fine slide down */ + Fx = 0x0E; + FxVal |= 0x20; + break; + + case 0x74: /* fine volume slide up */ + Fx = 0x0E; + FxVal |= 0xa0; + break; + + case 0x78: /* fine volume slide down */ + Fx = 0x0E; + FxVal |= 0xb0; + break; + + case 0x7c: /* pattern delay */ + Fx = 0x0E; + FxVal |= 0xe0; + break; + + default: + printf ( "%x : at %d (out:%ld)\n" , Fx , Where+(j*4),ftell(out) ); + Fx = 0x00; + break; + } + Note /= 2; + c1 = (Smp>>4) & 0x0f; + c2 = (Smp<<4) & 0xf0; + Smp = c1 | c2; + Whatever[j*4] = (Smp & 0xf0); + Whatever[j*4] |= poss[(Note)][0]; + Whatever[j*4+1] = poss[(Note)][1]; + Whatever[j*4+2] = ((Smp<<4)&0xf0); + Whatever[j*4+2] |= Fx; + Whatever[j*4+3] = FxVal; + } + Where += 1024; + fwrite ( Whatever , 1024 , 1 , out ); + printf ( "pattern %d written (Where : %d)\n" , i ,Where); + } + free ( Whatever ); + + /* sample data */ + for (i=0; i<31; i++) + { + if ( SmpSizes[i] == 0 ) + continue; + fwrite ( &in_data[PW_Start_Address + SmpAddresses[i]] , SmpSizes[i] , 1 , out ); + } + + /* no crap as it destroys sample text */ + /*Crap ( " PERFSONG Packer " , BAD , BAD , out );*/ + + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ +} diff --git a/prowizard/rippers/PhaPacker.c b/prowizard/rippers/PhaPacker.c index 6c3e0bcc..661a2651 100644 --- a/prowizard/rippers/PhaPacker.c +++ b/prowizard/rippers/PhaPacker.c @@ -7,7 +7,7 @@ #include "extern.h" -short testPHA ( void ) +int16_t testPHA ( void ) { /* test #1 */ if ( PW_i < 11 ) @@ -141,23 +141,23 @@ void Rip_PHA ( void ) */ void Depack_PHA ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00; - Uchar poss[37][2]; - Uchar *Whole_Pattern_Data; - Uchar *Pattern; - Uchar *Whatever; - Uchar Old_Note_Value[4][4]; - Uchar Note,Smp,Fx,FxVal; - Uchar PatMax=0x00; - long MyPatList[128]; - long Pats_Address[128]; - long i=0,j=0,k=0; - long Start_Pat_Address=9999999l; - long Whole_Pattern_Data_Size; - long Whole_Sample_Size=0; - long Sample_Data_Address; - long Where = PW_Start_Address; - short Old_cpt[4]; + uint8_t c1=0x00,c2=0x00,c3=0x00; + uint8_t poss[37][2]; + uint8_t *Whole_Pattern_Data; + uint8_t *Pattern; + uint8_t *Whatever; + uint8_t Old_Note_Value[4][4]; + uint8_t Note,Smp,Fx,FxVal; + uint8_t PatMax=0x00; + int32_t MyPatList[128]; + int32_t Pats_Address[128]; + int32_t i=0,j=0,k=0; + int32_t Start_Pat_Address=9999999l; + int32_t Whole_Pattern_Data_Size; + int32_t Whole_Sample_Size=0; + int32_t Sample_Data_Address; + int32_t Where = PW_Start_Address; + int16_t Old_cpt[4]; FILE *out;/*,*info;*/ if ( Save_Status == BAD ) @@ -168,16 +168,16 @@ void Depack_PHA ( void ) BZERO ( Pats_Address , 128*4 ); BZERO ( Old_Note_Value , 4*4 ); BZERO ( Old_cpt , 4*2 ); - BZERO ( MyPatList, 128*sizeof(long)); + BZERO ( MyPatList, 128*sizeof(int32_t )); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* info = fopen ( "info", "w+b");*/ for ( i=0 ; i<20 ; i++ ) /* title */ fwrite ( &c1 , 1 , 1 , out ); - Whatever = (Uchar *) malloc (64); + Whatever = (uint8_t *) malloc (64); for ( i=0 ; i<31 ; i++ ) { BZERO ( Whatever, 64 ); @@ -190,7 +190,7 @@ void Depack_PHA ( void ) Whole_Sample_Size += (((in_data[Where]*256)+in_data[Where+1])*2); /* finetune */ - c1 = ( Uchar ) (((in_data[Where+12]*256)+in_data[Where+13])/0x48); + c1 = ( uint8_t ) (((in_data[Where+12]*256)+in_data[Where+13])/0x48); fwrite ( &c1 , 1 , 1 , out ); /* volume */ @@ -223,11 +223,11 @@ void Depack_PHA ( void ) /* pattern datas */ /* read ALL pattern data */ Whole_Pattern_Data_Size = OutputSize - Start_Pat_Address; - Whole_Pattern_Data = (Uchar *) malloc ( Whole_Pattern_Data_Size ); + Whole_Pattern_Data = (uint8_t *) malloc ( Whole_Pattern_Data_Size ); Where = Start_Pat_Address + PW_Start_Address; for (i=0;iPW_in_size)) @@ -117,12 +117,12 @@ void Rip_Polka ( void ) void Depack_Polka ( void ) { - Uchar poss[37][2]; - Uchar c1=0x00,c2=0x00; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j; - long Where = PW_Start_Address; + uint8_t poss[37][2]; + uint8_t c1=0x00,c2=0x00; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j; + int32_t Where = PW_Start_Address; FILE *out; unsigned char Whatever[4]; @@ -131,7 +131,7 @@ void Depack_Polka ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* takes care of header */ diff --git a/prowizard/rippers/PowerMusic.c b/prowizard/rippers/PowerMusic.c index 1da5f637..5ba981eb 100644 --- a/prowizard/rippers/PowerMusic.c +++ b/prowizard/rippers/PowerMusic.c @@ -10,7 +10,7 @@ /* Power Music */ -short testPM ( void ) +int16_t testPM ( void ) { /* test 1 */ if ( PW_i < 1080 ) @@ -80,17 +80,17 @@ void Rip_PM ( void ) void Depack_PM ( void ) { signed char *Smp_Data; - Uchar c1=0x00,c2=0x00; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j; - long Where = PW_Start_Address; + uint8_t c1=0x00,c2=0x00; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* write whole header */ diff --git a/prowizard/rippers/PowerPacker23.c b/prowizard/rippers/PowerPacker23.c index 337ce95a..db80ede4 100644 --- a/prowizard/rippers/PowerPacker23.c +++ b/prowizard/rippers/PowerPacker23.c @@ -5,7 +5,7 @@ #include "extern.h" -short testPowerpacker23 ( void ) +int16_t testPowerpacker23 ( void ) { PW_Start_Address = PW_i; @@ -81,7 +81,7 @@ void Rip_Powerpacker23 ( void ) /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; + uint8_t * Amiga_EXE_Header_Block; OutputSize = PW_l; @@ -90,7 +90,7 @@ void Rip_Powerpacker23 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; diff --git a/prowizard/rippers/PowerPacker30.c b/prowizard/rippers/PowerPacker30.c index 3adf3d71..16317472 100644 --- a/prowizard/rippers/PowerPacker30.c +++ b/prowizard/rippers/PowerPacker30.c @@ -5,7 +5,7 @@ #include "extern.h" -short testPowerpacker30 ( void ) +int16_t testPowerpacker30 ( void ) { PW_Start_Address = PW_i; @@ -80,7 +80,7 @@ void Rip_Powerpacker30 ( void ) /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; + uint8_t * Amiga_EXE_Header_Block; OutputSize = PW_l; @@ -89,7 +89,7 @@ void Rip_Powerpacker30 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; diff --git a/prowizard/rippers/PowerPacker40-library.c b/prowizard/rippers/PowerPacker40-library.c index 8732e957..e510aa3b 100644 --- a/prowizard/rippers/PowerPacker40-library.c +++ b/prowizard/rippers/PowerPacker40-library.c @@ -5,7 +5,7 @@ #include "extern.h" -short testPowerpacker4lib ( void ) +int16_t testPowerpacker4lib ( void ) { PW_Start_Address = PW_i; @@ -80,8 +80,8 @@ void Rip_Powerpacker4lib ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -90,7 +90,7 @@ void Rip_Powerpacker4lib ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -104,7 +104,7 @@ void Rip_Powerpacker4lib ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 60; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); diff --git a/prowizard/rippers/PowerPacker40.c b/prowizard/rippers/PowerPacker40.c index 4aab0abf..dec03789 100644 --- a/prowizard/rippers/PowerPacker40.c +++ b/prowizard/rippers/PowerPacker40.c @@ -5,7 +5,7 @@ #include "extern.h" -short testPowerpacker40 ( void ) +int16_t testPowerpacker40 ( void ) { PW_Start_Address = PW_i; @@ -93,7 +93,7 @@ void Rip_Powerpacker40 ( void ) /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; + uint8_t * Amiga_EXE_Header_Block; OutputSize = PW_l; @@ -102,7 +102,7 @@ void Rip_Powerpacker40 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; diff --git a/prowizard/rippers/ProPacker10.c b/prowizard/rippers/ProPacker10.c index 6d2bfc77..dda7d838 100644 --- a/prowizard/rippers/ProPacker10.c +++ b/prowizard/rippers/ProPacker10.c @@ -6,8 +6,11 @@ #include "globals.h" #include "extern.h" - -short testPP10 ( void ) +/* + * 20100902 : better note test to lower the number of fake found + * 20100902 : test if patternlist ends with 0x00 values +*/ +int16_t testPP10 ( void ) { /* test #1 */ if ( (PW_i < 3) || ((PW_i+246)>=PW_in_size)) @@ -25,6 +28,7 @@ short testPP10 ( void ) } /* test #2 */ + /* various test about sample headers */ PW_WholeSampleSize = 0; for ( PW_j=0 ; PW_j<31 ; PW_j++ ) { @@ -79,6 +83,7 @@ short testPP10 ( void ) } } + /* test if sample data is too small */ if ( PW_WholeSampleSize <= 2 ) { /*printf ( "#2,4 (start:%ld)\n" , PW_Start_Address );*/ @@ -87,25 +92,37 @@ short testPP10 ( void ) /* PW_WholeSampleSize = whole sample size */ /* test #3 about size of pattern list */ - PW_l = in_data[PW_Start_Address+248]; - if ( (PW_l > 127) || (PW_l==0) ) + PW_m = in_data[PW_Start_Address+248]; + if ( (PW_m > 127) || (PW_m==0) ) { /*printf ( "#3 (start:%ld)\n" , PW_Start_Address );*/ return BAD; } /* get the highest track value */ + /* PW_m is the patterlist size */ PW_k=0; - for ( PW_j=0 ; PW_j<512 ; PW_j++ ) + for (PW_n=0; PW_n<4; PW_n++) { - PW_l = in_data[PW_Start_Address+250+PW_j]; - if ( PW_l>PW_k ) - PW_k = PW_l; + for ( PW_j=0 ; PW_j<128 ; PW_j++ ) + { + PW_l = in_data[PW_Start_Address+250+PW_j+(PW_n*128)]; + if ( PW_l>PW_k ) + PW_k = PW_l; + /* 20100902:test if patternlist ends with 0x00 values */ + if ( (PW_j>PW_m) && (in_data[PW_Start_Address+250+PW_j+(PW_n*128)]!=0x00)) + { +/*printf ( "#3 bis (start:%ld)(unclean patternlist at %ld:%x)(PW_j:%ld)(PW_n:%ld))\n" + , PW_Start_Address, 250+PW_j+(PW_n*128), in_data[PW_Start_Address+250+PW_j+(PW_n*128)],PW_j,PW_n);*/ + return BAD; + } + } } /* PW_k is the highest track number */ PW_k += 1; PW_k *= 64; + /* test if it's not outside the file */ if ( PW_Start_Address + 762 + (PW_k*4) > PW_in_size ) { /*printf ( "#4 (start:%ld)\n" , PW_Start_Address );*/ @@ -114,10 +131,15 @@ short testPP10 ( void ) /* track data test */ PW_l=0; for ( PW_j=0 ; PW_j 0x13 ) + { /*20010902:better note test*/ + if ( (in_data[PW_Start_Address+762+(PW_j*4)]&0xf0) > 0x10 ) { -/*printf ( "#3,1 (start:%ld)\n" , PW_Start_Address );*/ +/*printf ( "#3,1 (start:%ld) (note[0]:%x)\n" , PW_Start_Address,in_data[PW_Start_Address+762+PW_j*4] );*/ + return BAD; + } + if ( (in_data[PW_Start_Address+762+(PW_j*4)]&0x0f) > 0x03 ) + { /*20010902:better note test*/ +/*printf ( "#3,1,0 (start:%ld)\n" , PW_Start_Address );*/ return BAD; } if ( ((in_data[PW_Start_Address+762+PW_j*4]&0x0f) == 0x00 ) && (in_data[PW_Start_Address+763+PW_j*4] < 0x71) && (in_data[PW_Start_Address+763+PW_j*4] != 0x00)) @@ -153,7 +175,7 @@ void Rip_PP10 ( void ) Save_Rip ( "ProPacker v1.0 Exe-file", PP10 ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ + PW_i += 4; /* 3 should do but call it "just to be sure" :) */ } @@ -176,22 +198,22 @@ void Rip_PP10 ( void ) void Depack_PP10 ( void ) { - Uchar *Header, *Pattern; - Ulong ReadTrkPat[128][4], ReadPat[128]; - long Highest_Track = 0; - long i=0,j=0,k=0,l=0,m=0; - long WholeSampleSize=0; - long Where=PW_Start_Address; + uint8_t *Header, *Pattern; + uint32_t ReadTrkPat[128][4], ReadPat[128]; + int32_t Highest_Track = 0; + int32_t i=0,j=0,k=0,l=0,m=0; + int32_t WholeSampleSize=0; + int32_t Where=PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Header = (Uchar *)malloc(1084); - Pattern = (Uchar *)malloc(1024); + Header = (uint8_t *)malloc(1084); + Pattern = (uint8_t *)malloc(1024); BZERO ( Header , 1084 ); BZERO ( Pattern , 1024 ); @@ -273,8 +295,6 @@ void Depack_PP10 ( void ) j--; l++; } - if ( l != Header[950] ) - l -= 1; /* write ptk's ID */ @@ -300,13 +320,13 @@ void Depack_PP10 ( void ) } for (k=0;k<4;k++) /* loop on 4 tracks' refs*/ { - long d; + int32_t d; /* loop on notes */ for (d=0;d<64;d++) { /* read one ref value to be fetch in the reference table */ - long val = Where+(ReadTrkPat[j][k]*256)+(d*4); + int32_t val = Where+(ReadTrkPat[j][k]*256)+(d*4); Pattern[k*4+d*16] = in_data[val]; Pattern[k*4+d*16+1] = in_data[val + 1]; diff --git a/prowizard/rippers/ProPacker21.c b/prowizard/rippers/ProPacker21.c index aa7f4cfa..eb1a4f15 100644 --- a/prowizard/rippers/ProPacker21.c +++ b/prowizard/rippers/ProPacker21.c @@ -10,10 +10,15 @@ #include "extern.h" -short testPP21 ( void ) +int16_t testPP21 ( void ) { /* test #1 */ - if ( (PW_i < 3) || ((PW_i+891)>=PW_in_size)) + if ( PW_i < 3 ) + { +/*printf ( "#1 (PW_i:%ld)\n" , PW_i );*/ + return BAD; + } + if ( (PW_i+891) >= PW_in_size) { /*printf ( "#1 (PW_i:%ld)\n" , PW_i );*/ return BAD; @@ -119,7 +124,7 @@ void Rip_PP21 ( void ) Save_Rip ( "ProPacker v2.1 module", Propacker_21 ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ + PW_i += 4; /* 3 should do but call it "just to be sure" :) */ } @@ -146,13 +151,13 @@ void Rip_PP21 ( void ) void Depack_PP21 ( void ) { - Uchar *Header, *Pattern; - Ulong ReadTrkPat[128][4], ReadPat[128]; - long Highest_Track = 0; - long whereTableRef; - long i=0,j=0,k=0,l=0,m=0; - long Total_Sample_Size=0; - long Where=PW_Start_Address; + uint8_t *Header, *Pattern; + uint32_t ReadTrkPat[128][4], ReadPat[128]; + int32_t Highest_Track = 0; + int32_t whereTableRef; + int32_t i=0,j=0,k=0,l=0,m=0; + int32_t Total_Sample_Size=0; + int32_t Where=PW_Start_Address; FILE *out; /*FILE *info;*/ @@ -160,12 +165,12 @@ void Depack_PP21 ( void ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /*info = PW_fopen ( "info.txt" , "w+b");*/ - Header = (Uchar *)malloc(1084); - Pattern = (Uchar *)malloc(1024); + Header = (uint8_t *)malloc(1084); + Pattern = (uint8_t *)malloc(1024); BZERO ( Header , 1084 ); BZERO ( Pattern , 1024 ); @@ -195,7 +200,7 @@ void Depack_PP21 ( void ) Where += 1; /* now, where = 0xFA*/ - for (i=0;i=PW_in_size)) @@ -158,7 +158,7 @@ void Rip_PP30 ( void ) Save_Rip ( "ProPacker v3.0 module", Propacker_30 ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 4); /* 3 should do but call it "just to be sure" :) */ + PW_i += 4; /* 3 should do but call it "just to be sure" :) */ } @@ -183,24 +183,24 @@ void Rip_PP30 ( void ) void Depack_PP30 ( void ) { - Uchar *Header, *Pattern; - Ulong ReadTrkPat[128][4], ReadPat[128]; - long Highest_Track = 0; - long whereTableRef; - long i=0,j=0,k=0,l=0,m=0; - long Total_Sample_Size=0; - long Where=PW_Start_Address; + uint8_t *Header, *Pattern; + uint32_t ReadTrkPat[128][4], ReadPat[128]; + int32_t Highest_Track = 0; + int32_t whereTableRef; + int32_t i=0,j=0,k=0,l=0,m=0; + int32_t Total_Sample_Size=0; + int32_t Where=PW_Start_Address; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Header = (Uchar *)malloc(1084); - Pattern = (Uchar *)malloc(1024); + Header = (uint8_t *)malloc(1084); + Pattern = (uint8_t *)malloc(1024); BZERO ( Header , 1084 ); BZERO ( Pattern , 1024 ); @@ -308,13 +308,13 @@ void Depack_PP30 ( void ) } for (k=0;k<4;k++) /* loop on 4 tracks' refs*/ { - long d; + int32_t d; /* loop on notes */ for (d=0;d<64;d++) { /* read one ref value to be fetch in the reference table */ - long val = (in_data[Where+(ReadTrkPat[j][k]*128)+(d*2)])*256 + int32_t val = (in_data[Where+(ReadTrkPat[j][k]*128)+(d*2)])*256 + in_data[Where+(ReadTrkPat[j][k]*128)+(d*2)+1]; Pattern[k*4+d*16] = in_data[whereTableRef + val]; diff --git a/prowizard/rippers/Promizer01.c b/prowizard/rippers/Promizer01.c index db70b589..1b39ce88 100644 --- a/prowizard/rippers/Promizer01.c +++ b/prowizard/rippers/Promizer01.c @@ -12,7 +12,7 @@ bugfix : test #5 was fake since first pat addy can be != $00000000 #include "extern.h" -short testPM01 ( void ) +int16_t testPM01 ( void ) { /* test #1 */ if ( (PW_i < 3) || ((PW_Start_Address + 766)>PW_in_size) ) @@ -163,17 +163,17 @@ void Rip_PM01 ( void ) */ void Depack_PM01 ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00; - Uchar Pat_Pos; - Uchar poss[37][2]; - Uchar *Whatever; - Uchar *PatternData; - Uchar Smp_Fine_Table[31]; - Uchar Old_Smp_Nbr[4]; - long i=0,j=0,k=0,l=0; - long WholeSampleSize=0; - long Pattern_Address[128]; - long Where = PW_Start_Address; + uint8_t c1=0x00,c2=0x00,c3=0x00; + uint8_t Pat_Pos; + uint8_t poss[37][2]; + uint8_t *Whatever; + uint8_t *PatternData; + uint8_t Smp_Fine_Table[31]; + uint8_t Old_Smp_Nbr[4]; + int32_t i=0,j=0,k=0,l=0; + int32_t WholeSampleSize=0; + int32_t Pattern_Address[128]; + int32_t Where = PW_Start_Address; FILE *out; #include "tuning.h" @@ -186,11 +186,11 @@ void Depack_PM01 ( void ) BZERO ( Smp_Fine_Table , 31 ); BZERO ( Old_Smp_Nbr , 4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* write title */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); /* title */ fwrite ( Whatever , 20 , 1 , out ); @@ -261,8 +261,8 @@ void Depack_PM01 ( void ) /* read and XOR pattern data */ free ( Whatever ); - Whatever = (Uchar *) malloc ( j ); - PatternData = (Uchar *) malloc ( j ); + Whatever = (uint8_t *) malloc ( j ); + PatternData = (uint8_t *) malloc ( j ); for ( k=0 ; k PW_in_size ) @@ -78,7 +78,10 @@ void Rip_PM10c ( void ) * * update 20 mar 2003 (it's war time again .. brrrr) * - removed all open() funcs. - * - optimized more than quite a bit (src is 5kb shorter !) + * - optimized more than quite a bit (src is 5kb int16_t er !) + * + * update 08 jan 2010 + * - bug fix in patternlist generation */ #define ON 0 @@ -88,25 +91,25 @@ void Rip_PM10c ( void ) void Depack_PM10c ( void ) { - Uchar c1=0x00,c2=0x00; - short Ref_Max=0; - long Pats_Address[128]; - long Read_Pats_Address[128]; - Uchar NOP=0x00; /* number of pattern */ - Uchar *ReferenceTable; - Uchar *Pattern; - long i=0,j=0,k=0,l=0,m=0; - long Total_Sample_Size=0; - long PatDataSize=0l; - long SDAV=0l; - Uchar FLAG=OFF; - Uchar Smp_Fine_Table[31]; - Uchar poss[37][2]; - Uchar OldSmpValue[4]; - Uchar *Whatever; - Uchar *WholePatternData; - long Where = PW_Start_Address; - short Period; + uint8_t c1=0x00,c2=0x00; + int16_t Ref_Max=0; + int32_t Pats_Address[128]; + int32_t Read_Pats_Address[128]; + uint8_t NOP=0x00; /* number of pattern */ + uint8_t *ReferenceTable; + uint8_t *Pattern; + int32_t i=0,j=0,k=0,l=0,m=0; + int32_t Total_Sample_Size=0; + int32_t PatDataSize=0l; + int32_t SDAV=0l; + uint8_t FLAG=OFF; + uint8_t Smp_Fine_Table[31]; + uint8_t poss[37][2]; + uint8_t OldSmpValue[4]; + uint8_t *Whatever; + uint8_t *WholePatternData; + int32_t Where = PW_Start_Address; + int16_t Period; FILE *out;/*,*info;*/ #include "tuning.h" @@ -120,15 +123,14 @@ void Depack_PM10c ( void ) BZERO ( OldSmpValue , 4 ); BZERO ( Pats_Address , 128*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /*info = fopen ( "info", "w+b");*/ - Whatever = (Uchar *) malloc (128); - BZERO (Whatever,128); - + Whatever = (uint8_t *) malloc (1085); + BZERO (Whatever, 1085); /* title */ - fwrite ( &Whatever[32] , 20 , 1 , out ); + /*fwrite ( &Whatever[32] , 20 , 1 , out );*/ /* bypass replaycode routine */ Where = PW_Start_Address + 4460; @@ -136,9 +138,16 @@ void Depack_PM10c ( void ) for ( i=0 ; i<31 ; i++ ) { /*sample name*/ - fwrite ( &Whatever[32] ,22 , 1 , out ); - - fwrite ( &in_data[Where], 8, 1, out ); + /*fwrite ( &Whatever[32] ,22 , 1 , out );*/ + Whatever[42+30*i] = in_data[Where]; + Whatever[43+30*i] = in_data[Where+1]; + Whatever[44+30*i] = in_data[Where+2]; + Whatever[45+30*i] = in_data[Where+3]; + Whatever[46+30*i] = in_data[Where+4]; + Whatever[47+30*i] = in_data[Where+5]; + Whatever[48+30*i] = in_data[Where+6]; + Whatever[49+30*i] = in_data[Where+7]; + /*fwrite ( &in_data[Where], 8, 1, out );*/ /* whole sample size */ Total_Sample_Size += (((in_data[Where]*256)+in_data[Where+1])*2); /* finetune */ @@ -165,7 +174,7 @@ void Depack_PM10c ( void ) Where = PW_Start_Address + PATTERN_DATA_ADDY; /* now, reading all pattern data to get the max value of note */ - WholePatternData = (Uchar *) malloc (PatDataSize+1); + WholePatternData = (uint8_t *) malloc (PatDataSize+1); BZERO (WholePatternData, PatDataSize+1); for ( j=0 ; j new pattern %2d (addy :%ld)\n", c1, j+5226 );*/ + fflush (stdout); c1 += 0x01; } @@ -226,7 +243,7 @@ void Depack_PM18a ( void ) Pattern[i+2] = ReferenceTable[m+2]; Pattern[i+3] = ReferenceTable[m+3]; - /*fprintf ( info, "[%4x][%3ld][%ld]: %2x %2x %2x %2x", j,i,k%4,Pattern[i],Pattern[i+1],Pattern[i+2],Pattern[i+3]);*/ + /*printf ( "[%4x][%3ld][%ld]: %2x %2x %2x %2x", j,i,k%4,Pattern[i],Pattern[i+1],Pattern[i+2],Pattern[i+3]);*/ c2 = ((Pattern[i+2]>>4)&0x0f) | (Pattern[i]&0xf0); if ( c2 != 0x00 ) @@ -272,7 +289,7 @@ void Depack_PM18a ( void ) for ( c2=0; c2<128 ; c2+=0x01 ) for ( i=0 ; i new pattern %2d (addy :%ld)\n", c1, j );*/ + /*printf ("%lx(%d) - ",j,c1);*/ + fflush (stdout); + c1 += 0x01; } - for ( j=0 ; j bypassing end of pattern" );*/ + FLAG=OFF; + while ( (i%1024) != 0) + i ++; + i -= 4; } - - if ( Pats_Address_tmp[i] == Pats_Address_tmp2[j] ) - continue; - Pats_Address_tmp2[++j] = Pats_Address_tmp[i]; - } - - for ( c1=0x00 ; c1 Ref_Max ) - Ref_Max = (c1*256)+c2; - } -/* - printf ( "* Ref_Max = %d\n" , Ref_Max ); - printf ( "* where : %ld\n" , ftell ( in ) ); -*/ - /* read "reference Table" */ - fseek ( in , ADDRESS_REF_TABLE , 0 ); /* SEEK_SET */ - fread ( &c1 , 1 , 1 , in ); - fread ( &c2 , 1 , 1 , in ); - fread ( &c3 , 1 , 1 , in ); - fread ( &c4 , 1 , 1 , in ); - j = (c1*256*256*256)+(c2*256*256)+(c3*256)+c4; - fseek ( in , 8+j , 0 ); /* SEEK_SET */ -/* printf ( "address of 'reference table' : %ld\n" , ftell (in ) );*/ - Ref_Max += 1; /* coz 1st value is 0 and will be empty in this table */ - i = Ref_Max * 4; /* coz each block is 4 bytes long */ - ReferenceTable = (Uchar *) malloc ( i ); - BZERO ( ReferenceTable , i ); - fread ( &ReferenceTable[4] , i , 1 , in ); - - /* go back to pattern data starting address */ - fseek ( in , PATTERN_DATA , 0 ); /* SEEK_SET */ -/* printf ( "Highest pattern number : %d\n" , Pat_Max );*/ - - /*printf ( "Computing the pattern datas " );*/ - k=0; - for ( j=0 ; j<=Pat_Max ; j++ ) - { - for ( i=0 ; i<64 ; i++ ) - { - /* VOICE #1 */ - - fread ( &c1 , 1 , 1 , in ); - k += 1; - fread ( &c2 , 1 , 1 , in ); - k += 1; - Smp = ReferenceTable[((c1*256)+c2)*4]; - Note = ReferenceTable[((c1*256)+c2)*4+1]; - - Pattern[j][i*16] = (Smp&0xf0); - Pattern[j][i*16] |= poss[Note][0]; - Pattern[j][i*16+1] = poss[Note][1]; - Pattern[j][i*16+2] = ReferenceTable[((c1*256)+c2)*4+2]; - Pattern[j][i*16+2] |= ((Smp<<4)&0xf0); - Pattern[j][i*16+3] = ReferenceTable[((c1*256)+c2)*4+3]; - - if ( ( (Pattern[j][i*16+2] & 0x0f) == 0x0d ) || - ( (Pattern[j][i*16+2] & 0x0f) == 0x0b ) ) - { - FLAG = ON; - } - - /* VOICE #2 */ - - fread ( &c1 , 1 , 1 , in ); - k += 1; - fread ( &c2 , 1 , 1 , in ); - k += 1; - Smp = ReferenceTable[((c1*256)+c2)*4]; - Note = ReferenceTable[((c1*256)+c2)*4+1]; - - Pattern[j][i*16+4] = (Smp&0xf0); - Pattern[j][i*16+4] |= poss[Note][0]; - Pattern[j][i*16+5] = poss[Note][1]; - Pattern[j][i*16+6] = ReferenceTable[((c1*256)+c2)*4+2]; - Pattern[j][i*16+6] |= ((Smp<<4)&0xf0); - Pattern[j][i*16+7] = ReferenceTable[((c1*256)+c2)*4+3]; - - if ( ( ( Pattern[j][i*16+6] & 0x0f) == 0x0d ) || - ( (Pattern[j][i*16+6] & 0x0f) == 0x0b ) ) - { - FLAG = ON; - } - - /* VOICE #3 */ - - fread ( &c1 , 1 , 1 , in ); - k += 1; - fread ( &c2 , 1 , 1 , in ); - k += 1; - Smp = ReferenceTable[((c1*256)+c2)*4]; - Note = ReferenceTable[((c1*256)+c2)*4+1]; - - Pattern[j][i*16+8] = (Smp&0xf0); - Pattern[j][i*16+8] |= poss[Note][0]; - Pattern[j][i*16+9] = poss[Note][1]; - Pattern[j][i*16+10] = ReferenceTable[((c1*256)+c2)*4+2]; - Pattern[j][i*16+10] |= ((Smp<<4)&0xf0); - Pattern[j][i*16+11]= ReferenceTable[((c1*256)+c2)*4+3]; - - if ( ( (Pattern[j][i*16+10] & 0x0f) == 0x0d ) || - ( (Pattern[j][i*16+10] & 0x0f) == 0x0b ) ) - { - FLAG = ON; - } - - /* VOICE #4 */ - - fread ( &c1 , 1 , 1 , in ); - k += 1; - fread ( &c2 , 1 , 1 , in ); - k += 1; - Smp = ReferenceTable[((c1*256)+c2)*4]; - Note = ReferenceTable[((c1*256)+c2)*4+1]; - - Pattern[j][i*16+12] = (Smp&0xf0); - Pattern[j][i*16+12] |= poss[Note][0]; - Pattern[j][i*16+13] = poss[Note][1]; - Pattern[j][i*16+14] = ReferenceTable[((c1*256)+c2)*4+2]; - Pattern[j][i*16+14] |= ((Smp<<4)&0xf0); - Pattern[j][i*16+15]= ReferenceTable[((c1*256)+c2)*4+3]; - - if ( ( (Pattern[j][i*16+14] & 0x0f) == 0x0d ) || - ( (Pattern[j][i*16+14] & 0x0f) == 0x0b ) ) - { - FLAG = ON; - } + Whatever[1080] = 'M'; + Whatever[1081] = '.'; + Whatever[1082] = 'K'; + Whatever[1083] = '.'; + + fwrite (Whatever,1084,1,out); + free ( Whatever ); - if ( FLAG == ON ) - { - FLAG=OFF; - break; - } - } - fwrite ( Pattern[j] , 1024 , 1 , out ); - /*printf ( "." );*/ - } - free ( ReferenceTable ); - /*printf ( " ok\n" );*/ + /* c1 (+1) is still the number of patterns stored */ + fwrite ( Pattern, (c1-1)*1024, 1, out ); + free (Pattern); - /* get address of sample data .. and go there */ /*printf ( "Saving sample datas ... " );*/ - fseek ( in , ADDRESS_SAMPLE_DATA , 0 ); /* SEEK_SET */ - fread ( &c1 , 1 , 1 , in ); - fread ( &c2 , 1 , 1 , in ); - fread ( &c3 , 1 , 1 , in ); - fread ( &c4 , 1 , 1 , in ); - SDAV = (c1*256*256*256)+(c2*256*256)+(c3*256)+c4; - fseek ( in , 4 + SDAV , 0 ); /* SEEK_SET */ - - - /* read and save sample data */ -/* printf ( "out: where before saving sample data : %ld\n" , ftell ( out ) );*/ -/* printf ( "Whole sample size : %ld\n" , Total_Sample_Size );*/ - SampleData = (Uchar *) malloc ( Total_Sample_Size ); - fread ( SampleData , Total_Sample_Size , 1 , in ); - fwrite ( SampleData , Total_Sample_Size , 1 , out ); - free ( SampleData ); + Where = PW_Start_Address + SmpAddy; + fwrite ( &in_data[Where] , Total_Sample_Size , 1 , out ); /*printf ( " ok\n" );*/ Crap ( " Promizer 4.0 " , BAD , BAD , out ); - fflush ( in ); fflush ( out ); - fclose ( in ); fclose ( out ); +/* fclose (info);*/ printf ( "done\n" ); return; /* useless ... but */ diff --git a/prowizard/rippers/Prorunner10.c b/prowizard/rippers/Prorunner10.c index b406188d..5fbbae5d 100644 --- a/prowizard/rippers/Prorunner10.c +++ b/prowizard/rippers/Prorunner10.c @@ -7,7 +7,7 @@ #include "extern.h" -short testPRUN1 ( void ) +int16_t testPRUN1 ( void ) { /* test 1 */ if ( PW_i < 1080 ) @@ -27,6 +27,26 @@ short testPRUN1 ( void ) { return BAD; } + + /* test 4 */ + for ( PW_k=0 ; PW_k<31 ; PW_k++ ) + { + /* size */ + PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); + /* loop start */ + PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2); + /* loop size */ + PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); + + if ( test_smps(PW_j*2, PW_m, PW_n, in_data[PW_Start_Address+45+30*PW_k], in_data[PW_Start_Address+44+30*PW_k] ) == BAD ) + { + /*printf ( "start : %ld\n", PW_Start_Address );*/ + return BAD; + } + + PW_WholeSampleSize += PW_j; + } + return GOOD; } @@ -34,9 +54,6 @@ short testPRUN1 ( void ) void Rip_PRUN1 ( void ) { - PW_WholeSampleSize = 0; - for ( PW_k=0 ; PW_k<31 ; PW_k++ ) - PW_WholeSampleSize += (((in_data[PW_Start_Address+42+30*PW_k]*256)+in_data[PW_Start_Address+43+30*PW_k])*2); PW_l=0; for ( PW_k=0 ; PW_k<128 ; PW_k++ ) if ( in_data[PW_Start_Address+952+PW_k] > PW_l ) @@ -48,7 +65,7 @@ void Rip_PRUN1 ( void ) Save_Rip ( "Prorunner 1 module", ProRunner_v1 ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 1083); /* 1080 could be enough */ + PW_i += 1; /* 1080 could be enough */ } @@ -64,12 +81,12 @@ void Rip_PRUN1 ( void ) */ void Depack_PRUN1 ( void ) { - Uchar *Whatever; - Uchar poss[37][2]; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j=0; - long Where=PW_Start_Address; + uint8_t *Whatever; + uint8_t poss[37][2]; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where=PW_Start_Address; FILE *out; fillPTKtable(poss); @@ -77,7 +94,7 @@ void Depack_PRUN1 ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read and write whole header */ @@ -96,7 +113,7 @@ void Depack_PRUN1 ( void ) Where += 952; /* write ID */ - Whatever = (Uchar *) malloc (4); + Whatever = (uint8_t *) malloc (4); Whatever[0] = 'M'; Whatever[1] = '.'; Whatever[2] = 'K'; diff --git a/prowizard/rippers/Prorunner20.c b/prowizard/rippers/Prorunner20.c index a1ee420d..420be88e 100644 --- a/prowizard/rippers/Prorunner20.c +++ b/prowizard/rippers/Prorunner20.c @@ -6,7 +6,7 @@ #include "globals.h" #include "extern.h" -short testPRUN2 ( void ) +int16_t testPRUN2 ( void ) { PW_Start_Address = PW_i; PW_j = (in_data[PW_i+4]*256*256*256)+(in_data[PW_i+5]*256*256)+(in_data[PW_i+6]*256)+in_data[PW_i+7]; @@ -52,7 +52,7 @@ void Rip_PRUN2 ( void ) Save_Rip ( "Prorunner 2 module", ProRunner_v2 ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 2); /* -1 should do but call it "just to be sure" :) */ + PW_i += 2; /* -1 should do but call it "just to be sure" :) */ } @@ -69,7 +69,7 @@ void Rip_PRUN2 ( void ) * * 28 Nov 1999 : Update * - optimized code for size and speed (again :) - * Heh, 1/5 shorter now !. + * Heh, 1/5 int16_t er now !. * * 23 aug 2001 : debug * - "repeat last note used bug" pointed out by Markus Jaegermeister !. @@ -78,12 +78,12 @@ void Rip_PRUN2 ( void ) void Depack_PRUN2 ( void ) { - Uchar poss[37][2]; - Uchar Voices[4][4]; - Uchar *Whatever; - long WholeSampleSize=0; - long i=0,j=0; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t poss[37][2]; + uint8_t Voices[4][4]; + uint8_t *Whatever; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -91,10 +91,10 @@ void Depack_PRUN2 ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO (Whatever , 1024); /* title */ fwrite ( Whatever , 20 , 1 , out ); diff --git a/prowizard/rippers/QuadraComposer.c b/prowizard/rippers/QuadraComposer.c index 94fc7af3..dea820d6 100644 --- a/prowizard/rippers/QuadraComposer.c +++ b/prowizard/rippers/QuadraComposer.c @@ -6,7 +6,7 @@ #include "extern.h" -short testQuadraComposer ( void ) +int16_t testQuadraComposer ( void ) { /* test #1 */ if ( PW_i < 8 ) @@ -69,22 +69,22 @@ void Rip_QuadraComposer ( void ) */ void Depack_QuadraComposer ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00,c5=0x00; - Uchar Pat_Pos; - Uchar Pat_Max=0x00; - Uchar Real_Pat_Max=0x00; - Uchar *Whatever; - /*Uchar Row[16];*/ - Uchar Pattern[1024]; - Uchar NbrSample=0x00; - Uchar RealNbrSample=0x00; - Uchar NbrRow[128]; - Uchar poss[37][2]; /* <------ Ptk's pitch table */ - long SmpAddresses[32]; - long SmpSizes[32]; - long PatAddresses[128]; - long i=0,j=0,k=0; - long Where = PW_Start_Address; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00,c5=0x00; + uint8_t Pat_Pos; + uint8_t Pat_Max=0x00; + uint8_t Real_Pat_Max=0x00; + uint8_t *Whatever; + /*uint8_t Row[16];*/ + uint8_t Pattern[1024]; + uint8_t NbrSample=0x00; + uint8_t RealNbrSample=0x00; + uint8_t NbrRow[128]; + uint8_t poss[37][2]; /* <------ Ptk's pitch table */ + int32_t SmpAddresses[32]; + int32_t SmpSizes[32]; + int32_t PatAddresses[128]; + int32_t i=0,j=0,k=0; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -92,7 +92,7 @@ void Depack_QuadraComposer ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); @@ -123,7 +123,7 @@ void Depack_QuadraComposer ( void ) /*fread ( &NbrSample , 1 , 1 , in );*/ /* write empty 930 sample header */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); Whatever[29] = 0x01; for ( i=0 ; i<31 ; i++ ) diff --git a/prowizard/rippers/RelokIt10.c b/prowizard/rippers/RelokIt10.c index 911b3ec9..265738bb 100644 --- a/prowizard/rippers/RelokIt10.c +++ b/prowizard/rippers/RelokIt10.c @@ -5,7 +5,7 @@ #include "extern.h" -short testRelokIt10 ( void ) +int16_t testRelokIt10 ( void ) { PW_Start_Address = PW_i; @@ -77,8 +77,8 @@ void Rip_RelokIt10 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -87,7 +87,7 @@ void Rip_RelokIt10 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -101,7 +101,7 @@ void Rip_RelokIt10 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 204; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); diff --git a/prowizard/rippers/S3M.c b/prowizard/rippers/S3M.c new file mode 100644 index 00000000..ea2ebb18 --- /dev/null +++ b/prowizard/rippers/S3M.c @@ -0,0 +1,130 @@ +/* testS3M() */ +/* Rip_S3M() */ + + +#include "globals.h" +#include "extern.h" + + +int16_t testS3M ( void ) +{ + /* test #1 */ + PW_Start_Address = PW_i-44; + if ( (PW_Start_Address + 0x60) > PW_in_size) + { + /*printf ( "#1 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + /* must be 0x1a10 */ + if ( (in_data[PW_Start_Address + 28] != 0x1A) || (in_data[PW_Start_Address + 29] != 0x10) ) + { + /*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + /* must be 0x0100 or 0x0200 */ + if ( ((in_data[PW_Start_Address + 42] != 0x01) && (in_data[PW_Start_Address + 42] != 0x02)) || (in_data[PW_Start_Address + 43] != 0x00) ) + { + /*printf ( "#3 Start:%ld\n" , PW_Start_Address );*/ + return BAD; + } + + /* get patternlist size */ + PW_j = ( (in_data[PW_Start_Address+33]*256)+ + in_data[PW_Start_Address+32] ); + if ( ((PW_j/2)*2) != PW_j ) + { + /*printf ( "#4 Start:%ld\n" , PW_Start_Address );*/ + /* unreal musics with uneven patterlist size ?!? */ + /*return BAD;*/ + } + + /* get number of instruments */ + PW_k = ( (in_data[PW_Start_Address+35]*256)+ + in_data[PW_Start_Address+34] ); + /* get number of pattern stored */ + PW_l = ( (in_data[PW_Start_Address+37]*256)+ + in_data[PW_Start_Address+36] ); + + /* PW_j is the patternlist size */ + /* PW_k is the number of instruments */ + /* PW_l is the number of pattern stored */ + return GOOD; +} + + +/* + * S3M ripper + * 20100207 - Sylvain "Asle" Chipaux + * + * pfiew - finaly completed. some "features" not documented :( +*/ +void Rip_S3M ( void ) +{ + int32_t currentptr; + int32_t max = 0; + /*int32_t lastnonzerosize = 0;*/ + /*int32_t gap;*/ + /*int32_t whole_inst_size=0;*/ + int32_t whole_head_size=0; + + /* read the pattern adresses and get sizes */ + currentptr = PW_Start_Address + 0x60 + PW_j + (PW_k*2); + max = 0; + for ( PW_o=0 ; PW_o max ) + { + max = tmp_addy; + whole_head_size = max + ((in_data[tmp_addy+1+ PW_Start_Address]*256)+in_data[tmp_addy+ PW_Start_Address]); + } + /*printf ("[%ld] tmp_addy : %lx,(%lx)\n",PW_o,tmp_addy,(in_data[tmp_addy+1]*256)+in_data[tmp_addy]);*/ + } + while (((whole_head_size/16)*16) != whole_head_size) + { + whole_head_size += 1; + } + + + /* read the instruments adresses and get sizes */ + /* they should be _before_ the pattern data, handled above */ + currentptr = PW_Start_Address + 0x60 + PW_j; + for ( PW_o=0 ; PW_o max) + { + int32_t t = ((in_data[tmp_addy+18+ PW_Start_Address]*256*256)+(in_data[tmp_addy+17+ PW_Start_Address]*256)+in_data[tmp_addy+16+ PW_Start_Address]); + if ((in_data[tmp_addy+31]&0x04) == 0x04) + t *= 2; + max = tmp_addy2; + whole_head_size = max + t; + } + } + } + + OutputSize = whole_head_size; + printf ("\nwhole_head_size : %d\n" + "PW_j : %x\n" + "PW_k*2 : %x\n" + "PW_l*2 : %x\n" + ,whole_head_size, PW_j, (PW_k*2), (PW_l*2)); + + CONVERT = BAD; + Save_Rip ( "ScreamTracker III module", S3M ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} diff --git a/prowizard/rippers/SA.c b/prowizard/rippers/SA.c new file mode 100644 index 00000000..42ccafd5 --- /dev/null +++ b/prowizard/rippers/SA.c @@ -0,0 +1,369 @@ +/* + Sonic Arranger ("shot in the dark" try) + 20160313- Asle +20160314: no hunk version +*/ +/* testSAhunk() */ +/* Rip_SAhunk() */ + + + +#include "globals.h" +#include "extern.h" + + +int16_t testSAhunk ( void ) +{ + PW_Start_Address = PW_i; + + if ( (in_data[PW_Start_Address+8] != 'S' ) || + (in_data[PW_Start_Address+9] != 'T' ) || + (in_data[PW_Start_Address+10] != 'B' ) || + (in_data[PW_Start_Address+11] != 'L' ) ) + { + printf ( "#1 Start:%d - expecting STBL hunk\n" , PW_Start_Address ); + return BAD; + } + + /* file size */ + if ( (PW_in_size - PW_Start_Address) < 36 ) + { + /*printf ( "#1,1 (start:%ld) (size:%ld)\n" , PW_Start_Address , PW_in_size-PW_Start_Address);*/ + return BAD; + } + + /* get nbr patterns */ + /*PW_m = (( in_data[PW_Start_Address+18]*256)+ + in_data[PW_Start_Address+19] );*/ + +/************* OVTB ****************/ + if ( (in_data[PW_Start_Address+28] != 'O' ) || + (in_data[PW_Start_Address+29] != 'V' ) || + (in_data[PW_Start_Address+30] != 'T' ) || + (in_data[PW_Start_Address+31] != 'B' ) ) + { + printf ( "#1,2 Start:%d - expecting OVTB hunk\n" , PW_Start_Address ); + return BAD; + } + + /* nbr of Overtable */ + PW_n = (( in_data[PW_Start_Address+34]*256)+ + in_data[PW_Start_Address+35] )*16; + + /* file size */ + if ( (PW_in_size - PW_Start_Address - 32) < (PW_n + 8) ) + { + /*printf ( "#1,3 (start:%ld) (size:%ld)\n" , PW_Start_Address , PW_in_size-PW_Start_Address-32);*/ + return BAD; + } + + PW_n += 36; /* should now be on NTBL hunk */ + +/************* NTBL ****************/ + if ( (in_data[PW_Start_Address+PW_n] != 'N' ) || + (in_data[PW_Start_Address+PW_n+1] != 'T' ) || + (in_data[PW_Start_Address+PW_n+2] != 'B' ) || + (in_data[PW_Start_Address+PW_n+3] != 'L' ) ) + { + printf ( "#2 Start:%d - expecting NTBL hunk\n" , PW_Start_Address ); + return BAD; + } + + /* nbr of notes */ + PW_m = (( in_data[PW_Start_Address+PW_n+6]*256)+ + in_data[PW_Start_Address+PW_n+7] )*4; + + /* file size */ + if ( (PW_in_size - PW_Start_Address - PW_n) < (PW_m + 16) ) + { + printf ( "#2,1 (start:%d) (size:%d)\n" , PW_Start_Address , PW_in_size-PW_Start_Address-PW_n); + return BAD; + } + + PW_n += (PW_m+8); /* should now be on INST hunk */ + +/************* INST ****************/ + if ( (in_data[PW_Start_Address+PW_n] != 'I' ) || + (in_data[PW_Start_Address+PW_n+1] != 'N' ) || + (in_data[PW_Start_Address+PW_n+2] != 'S' ) || + (in_data[PW_Start_Address+PW_n+3] != 'T' ) ) + { + printf ( "#3 Start:%d - expecting INST hunk\n" , PW_Start_Address ); + return BAD; + } + + /* nbr of instruments */ + PW_m = (( in_data[PW_Start_Address+PW_n+6]*256)+ + in_data[PW_Start_Address+PW_n+7] )*152; + + /* file size */ + if ( (PW_in_size - PW_Start_Address - PW_n) < (PW_m + 16) ) + { + printf ( "#3,1 (start:%d) (size:%d)\n" , PW_Start_Address , PW_in_size-PW_Start_Address-PW_n); + return BAD; + } + + PW_n += (PW_m+8); /* should now be on SD8B hunk */ + +/************* SD8B ****************/ + if ( (in_data[PW_Start_Address+PW_n] != 'S' ) || + (in_data[PW_Start_Address+PW_n+1] != 'D' ) || + (in_data[PW_Start_Address+PW_n+2] != '8' ) || + (in_data[PW_Start_Address+PW_n+3] != 'B' ) ) + { + printf ( "#4 Start:%d - expecting SD8B hunk\n" , PW_Start_Address ); + return BAD; + } + + /* nbr 8b samples */ + PW_m = (( in_data[PW_Start_Address+PW_n+6]*256)+ + in_data[PW_Start_Address+PW_n+7] ); + + /* sample data size, if any */ + if (PW_m>0) + { + PW_k = 0; + PW_l = (PW_m * 4) + (PW_m * 4) + (PW_m * 30); + for (PW_o=0; PW_o 0)printf ("testSA() - case of SYAF that is not 0 - send this file to Asle\n"); + + /* file size */ + if ( (PW_in_size - PW_Start_Address - PW_n) < (PW_m + 16) ) + { + printf ( "#7,1 (start:%d) (size:%d)\n" , PW_Start_Address , PW_in_size-PW_Start_Address-PW_n); + return BAD; + } + + PW_n += (PW_m+8); /* should now be on EDATV1.1 hunk */ + +/************* EDATV1.1 ****************/ + if ( (in_data[PW_Start_Address+PW_n] != 'E' ) || + (in_data[PW_Start_Address+PW_n+1] != 'D' ) || + (in_data[PW_Start_Address+PW_n+2] != 'A' ) || + (in_data[PW_Start_Address+PW_n+3] != 'T' ) ) + { + printf ( "#8 Start:%d - expecting EDATV1.1 hunk\n" , PW_Start_Address ); + return BAD; + } + + /* nbr synth wave tables */ + PW_m = 16; /* always 16 bytes, it seems */ + + PW_n += (PW_m+8); /* should now be at the end */ + + return GOOD; +} + + + +/*****************************************************************************/ +/* +Sonic Arranger - no humk +*/ +int16_t testSA ( void ) +{ + PW_Start_Address = PW_i; + + PW_n = 3; + if ( in_data[PW_Start_Address+PW_n] >0x7f ) + { + /*printf ( "#1 Start:%d - jump too far\n" , PW_Start_Address );*/ + return BAD; + } + + /* file size */ + if ( (PW_Start_Address + in_data[PW_Start_Address+PW_n]) > PW_in_size ) + { + /*printf ( "#1,1 (start:%d) (jump:%d)\n" , PW_Start_Address , in_data[PW_Start_Address+PW_n]);*/ + return BAD; + } + + +/************* point after replay ****************/ + PW_n = (( in_data[PW_Start_Address+22]*256)+ + in_data[PW_Start_Address+23] ); + PW_n += 22; + + /* file size */ + if ( (PW_Start_Address + PW_n) > PW_in_size ) + { + printf ( "#1,3 (start:%d) (jump:%d)\n" , PW_Start_Address , PW_Start_Address + PW_n); + return BAD; + } +printf ("testSA(%x) - jump to %x\n",PW_Start_Address,PW_n); + +/************* try to detect the next 'Nu' ni the next 100h bytes ****************/ + for (PW_j=0; PW_j<0x100; PW_j++) + { + if ((in_data[PW_Start_Address + PW_n + PW_j] == 'N') && + (in_data[PW_Start_Address + PW_n + PW_j + 1] == 'u')) + break; + } + if (PW_j == 0x100) + { + printf ( "#2 Start:%d - no 'Nu' found\n" , PW_Start_Address ); + return BAD; + } +printf ("testSA(%x) - 'Nu' at %x\n",PW_Start_Address,PW_j); + +/************* try to detect the next usable dword ****************/ + PW_n += (PW_j + 2); + if ((in_data[PW_Start_Address + PW_n+3] == 0x00) && + (in_data[PW_Start_Address + PW_n+5] == 0x00) ) + { + printf ( "#3 Start:%d (at %x) - consecutive 0x00 found\n" , PW_Start_Address, PW_n+PW_Start_Address ); + return BAD; + } + if (in_data[PW_Start_Address + PW_n+5] != 0x00) + PW_n += 2; +printf ("testSA(%x) - first dword at %x\n",PW_Start_Address,PW_n); + +/************* real music data start here ****************/ + + /* file size */ + if ( (PW_Start_Address + PW_n + 32) > PW_in_size ) + { + printf ( "#4 (start:%d) (size:%d)\n" , PW_Start_Address , PW_Start_Address + PW_n + 32); + return BAD; + } + +/************* pseudo SD8B hunk ****************/ + + PW_j = (( in_data[PW_Start_Address+PW_n+30]*256)+ + in_data[PW_Start_Address+PW_n+31] ); + PW_n += PW_j; /* this includes the 32 bytes of addresses */ +printf ("testSA(%x) - S8BD hunk at %x\n",PW_Start_Address,PW_n); + + /* nbr 8b samples */ + PW_m = (( in_data[PW_Start_Address+PW_n+2]*256)+ + in_data[PW_Start_Address+PW_n+3] ); +printf ("testSA(%x) - nbr 8b data %x\n",PW_Start_Address,PW_m); + PW_n += 4; +/*printf ("at %x (PW_m:%x)\n",PW_n+PW_Start_Address,PW_m);fflush (stdout);*/ + + /* sample data size, if any */ + if (PW_m>0) + { + PW_k = 0; + for (PW_o=0; PW_oPW_in_size) + { + printf ("no 0xF500 found. size will be at PW_n (%x)\n",PW_n); + break; + } + } + + + return GOOD; +} + +void Rip_SA ( void ) +{ + + OutputSize = PW_n; + + CONVERT = BAD; + Save_Rip ( "Sonic Arranger module", SA ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + diff --git a/prowizard/rippers/SGT-Packer.c b/prowizard/rippers/SGT-Packer.c index 27361112..abac92a2 100644 --- a/prowizard/rippers/SGT-Packer.c +++ b/prowizard/rippers/SGT-Packer.c @@ -11,7 +11,7 @@ #include "extern.h" /* rudimentary tests .. shall add others */ -short testSGT ( void ) +int16_t testSGT ( void ) { /* test 1 */ if ( (PW_i<43) || ((PW_Start_Address+43)>PW_in_size) ) @@ -72,25 +72,25 @@ void Rip_SGT ( void ) void Depack_SGT ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00; - Uchar poss[37][2]; - Uchar Max=0x00; - Uchar Note,Smp,Fx,FxVal; - Uchar PatternTableSize=0x00; - Uchar NbrPat; - long i=0,j=0,l=0,z; - long WholeSampleSize; - long SmpAddy,PatlistAddy,PatdataAddy; - long SmpAddies[31], SmpSizes[31]; - long NbrSmp; - long Where = PW_Start_Address; + uint8_t *Whatever; +/* uint8_t c1=0x00,c2=0x00;*/ + uint8_t poss[37][2]; +/* uint8_t Max=0x00;*/ +/* uint8_t Note,Smp,Fx,FxVal;*/ + uint8_t PatternTableSize=0x00; + uint8_t NbrPat; + int32_t i=0,j=0,l=0,z; + int32_t WholeSampleSize; + int32_t SmpAddy,PatlistAddy,PatdataAddy; + int32_t SmpAddies[31], SmpSizes[31]; + int32_t NbrSmp; + int32_t Where = PW_Start_Address; FILE *out; /*,*debug;*/ if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); fillPTKtable(poss); @@ -117,7 +117,7 @@ void Depack_SGT ( void ) /* debug = fopen ( "debug" , "w+b" );*/ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO (Whatever , 1024); /* title */ fwrite ( &Whatever[0] , 20 , 1 , out ); @@ -144,7 +144,6 @@ void Depack_SGT ( void ) Whatever[22] = in_data[Where+12]; Whatever[23] = in_data[Where+13]; SmpSizes[i] = ((Whatever[22]*256)+Whatever[23])*2; - //fwrite ( &in_data[Where+12] , 2 , 1 , out ); /* calculate loop start value */ j = j-l; @@ -152,20 +151,17 @@ void Depack_SGT ( void ) /* write fine & vol */ Whatever[24] = in_data[Where+10]; Whatever[25] = in_data[Where+11]; - //fwrite ( &in_data[Where] , 2 , 1 , out ); /* write loop start */ /* use of htonl() suggested by Xigh !.*/ j/=2; z = htonl(j); - Whatever[26] = *((Uchar *)&z+2); - Whatever[27] = *((Uchar *)&z+3); - //fwrite ( Whatever , 2 , 1 , out ); + Whatever[26] = *((uint8_t *)&z+2); + Whatever[27] = *((uint8_t *)&z+3); /* write loop size */ Whatever[28] = in_data[Where+8]; Whatever[29] = in_data[Where+9]; - //fwrite ( &in_data[Where+6] , 2 , 1 , out ); fwrite ( &Whatever[0] , 30 , 1 , out ); BZERO (Whatever , 1024); @@ -189,7 +185,7 @@ void Depack_SGT ( void ) { /* get addy of first pointer of each pattern */ /* and convert it to char for storage in patternlist */ - Whatever[i] = (Uchar)(((in_data[Where+(i*256)]*256*256*256)+ + Whatever[i] = (uint8_t)(((in_data[Where+(i*256)]*256*256*256)+ (in_data[Where+(i*256)+1]*256*256)+ (in_data[Where+(i*256)+2]*256)+ in_data[Where+(i*256)+3])/256); diff --git a/prowizard/rippers/SkytPacker.c b/prowizard/rippers/SkytPacker.c index 30224247..945b1310 100644 --- a/prowizard/rippers/SkytPacker.c +++ b/prowizard/rippers/SkytPacker.c @@ -14,7 +14,7 @@ #include "extern.h" -short testSKYT ( void ) +int16_t testSKYT ( void ) { /* test 1 */ if ( PW_i < 256 ) @@ -89,13 +89,13 @@ void Rip_SKYT ( void ) void Depack_SKYT ( void ) { - Uchar *Header, *Pattern; - Uchar poss[37][2]; - long i=0,j=0,k=0,l=0,m=0; - long Total_Sample_Size=0; - unsigned long ReadTrkPat[128][4], ReadPat[128]; - long Where=PW_Start_Address; - long Highest_Track = 0; + uint8_t *Header, *Pattern; + uint8_t poss[37][2]; + int32_t i=0,j=0,k=0,l=0,m=0; + int32_t Total_Sample_Size=0; + uint32_t ReadTrkPat[128][4], ReadPat[128]; + int32_t Where=PW_Start_Address; + int32_t Highest_Track = 0; FILE *out; fillPTKtable(poss); @@ -103,11 +103,11 @@ void Depack_SKYT ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Header = (Uchar *)malloc(1084); - Pattern = (Uchar *)malloc(1024); + Header = (uint8_t *)malloc(1084); + Pattern = (uint8_t *)malloc(1024); BZERO ( Header , 1084 ); BZERO ( Pattern , 1024 ); @@ -205,7 +205,6 @@ void Depack_SKYT ( void ) /* rebuild pattern data now */ for (i=0;i 128 ) + { + return BAD; + } + + /* nbr of pattern saved */ + PW_k = ((in_data[PW_Start_Address+20]*256)+ + in_data[PW_Start_Address+21]); + if ( (PW_k > 64) || (PW_k == 0) ) + { + return BAD; + } + + /* pattern list */ + for ( PW_l=0 ; PW_l<128 ; PW_l++ ) + { + if ( in_data[PW_Start_Address+22+PW_l] > PW_k ) + { + return BAD; + } + } + + /* test sample sizes */ + PW_WholeSampleSize = 0; + for ( PW_l=0 ; PW_l<31 ; PW_l++ ) + { + /* addresse de la table */ + PW_o = PW_Start_Address+PW_j+PW_l*4; + + /* address du sample */ + PW_k = ((in_data[PW_o]*256*256*256)+ + (in_data[PW_o+1]*256*256)+ + (in_data[PW_o+2]*256)+ + in_data[PW_o+3]); + + /* taille du smp */ + PW_m = ((in_data[PW_o+PW_k-PW_l*4]*256)+ + in_data[PW_o+PW_k+1-PW_l*4])*2; + + PW_WholeSampleSize += PW_m; + } + + if ( PW_WholeSampleSize <= 4 ) + { + return BAD; + } + + /* PW_WholeSampleSize is the size of the sample data */ + /* PW_j is the address of the sample desc */ + return GOOD; +} + + + +void Rip_SLAM ( void ) +{ + OutputSize = PW_WholeSampleSize + PW_j + 31*4 + 31*8; + + CONVERT = GOOD; + Save_Rip ( "SLAM (Slamtilt) module", SLAM ); + + if ( Save_Status == GOOD ) + PW_i += (OutputSize - 1); /* 0 should do but call it "just to be sure" :) */ +} + + +/* + * SLAM_Packer.c 1998 (c) Sylvain "Asle" Chipaux + * + * SLAM Packer to Protracker. + ******************************************************** + * 13 april 1999 : Update + * - no more open() of input file ... so no more fread() !. + * It speeds-up the process quite a bit :). + * 28 Nov 1999 : Update + * - Speed & Size optimizings +*/ + +void Depack_SLAM ( void ) +{ + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t poss[36][2]; + uint8_t Max=0x00; + uint8_t Note,Smp,Fx,FxVal; + int16_t TracksAdd[4]; + int32_t i=0,j=0,k=0; + int32_t WholeSampleSize=0; + int32_t SmpDescAdd=0; + int32_t PatAdds[64]; + int32_t SmpDataAdds[31]; + int32_t SmpSizes[31]; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ + FILE *out; + + if ( Save_Status == BAD ) + return; + + fillPTKtable(poss); + + BZERO ( PatAdds , 64*4 ); + BZERO ( SmpDataAdds , 31*4 ); + BZERO ( SmpSizes , 31*4 ); + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + /* write title */ + Whatever = (uint8_t *) malloc (1024); + BZERO ( Whatever , 1024 ); + fwrite ( Whatever , 20 , 1 , out ); + + /* bypass ID */ + Where += 4; + + /* read $ of sample description */ + SmpDescAdd = (in_data[Where]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]; + /* "Where" isn't "+=4" coz it's assigned below */ + /*printf ( "SmpDescAdd : %ld\n" , SmpDescAdd );*/ + + /* convert and write header */ + for ( i=0 ; i<31 ; i++ ) + { + Where = PW_Start_Address + SmpDescAdd + i*4; + SmpDataAdds[i]=(in_data[Where]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]; + SmpDataAdds[i] += SmpDescAdd; + Where = PW_Start_Address + SmpDataAdds[i]; + SmpDataAdds[i] += 8; + + /* write sample name */ + fwrite ( Whatever , 22 , 1 , out ); + + /* sample size */ + SmpSizes[i] = (((in_data[Where]*256)+in_data[Where+1])*2); + WholeSampleSize += (((in_data[Where]*256)+in_data[Where+1])*2); + /* size,fine,vol,loops */ + fwrite ( &in_data[Where] , 8 , 1 , out ); + + /* no "Where += 8" coz it's reassigned inside and after loop */ + } + + /* size of the pattern list */ + Where = PW_Start_Address + 19; + fwrite ( &in_data[Where++] , 1 , 1 , out ); + Whatever[0] = 0x7f; + fwrite ( Whatever , 1 , 1 , out ); + + /* pattern table */ + Where += 1; + Max = in_data[Where++]; + fwrite ( &in_data[Where] , 128 , 1 , out ); + Where += 128; + + /*printf ( "number of pattern : %d\n" , Max );*/ + + /* write Protracker's ID */ + Whatever[0] = 'M'; + Whatever[1] = '.'; + Whatever[2] = 'K'; + Whatever[3] = '.'; + fwrite ( Whatever , 4 , 1 , out ); + + /* read pattern addresses */ + for ( i=0 ; i<64 ; i++ ) + { + PatAdds[i] = (in_data[Where]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]; + PatAdds[i] += 0x0c; + Where += 4; + } + + /* pattern data */ + for ( i=0 ; i>5)&0x03); + c4 = ((c2>>4)&0x0C); + Fx |= c4; + FxVal = c3; + + Whatever[j*16+k*4] = (Smp & 0xf0); + + if ( Note != 0 ) + { + Whatever[j*16+k*4] |= poss[Note-1][0]; + Whatever[j*16+k*4+1] = poss[Note-1][1]; + } + + Whatever[j*16+k*4+2] = ((Smp<<4)&0xf0); + Whatever[j*16+k*4+2] |= Fx; + Whatever[j*16+k*4+3] = FxVal; + } + } + fwrite ( Whatever , 1024 , 1 , out ); +/* printf ( "pattern %ld written\n" , i );*/ + } + free ( Whatever ); + + /* sample data */ + for ( i=0 ; i<31 ; i++ ) + { + Where = PW_Start_Address + SmpDataAdds[i]; + fwrite ( &in_data[Where] , SmpSizes[i] , 1 , out ); + } + + + Crap ( " SLAM (Slamtilt) " , BAD , BAD , out ); + + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ +} diff --git a/prowizard/rippers/SoundFX.c b/prowizard/rippers/SoundFX.c index 31668594..2c8dbb83 100644 --- a/prowizard/rippers/SoundFX.c +++ b/prowizard/rippers/SoundFX.c @@ -6,7 +6,7 @@ #include "globals.h" #include "extern.h" -short testSoundFX13 ( void ) +int16_t testSoundFX13 ( void ) { /* test 1 */ if ( PW_i < 0x3C ) @@ -157,23 +157,23 @@ void Rip_SoundFX13 ( void ) void Depack_SoundFX13 ( void ) { - Uchar *Whatever; - Uchar c0=0x00,c1=0x00,c2=0x00,c3=0x00; - Uchar Max=0x00; - Uchar PatPos; - long WholeSampleSize=0; - long i=0,j=0; + uint8_t *Whatever; + uint8_t c0=0x00,c1=0x00,c2=0x00,c3=0x00; + uint8_t Max=0x00; + uint8_t PatPos; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; FILE *in,*out; if ( Save_Status == BAD ) return; in = fopen ( (char *)OutName_final , "r+b" ); /* +b is safe bcoz OutName's just been saved */ - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc ( 20 ); + Whatever = (uint8_t *) malloc ( 20 ); BZERO ( Whatever , 20 ); fwrite ( Whatever , 20 , 1 , out ); free ( Whatever ); @@ -225,7 +225,7 @@ void Depack_SoundFX13 ( void ) fwrite ( &c2 , 1 , 1 , out ); } free ( Whatever ); - Whatever = (Uchar *) malloc ( 30 ); + Whatever = (uint8_t *) malloc ( 30 ); BZERO ( Whatever , 30 ); Whatever[29] = 0x01; for ( i=0 ; i<16 ; i++ ) @@ -269,7 +269,7 @@ void Depack_SoundFX13 ( void ) /* pattern data */ fseek ( in , 0x294 , 0 ); - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); for ( i=0 ; i<=Max ; i++ ) { BZERO ( Whatever , 1024 ); @@ -330,7 +330,7 @@ void Depack_SoundFX13 ( void ) /* sample data */ - Whatever = (Uchar *) malloc ( WholeSampleSize ); + Whatever = (uint8_t *) malloc ( WholeSampleSize ); BZERO ( Whatever , WholeSampleSize ); fread ( Whatever , WholeSampleSize , 1 , in ); fwrite ( Whatever , WholeSampleSize , 1 , out ); diff --git a/prowizard/rippers/SoundTracker.c b/prowizard/rippers/SoundTracker.c index 9d6c2a02..3846b3fd 100644 --- a/prowizard/rippers/SoundTracker.c +++ b/prowizard/rippers/SoundTracker.c @@ -5,7 +5,10 @@ #include "globals.h" #include "extern.h" -short testSoundTracker ( void ) +/* + * 20100902: removed *2 for loop size and loop start. was too restrictive in some case. +*/ +int16_t testSoundTracker ( void ) { /* test 1 */ /* start of stk before start of file ? */ @@ -24,9 +27,9 @@ short testSoundTracker ( void ) /* size */ PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); /* loop start */ - PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2); + PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])); /* loop size */ - PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); + PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])); /* all sample sizes */ PW_WholeSampleSize += PW_j; @@ -44,7 +47,7 @@ short testSoundTracker ( void ) return BAD; } /* loop start > size ? */ - if ( PW_m > PW_j ) + if ( (PW_m >= PW_j) && (PW_j > 0) ) { /*printf ( "#2,0 (Start:%ld) (smp:%ld) (size:%ld) (lstart:%ld)\n" , PW_Start_Address , PW_k+1 , PW_j , PW_m );*/ @@ -94,8 +97,9 @@ short testSoundTracker ( void ) return BAD; } /* PW_l holds the size of the pattern list */ + /* but let's ignore it as some STK have some pattern after the official size */ PW_k=0; - for ( PW_j=0 ; PW_j PW_k ) PW_k = in_data[PW_Start_Address+472+PW_j]; @@ -106,17 +110,6 @@ short testSoundTracker ( void ) } } /* PW_k holds the highest pattern number */ - /* test last patterns of the pattern list = 0 ? */ - PW_j += 2; /* found some obscure stk :( */ - while ( PW_j != 128 ) - { - if ( in_data[PW_Start_Address+472+PW_j] != 0 ) - { -/*printf ( "#4,2 (Start:%ld) (PW_j:%ld) (at:%ld)\n" , PW_Start_Address,PW_j ,PW_Start_Address+472+PW_j );*/ - return BAD; - } - PW_j += 1; - } /* PW_k is the number of pattern in the file (-1) */ PW_k += 1; @@ -129,18 +122,29 @@ short testSoundTracker ( void ) } for ( PW_j=0 ; PW_j<(PW_k*256) ; PW_j++ ) { - /* sample > 1f or pitch > 358 ? */ - if ( in_data[PW_Start_Address+600+PW_j*4] > 0x13 ) + /* sample > 1f ? */ + if ( (in_data[PW_Start_Address+600+PW_j*4]&0xf0) > 0x10 ) { /*printf ( "#5.1 (Start:%ld)\n" , PW_Start_Address );*/ return BAD; } + if ( (in_data[PW_Start_Address+600+PW_j*4]&0x0f) > 0x03 ) + { +/*printf ( "#5.1,0 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } PW_l = ((in_data[PW_Start_Address+600+PW_j*4]&0x0f)*256)+in_data[PW_Start_Address+601+PW_j*4]; if ( (PW_l>0) && (PW_l<0x71) ) { /*printf ( "#5,2 (Start:%ld)\n" , PW_Start_Address );*/ return BAD; } + /*20120930 - additional test - there's a note but no sample ref */ + if ( ((in_data[PW_Start_Address+600+PW_j*4]>0) || (in_data[PW_Start_Address+601+PW_j*4]>0)) && ((in_data[PW_Start_Address+602+PW_j*4]&0xf0)==0) ) + { +/*printf ( "#5.5 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } } return GOOD; diff --git a/prowizard/rippers/SoundTracker26.c b/prowizard/rippers/SoundTracker26.c index 5986c62b..8d19a5af 100644 --- a/prowizard/rippers/SoundTracker26.c +++ b/prowizard/rippers/SoundTracker26.c @@ -9,7 +9,7 @@ /* Soundtracker 2.6 & IceTracker 1.0 */ -short testSTK26 ( void ) +int16_t testSTK26 ( void ) { /* test 1 */ if ( PW_i < 1464 ) @@ -79,16 +79,16 @@ void Rip_STK26 ( void ) */ void Depack_STK26 ( void ) { - Uchar *Whatever; - long WholeSampleSize=0; - long Where=PW_Start_Address; - long i=0,j,k; + uint8_t *Whatever; + int32_t WholeSampleSize=0; + int32_t Where=PW_Start_Address; + int32_t i=0,j,k; FILE *out; if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); @@ -101,7 +101,7 @@ void Depack_STK26 ( void ) /* printf ( "Whole sanple size : %ld\n" , WholeSampleSize );*/ /* generate patlist */ - Whatever = (Uchar *) malloc (1536); + Whatever = (uint8_t *) malloc (1536); BZERO ( Whatever , 1536 ); Whatever[1024] = in_data[Where+950]; for ( i=0 ; i=PW_in_size) ) @@ -29,7 +29,7 @@ short testSTARPACK ( void ) /*printf ( "#2,0 (Start:%ld)\n" , PW_Start_Address );*/ return BAD; } - if ( PW_k>127 ) + if ( PW_k>128 ) { /*printf ( "#2,1 (Start:%ld)\n" , PW_Start_Address );*/ return BAD; @@ -205,17 +205,17 @@ void Rip_STARPACK ( void ) */ void Depack_STARPACK ( void ) { - Uchar c1=0x00,c2=0x00; - Uchar Pat_Pos; - Uchar *Whatever; - Uchar *Pattern; - long i=0,j=0,k=0; - long Total_Sample_Size=0; - long Pats_Address[128]; - long Read_Pats_Address[128]; - long SampleDataAddress=0; - long Where = PW_Start_Address; - long MaxPatAddy=0; + uint8_t c1=0x00,c2=0x00; + uint8_t Pat_Pos; + uint8_t *Whatever; + uint8_t *Pattern; + int32_t i=0,j=0,k=0; + int32_t Total_Sample_Size=0; + int32_t Pats_Address[128]; + int32_t Read_Pats_Address[128]; + int32_t SampleDataAddress=0; + int32_t Where = PW_Start_Address; + int32_t MaxPatAddy=0; FILE /**in,*/*out; if ( Save_Status == BAD ) @@ -223,11 +223,11 @@ void Depack_STARPACK ( void ) BZERO ( Pats_Address , 128*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO (Whatever, 1024); /* read and write title */ @@ -281,7 +281,7 @@ void Depack_STARPACK ( void ) c1=0; /* will count patterns */ k=0; /* current note number */ - Pattern = (Uchar *) malloc (65536); + Pattern = (uint8_t *) malloc (65536); BZERO (Pattern, 65536); i=0; for ( j=0 ; j<(MaxPatAddy+0x400) ; j+=4 ) @@ -320,7 +320,7 @@ void Depack_STARPACK ( void ) for ( i=0 ; i<128 ; i++ ) if ( Pats_Address[c2] == Read_Pats_Address[i]) { - Whatever[c2] = (Uchar) i; + Whatever[c2] = (uint8_t) i; break; } fwrite ( &Whatever[0], 128, 1, out ); diff --git a/prowizard/rippers/StimPacker.c b/prowizard/rippers/StimPacker.c index eda25009..5f4c7c27 100644 --- a/prowizard/rippers/StimPacker.c +++ b/prowizard/rippers/StimPacker.c @@ -4,13 +4,13 @@ /* update on the 3rd of april 2000 */ -/* bug pointes out by Thomas Neumann ... thx */ +/* bug pointed out by Thomas Neumann ... thx */ #include "globals.h" #include "extern.h" -short testSTIM ( void ) +int16_t testSTIM ( void ) { PW_Start_Address = PW_i; @@ -107,19 +107,19 @@ void Rip_STIM ( void ) void Depack_STIM ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - Uchar poss[36][2]; - Uchar Max=0x00; - Uchar Note,Smp,Fx,FxVal; - short TracksAdd[4]; - long i=0,j=0,k=0; - long WholeSampleSize=0; - long SmpDescAdd=0; - long PatAdds[64]; - long SmpDataAdds[31]; - long SmpSizes[31]; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t *Whatever; + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t poss[36][2]; + uint8_t Max=0x00; + uint8_t Note,Smp,Fx,FxVal; + int16_t TracksAdd[4]; + int32_t i=0,j=0,k=0; + int32_t WholeSampleSize=0; + int32_t SmpDescAdd=0; + int32_t PatAdds[64]; + int32_t SmpDataAdds[31]; + int32_t SmpSizes[31]; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; if ( Save_Status == BAD ) @@ -131,11 +131,11 @@ void Depack_STIM ( void ) BZERO ( SmpDataAdds , 31*4 ); BZERO ( SmpSizes , 31*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* write title */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); diff --git a/prowizard/rippers/StoneArtsPlayer.c b/prowizard/rippers/StoneArtsPlayer.c index ceb6a2b8..14019f25 100644 --- a/prowizard/rippers/StoneArtsPlayer.c +++ b/prowizard/rippers/StoneArtsPlayer.c @@ -1,161 +1,161 @@ -/* testStoneArtsPlayer() */ -/* Rip_StoneArtsPlayer() */ -/* Depack_StoneArtsPlayer() */ - - -#include "globals.h" -#include "extern.h" - - -short testStoneArtsPlayer ( void ) -{ - /* test 1 */ - if ( PW_i < 1080 ) - { - return BAD; - } - - /* test 2 - ntk byte */ - PW_Start_Address = PW_i-1080; - if ( (in_data[PW_Start_Address+951] != 0x7f) && (in_data[PW_Start_Address+951] != 0x00) ) - { - return BAD; - } - - /* test 3 - patternlist size */ - if ( in_data[PW_Start_Address+950] > 0x7f ) - { - return BAD; - } - - for ( PW_k=0 ; PW_k<31 ; PW_k++ ) - { - /* size */ - PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); - /* loop start */ - PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2); - /* loop size */ - PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); - - if ( test_smps(PW_j*2, PW_m, PW_n, in_data[PW_Start_Address+45+30*PW_k], in_data[PW_Start_Address+44+30*PW_k] ) == BAD ) - { - /*printf ( "start : %ld\n", PW_Start_Address );*/ - return BAD; - } - - PW_WholeSampleSize += PW_j; - } - - return GOOD; -} - - - -void Rip_StoneArtsPlayer ( void ) -{ - /* PW_WholeSampleSize is already the whole sample size */ - PW_l=0; - for ( PW_k=0 ; PW_k<128 ; PW_k++ ) - if ( in_data[PW_Start_Address+952+PW_k] > PW_l ) - PW_l = in_data[PW_Start_Address+952+PW_k]; - PW_l += 1; - OutputSize = (PW_l*1024) + 1084 + PW_WholeSampleSize; - - CONVERT = GOOD; - Save_Rip ( "Stone Arts Player module", StoneArtsPlayer ); - - if ( Save_Status == GOOD ) - PW_i += 1082; /* 1080 could be enough */ -} - - - -/* - * StoneArtsPlayer.c 2007 (c) Asle - * - * Converts MODs converted with Stone Arts Player - * - * example module provided by Muerto ;) -*/ -void Depack_StoneArtsPlayer ( void ) -{ - Uchar *Whatever; - Uchar poss[37][2]; - Uchar Max=0x00; - long WholeSampleSize=0; - long i=0,j=0; - long Where=PW_Start_Address; - FILE *out; - - fillPTKtable(poss); - - if ( Save_Status == BAD ) - return; - - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); - out = PW_fopen ( Depacked_OutName , "w+b" ); - - /* read and write whole header */ - fwrite ( &in_data[Where] , 950 , 1 , out ); - - /* get whole sample size */ - for ( i=0 ; i<31 ; i++ ) - { - WholeSampleSize += (((in_data[Where+42+i*30]*256)+in_data[Where+43+i*30])*2); - } - /*printf ( "Whole sanple size : %ld\n" , WholeSampleSize );*/ - - /* read and write size of pattern list */ - /* read and write ntk byte and pattern list */ - fwrite ( &in_data[Where+950] , 130 , 1 , out ); - Where += 952; - - /* write ID */ - Whatever = (Uchar *) malloc (4); - Whatever[0] = 'M'; - Whatever[1] = '.'; - Whatever[2] = 'K'; - Whatever[3] = '.'; - fwrite ( Whatever , 4 , 1 , out ); - - /* get number of pattern */ - Max = 0x00; - for ( i=0 ; i<128 ; i++ ) - { - if ( in_data[Where+i] > Max ) - Max = in_data[Where+i]; - } - /*printf ( "Number of pattern : %d\n" , Max );*/ - - /* pattern data */ - Where = PW_Start_Address + 1084; - for ( i=0 ; i<=Max ; i++ ) - { - for ( j=0 ; j<256 ; j++ ) - { - Whatever[0] = in_data[Where]; - Whatever[2] = in_data[Where+2]; - Whatever[3] = in_data[Where+3]; - Whatever[0] |= poss[in_data[Where+1]/2][0]; - Whatever[1] = poss[in_data[Where+1]/2][1]; - fwrite ( Whatever , 4 , 1 , out ); - Where += 4; - } - } - free ( Whatever ); - - - /* sample data */ - fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); - - - /* crap */ - Crap ( "Stone Arts Player " , BAD , BAD , out ); - - fflush ( out ); - fclose ( out ); - - printf ( "done\n" ); - return; /* useless ... but */ -} - +/* testStoneArtsPlayer() */ +/* Rip_StoneArtsPlayer() */ +/* Depack_StoneArtsPlayer() */ + + +#include "globals.h" +#include "extern.h" + + +int16_t testStoneArtsPlayer ( void ) +{ + /* test 1 */ + if ( PW_i < 1080 ) + { + return BAD; + } + + /* test 2 - ntk byte */ + PW_Start_Address = PW_i-1080; + if ( (in_data[PW_Start_Address+951] != 0x7f) && (in_data[PW_Start_Address+951] != 0x00) ) + { + return BAD; + } + + /* test 3 - patternlist size */ + if ( in_data[PW_Start_Address+950] > 0x7f ) + { + return BAD; + } + + for ( PW_k=0 ; PW_k<31 ; PW_k++ ) + { + /* size */ + PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); + /* loop start */ + PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2); + /* loop size */ + PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); + + if ( test_smps(PW_j*2, PW_m, PW_n, in_data[PW_Start_Address+45+30*PW_k], in_data[PW_Start_Address+44+30*PW_k] ) == BAD ) + { + /*printf ( "start : %ld\n", PW_Start_Address );*/ + return BAD; + } + + PW_WholeSampleSize += PW_j; + } + + return GOOD; +} + + + +void Rip_StoneArtsPlayer ( void ) +{ + /* PW_WholeSampleSize is already the whole sample size */ + PW_l=0; + for ( PW_k=0 ; PW_k<128 ; PW_k++ ) + if ( in_data[PW_Start_Address+952+PW_k] > PW_l ) + PW_l = in_data[PW_Start_Address+952+PW_k]; + PW_l += 1; + OutputSize = (PW_l*1024) + 1084 + PW_WholeSampleSize; + + CONVERT = GOOD; + Save_Rip ( "Stone Arts Player module", StoneArtsPlayer ); + + if ( Save_Status == GOOD ) + PW_i += 1082; /* 1080 could be enough */ +} + + + +/* + * StoneArtsPlayer.c 2007 (c) Asle + * + * Converts MODs converted with Stone Arts Player + * + * example module provided by Muerto ;) +*/ +void Depack_StoneArtsPlayer ( void ) +{ + uint8_t *Whatever; + uint8_t poss[37][2]; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where=PW_Start_Address; + FILE *out; + + fillPTKtable(poss); + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + /* read and write whole header */ + fwrite ( &in_data[Where] , 950 , 1 , out ); + + /* get whole sample size */ + for ( i=0 ; i<31 ; i++ ) + { + WholeSampleSize += (((in_data[Where+42+i*30]*256)+in_data[Where+43+i*30])*2); + } + /*printf ( "Whole sanple size : %ld\n" , WholeSampleSize );*/ + + /* read and write size of pattern list */ + /* read and write ntk byte and pattern list */ + fwrite ( &in_data[Where+950] , 130 , 1 , out ); + Where += 952; + + /* write ID */ + Whatever = (uint8_t *) malloc (4); + Whatever[0] = 'M'; + Whatever[1] = '.'; + Whatever[2] = 'K'; + Whatever[3] = '.'; + fwrite ( Whatever , 4 , 1 , out ); + + /* get number of pattern */ + Max = 0x00; + for ( i=0 ; i<128 ; i++ ) + { + if ( in_data[Where+i] > Max ) + Max = in_data[Where+i]; + } + /*printf ( "Number of pattern : %d\n" , Max );*/ + + /* pattern data */ + Where = PW_Start_Address + 1084; + for ( i=0 ; i<=Max ; i++ ) + { + for ( j=0 ; j<256 ; j++ ) + { + Whatever[0] = in_data[Where]; + Whatever[2] = in_data[Where+2]; + Whatever[3] = in_data[Where+3]; + Whatever[0] |= poss[in_data[Where+1]/2][0]; + Whatever[1] = poss[in_data[Where+1]/2][1]; + fwrite ( Whatever , 4 , 1 , out ); + Where += 4; + } + } + free ( Whatever ); + + + /* sample data */ + fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); + + + /* crap */ + Crap ( "Stone Arts Player " , BAD , BAD , out ); + + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ +} + diff --git a/prowizard/rippers/StoneCracker270.c b/prowizard/rippers/StoneCracker270.c index 4ec78521..116eeda8 100644 --- a/prowizard/rippers/StoneCracker270.c +++ b/prowizard/rippers/StoneCracker270.c @@ -6,7 +6,7 @@ #include "extern.h" -short testStoneCracker270 ( void ) +int16_t testStoneCracker270 ( void ) { PW_Start_Address = PW_i; @@ -83,8 +83,8 @@ void Rip_StoneCracker270 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -93,7 +93,7 @@ void Rip_StoneCracker270 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -105,7 +105,7 @@ void Rip_StoneCracker270 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/StoneCracker299.c b/prowizard/rippers/StoneCracker299.c index 4300ec14..b0786f04 100644 --- a/prowizard/rippers/StoneCracker299.c +++ b/prowizard/rippers/StoneCracker299.c @@ -6,7 +6,7 @@ #include "extern.h" -short testSTC299 ( void ) +int16_t testSTC299 ( void ) { PW_Start_Address = PW_i; @@ -81,8 +81,8 @@ void Rip_STC299 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -91,7 +91,7 @@ void Rip_STC299 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -103,7 +103,7 @@ void Rip_STC299 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/StoneCracker299b.c b/prowizard/rippers/StoneCracker299b.c index b8fe468e..e42031a8 100644 --- a/prowizard/rippers/StoneCracker299b.c +++ b/prowizard/rippers/StoneCracker299b.c @@ -6,7 +6,7 @@ #include "extern.h" -short testSTC299b ( void ) +int16_t testSTC299b ( void ) { PW_Start_Address = PW_i; @@ -80,8 +80,8 @@ void Rip_STC299b ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -90,7 +90,7 @@ void Rip_STC299b ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -102,7 +102,7 @@ void Rip_STC299b ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/StoneCracker299d.c b/prowizard/rippers/StoneCracker299d.c index 981d9c6b..da936274 100644 --- a/prowizard/rippers/StoneCracker299d.c +++ b/prowizard/rippers/StoneCracker299d.c @@ -5,7 +5,7 @@ #include "extern.h" -short testSTC299d ( void ) +int16_t testSTC299d ( void ) { PW_Start_Address = PW_i; @@ -80,8 +80,8 @@ void Rip_STC299d ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -90,7 +90,7 @@ void Rip_STC299d ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -102,7 +102,7 @@ void Rip_STC299d ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/StoneCracker300.c b/prowizard/rippers/StoneCracker300.c index bbbc41b4..3e056476 100644 --- a/prowizard/rippers/StoneCracker300.c +++ b/prowizard/rippers/StoneCracker300.c @@ -6,7 +6,7 @@ #include "extern.h" -short testSTC300 ( void ) +int16_t testSTC300 ( void ) { PW_Start_Address = PW_i; @@ -81,8 +81,8 @@ void Rip_STC300 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -91,7 +91,7 @@ void Rip_STC300 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -103,7 +103,7 @@ void Rip_STC300 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/StoneCracker310.c b/prowizard/rippers/StoneCracker310.c index 6fe800f1..43643054 100644 --- a/prowizard/rippers/StoneCracker310.c +++ b/prowizard/rippers/StoneCracker310.c @@ -5,7 +5,7 @@ #include "extern.h" -short testSTC310 ( void ) +int16_t testSTC310 ( void ) { PW_Start_Address = PW_i; @@ -79,8 +79,8 @@ void Rip_STC310 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -89,7 +89,7 @@ void Rip_STC310 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -101,7 +101,7 @@ void Rip_STC310 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/SuperCruncher27.c b/prowizard/rippers/SuperCruncher27.c index 5cc235f5..a9d8bd6f 100644 --- a/prowizard/rippers/SuperCruncher27.c +++ b/prowizard/rippers/SuperCruncher27.c @@ -6,7 +6,7 @@ #include "extern.h" -short testSuperCruncher27 ( void ) +int16_t testSuperCruncher27 ( void ) { PW_Start_Address = PW_i; @@ -80,7 +80,7 @@ void Rip_SuperCruncher27 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; + uint8_t * Amiga_EXE_Header_Block; OutputSize = PW_l; @@ -89,7 +89,7 @@ void Rip_SuperCruncher27 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; diff --git a/prowizard/rippers/SyncroPacker46.c b/prowizard/rippers/SyncroPacker46.c index 15a7f95c..0efbed65 100644 --- a/prowizard/rippers/SyncroPacker46.c +++ b/prowizard/rippers/SyncroPacker46.c @@ -6,7 +6,7 @@ #include "extern.h" -short testSyncroPacker ( void ) +int16_t testSyncroPacker ( void ) { PW_Start_Address = PW_i; @@ -49,7 +49,7 @@ short testSyncroPacker ( void ) if ( ((PW_l - 32)+PW_Start_Address) > PW_in_size ) { -/*printf ( "#3 Start:%ld\n" , PW_Start_Address );*/ +/*printf ( "#3 Start:%ld (PW_l:%ld)\n" , PW_Start_Address,PW_l );*/ return BAD; } @@ -93,8 +93,8 @@ void Rip_SyncroPacker ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -103,7 +103,7 @@ void Rip_SyncroPacker ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -115,7 +115,7 @@ void Rip_SyncroPacker ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); diff --git a/prowizard/rippers/THX.c b/prowizard/rippers/THX.c new file mode 100644 index 00000000..4a39f317 --- /dev/null +++ b/prowizard/rippers/THX.c @@ -0,0 +1,112 @@ +/* + * THX - AHX ripper + * 20130413 - slightly adapted to HVL ripping +*/ +/* testTHX() */ +/* Rip_THX() */ + + + +#include "globals.h" +#include "extern.h" + + +int16_t testTHX ( void ) +{ + PW_Start_Address = PW_i; + + /* file size < 113 */ + if ( (PW_in_size - PW_Start_Address) < 30 ) + { + /*printf ( "#1 (start:%ld) (size:%ld)\n" , PW_Start_Address , PW_in_size-PW_Start_Address);*/ + return BAD; + } + + /* get nbr byte to bypass to reach txts */ + PW_m = ( ( in_data[PW_Start_Address+4]*256) + in_data[PW_Start_Address+5] ); + + /* test in-size again */ + if ( PW_Start_Address+PW_m > PW_in_size ) + { +/* printf ( "#2 (start:%d) (1st smp addy:%d)\n" , PW_Start_Address , PW_m);*/ + return BAD; + } + + /* test patternlist size */ + PW_j = (in_data[PW_Start_Address+6] & 0x0f)*256 + in_data[PW_Start_Address+7]; + /* only 999 position are possible - but I've seen 1024 ... */ + if ( PW_j > 1024 ) + { +/* printf ( "#3 (start:%d) (1st smp addy:%d)\n" , PW_Start_Address , PW_m);*/ + return BAD; + } + + /* test patternlist restart - AHX only */ + if (in_data[PW_Start_Address] == 'T') + { + PW_k = (in_data[PW_Start_Address+8] & 0x0f)*256 + in_data[PW_Start_Address+9]; + /* only 999 position are possible - but I've seen 1024 ... */ + if ( PW_k >= PW_j ) + { + /*printf ( "#4 (start:%d) (1st smp addy:%d)\n" , PW_Start_Address , PW_m);*/ + return BAD; + } + } + + PW_k = in_data[PW_Start_Address+10]; + /* track size */ + if ( PW_k > 64 ) + { + /*printf ( "#5 (start:%d) (track size:%d)\n" , PW_Start_Address , PW_k);*/ + return BAD; + } + + return GOOD; +} + + + +void Rip_THX ( void ) +{ + /* PW_m is the address of txt */ + + uint32_t Where = PW_Start_Address+PW_m; + uint8_t SMP = 0x00,a = 0x00; + SMP = in_data[PW_Start_Address+12]; + + OutputSize = PW_m; + + /* title */ + if (in_data[Where] == 0x00) + OutputSize += 1; + else + while (in_data[Where] != 0x00) + Where += 1; + + Where += 1; + if (SMP != 0x00) + { + while (a PW_in_size ) + break; + if (in_data[Where] == 0x00) + a+=0x01; + Where += 1; + } + } + + OutputSize = Where - PW_Start_Address; + + CONVERT = BAD; + + if (in_data[PW_Start_Address] == 'T') + Save_Rip ( "AHX v1/v2 module", AHX ); + if (in_data[PW_Start_Address] == 'H') + Save_Rip ( "Hively Tracker module", HVL ); + + + if ( Save_Status == GOOD ) + PW_i += 1; /* after THX/HVL tag */ +} + diff --git a/prowizard/rippers/TMK.c b/prowizard/rippers/TMK.c index 5b692fbd..a093ecf2 100644 --- a/prowizard/rippers/TMK.c +++ b/prowizard/rippers/TMK.c @@ -7,7 +7,7 @@ -short testTMK ( void ) +int16_t testTMK ( void ) { /* test 1 */ PW_Start_Address = PW_i; @@ -120,23 +120,23 @@ void Rip_TMK ( void ) void Depack_TMK ( void ) { - Uchar *Pattern; - long i=0,j=0,k=0,l=0; - long Total_Sample_Size=0; - Uchar poss[37][2]; + uint8_t *Pattern; + int32_t i=0,j=0,k=0,l=0; + int32_t Total_Sample_Size=0; + uint8_t poss[37][2]; int patdataaddy; int reftableaddy; int maxlineaddy; int sizlastline; - long *samplesizes; - Uchar patternlist[128]; - Uchar maxpat = 0x00; - Uchar NOP=0x00; /* number of pattern */ - Uchar NOS=0x00; /* number of sample */ - Uchar *Whatever; - Uchar GLOBAL_DELTA = OFF; - long Where = PW_Start_Address; + int32_t *samplesizes; + uint8_t patternlist[128]; + uint8_t maxpat = 0x00; + uint8_t NOP=0x00; /* number of pattern */ + uint8_t NOS=0x00; /* number of sample */ + uint8_t *Whatever; + uint8_t GLOBAL_DELTA = OFF; + int32_t Where = PW_Start_Address; FILE *out;/*,*info;*/ fillPTKtable(poss); @@ -146,11 +146,11 @@ void Depack_TMK ( void ) BZERO ( patternlist , 128 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /*info = fopen ( "info", "w+b");*/ - Whatever = (Uchar *) malloc (128); + Whatever = (uint8_t *) malloc (128); BZERO (Whatever,128); /* title */ @@ -166,7 +166,7 @@ void Depack_TMK ( void ) if ( (in_data[Where+1]&0x80) == 0x80 ) GLOBAL_DELTA = ON; Where += 2; - samplesizes = (long *) malloc (NOS*sizeof(long)); + samplesizes = (int32_t *) malloc (NOS*sizeof(int32_t )); /*fprintf ( info,"NOP:%d NOS %d (Where = %ld)\n",NOP,NOS,Where);*/ for ( i=0 ; i= 32 ) + { + if ( (in_data[PW_Start_Address-32] != 0x00 ) || + (in_data[PW_Start_Address-31] != 0x00 ) || + (in_data[PW_Start_Address-30] != 0x03 ) || + (in_data[PW_Start_Address-29] != 0xF3 ) || + (in_data[PW_Start_Address-28] != 0x00 ) || + (in_data[PW_Start_Address-27] != 0x00 ) || + (in_data[PW_Start_Address-26] != 0x00 ) || + (in_data[PW_Start_Address-25] != 0x00 ) || + (in_data[PW_Start_Address-24] != 0x00 ) || + (in_data[PW_Start_Address-23] != 0x00 ) || + (in_data[PW_Start_Address-22] != 0x00 ) || + (in_data[PW_Start_Address-21] != 0x01 ) || + (in_data[PW_Start_Address-20] != 0x00 ) || + (in_data[PW_Start_Address-19] != 0x00 ) || + (in_data[PW_Start_Address-18] != 0x00 ) || + (in_data[PW_Start_Address-17] != 0x00 ) ) + { + Amiga_EXE_Header = BAD; + } + else + Amiga_EXE_Header = GOOD; + } + else + Amiga_EXE_Header = BAD; + + return GOOD; + /* PW_l is the size of the pack */ +} void Rip_Tetrapack102 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -87,7 +150,7 @@ void Rip_Tetrapack102 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -99,7 +162,7 @@ void Rip_Tetrapack102 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); @@ -116,3 +179,47 @@ void Rip_Tetrapack102 ( void ) if ( Save_Status == GOOD ) PW_i += (OutputSize - 36); /* 32 should do but call it "just to be sure" :) */ } + +void Rip_Tetrapack101 ( void ) +{ + /* PW_l is still the whole size */ + + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; + + OutputSize = PW_l; + + CONVERT = BAD; + + if ( Amiga_EXE_Header == BAD ) + { + OutputSize -= 32; + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); + BZERO ( Amiga_EXE_Header_Block , 32 ); + Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; + Amiga_EXE_Header_Block[3] = 0xF3; + Amiga_EXE_Header_Block[11] = 0x01; + Amiga_EXE_Header_Block[27] = 0xE9; + + /* WARNING !!! WORKS ONLY ON PC !!! */ + /* 68k machines code : c1 = *(Whatever+2); */ + /* 68k machines code : c2 = *(Whatever+3); */ + PW_j = PW_l - 36; + PW_j /= 4; + Whatever = (uint8_t *) &PW_j; + Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); + Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); + Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); + Amiga_EXE_Header_Block[23] = Amiga_EXE_Header_Block[31] = *Whatever; + Save_Rip_Special ( "Tetrapack 1.01 Exe-file", TPACK101, Amiga_EXE_Header_Block , 32 ); + free ( Amiga_EXE_Header_Block ); + } + else + { + PW_Start_Address -= 32; + Save_Rip ( "Tetrapack 1.01 Exe-file", TPACK101 ); + } + + if ( Save_Status == GOOD ) + PW_i += 1; +} diff --git a/prowizard/rippers/TetraPack21.c b/prowizard/rippers/TetraPack21.c index 70f48413..5515cacd 100644 --- a/prowizard/rippers/TetraPack21.c +++ b/prowizard/rippers/TetraPack21.c @@ -5,7 +5,7 @@ #include "extern.h" -short testTetrapack_2_1 ( void ) +int16_t testTetrapack_2_1 ( void ) { PW_Start_Address = PW_i; @@ -76,8 +76,8 @@ void Rip_Tetrapack_2_1 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -86,7 +86,7 @@ void Rip_Tetrapack_2_1 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -98,7 +98,7 @@ void Rip_Tetrapack_2_1 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); @@ -113,5 +113,5 @@ void Rip_Tetrapack_2_1 ( void ) } if ( Save_Status == GOOD ) - PW_i += (OutputSize - 36); /* 32 should do but call it "just to be sure" :) */ + PW_i += 1; /* bypass only triggering byte */ } diff --git a/prowizard/rippers/TetraPack22.c b/prowizard/rippers/TetraPack22.c index 662cb1cd..2b50b43b 100644 --- a/prowizard/rippers/TetraPack22.c +++ b/prowizard/rippers/TetraPack22.c @@ -5,7 +5,7 @@ #include "extern.h" -short testTetrapack_2_2 ( void ) +int16_t testTetrapack_2_2 ( void ) { PW_Start_Address = PW_i; @@ -102,8 +102,8 @@ void Rip_Tetrapack_2_2 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -112,7 +112,7 @@ void Rip_Tetrapack_2_2 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 32; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 32 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 32 ); BZERO ( Amiga_EXE_Header_Block , 32 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[26] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -124,7 +124,7 @@ void Rip_Tetrapack_2_2 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 36; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[28] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[29] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[30] = *(Whatever+1); @@ -139,5 +139,5 @@ void Rip_Tetrapack_2_2 ( void ) } if ( Save_Status == GOOD ) - PW_i += (OutputSize - 36); /* 32 should do but call it "just to be sure" :) */ + PW_i += 1; /* 32 should do but call it "just to be sure" :) */ } diff --git a/prowizard/rippers/TheDarkDemon.c b/prowizard/rippers/TheDarkDemon.c index 35af53b5..85486b55 100644 --- a/prowizard/rippers/TheDarkDemon.c +++ b/prowizard/rippers/TheDarkDemon.c @@ -7,7 +7,7 @@ #include "extern.h" -short testTheDarkDemon ( void ) +int16_t testTheDarkDemon ( void ) { /* test #1 */ if ( PW_i < 137 ) @@ -43,6 +43,13 @@ short testTheDarkDemon ( void ) /* loop size (replen) */ PW_n = (((in_data[PW_Start_Address+PW_j*14+142]*256)+in_data[PW_Start_Address+PW_j*14+143])*2); + /* volume > 40h ? */ + if ( in_data[PW_Start_Address+PW_j*14+136] > 0x0F ) + { +/*printf ( "#2,finetune (start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + /* volume > 40h ? */ if ( in_data[PW_Start_Address+PW_j*14+137] > 0x40 ) { @@ -217,16 +224,16 @@ void Rip_TheDarkDemon ( void ) void Depack_TheDarkDemon ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00; - Uchar poss[37][2]; - Uchar *Whatever; - Uchar Pattern[1024]; - Uchar PatMax=0x00; - long i=0,j=0,k=0,z; - long Whole_Sample_Size=0; - long SampleAddresses[31]; - long SampleSizes[31]; - long Where = PW_Start_Address; + uint8_t c1=0x00,c2=0x00,c3=0x00; + uint8_t poss[37][2]; + uint8_t *Whatever; + uint8_t Pattern[1024]; + uint8_t PatMax=0x00; + int32_t i=0,j=0,k=0,z; + int32_t Whole_Sample_Size=0; + int32_t SampleAddresses[31]; + int32_t SampleSizes[31]; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -237,11 +244,11 @@ void Depack_TheDarkDemon ( void ) BZERO ( SampleAddresses , 31*4 ); BZERO ( SampleSizes , 31*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* write ptk header */ - Whatever = (Uchar *) malloc ( 1080 ); + Whatever = (uint8_t *) malloc ( 1080 ); BZERO (Whatever , 1080); fwrite ( Whatever , 1080 , 1 , out ); @@ -289,8 +296,8 @@ void Depack_TheDarkDemon ( void ) j /= 2; /* use of htonl() suggested by Xigh !.*/ z = htonl(j); - c1 = *((Uchar *)&z+2); - c2 = *((Uchar *)&z+3); + c1 = *((uint8_t *)&z+2); + c2 = *((uint8_t *)&z+3); /* write loop start */ fwrite ( &c1 , 1 , 1 , out ); diff --git a/prowizard/rippers/ThePlayer22a.c b/prowizard/rippers/ThePlayer22a.c index e004d85f..698f9015 100644 --- a/prowizard/rippers/ThePlayer22a.c +++ b/prowizard/rippers/ThePlayer22a.c @@ -55,23 +55,23 @@ void Rip_P22A ( void ) void Depack_P22 ( void ) { - Uchar c1,c2,c3,c4; - Uchar *Whatever; - Uchar PatPos = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar sample,note,Note[2]; - Uchar Pattern_Data[128][1024]; - short Pattern_Addresses[128]; - long Track_Data_Address = 0; - long Track_Table_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long SampleAddress[31]; - long SampleSize[31]; - long i=0,j,k,l; - long voice[4]; - long Where = PW_Start_Address; + uint8_t c1,c2,c3,c4; + uint8_t *Whatever; + uint8_t PatPos = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t sample,note,Note[2]; + uint8_t Pattern_Data[128][1024]; + int16_t Pattern_Addresses[128]; + int32_t Track_Data_Address = 0; + int32_t Track_Table_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t SampleAddress[31]; + int32_t SampleSize[31]; + int32_t i=0,j,k,l; + int32_t voice[4]; + int32_t Where = PW_Start_Address; FILE *out;/*,*debug;*/ if ( Save_Status == BAD ) @@ -84,7 +84,7 @@ void Depack_P22 ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /*debug = fopen ( "debug", "w+b" );*/ @@ -129,7 +129,7 @@ void Depack_P22 ( void ) /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -165,8 +165,8 @@ void Depack_P22 ( void ) k /= 2; /* use of htonl() suggested by Xigh !.*/ l = htonl(k); - c1 = *((Uchar *)&l+2); - c2 = *((Uchar *)&l+3); + c1 = *((uint8_t *)&l+2); + c2 = *((uint8_t *)&l+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); fwrite ( &in_data[Where+10] , 2 , 1 , out ); diff --git a/prowizard/rippers/ThePlayer30a.c b/prowizard/rippers/ThePlayer30a.c index 436bb99f..81a30a96 100644 --- a/prowizard/rippers/ThePlayer30a.c +++ b/prowizard/rippers/ThePlayer30a.c @@ -55,23 +55,23 @@ void Rip_P30A ( void ) */ void Depack_P30 ( void ) { - Uchar c1,c2,c3,c4,c5; - Uchar *Whatever; - Uchar PatPos = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar sample,note,Note[2]; - Uchar Pattern_Data[128][1024]; - short Pattern_Addresses[128]; - long Track_Data_Address = 0; - long Track_Table_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long SampleAddress[31]; - long SampleSize[31]; - long i=0,j,k,a,c,z;/*l*/ - long voice[4]; - long Where = PW_Start_Address; + uint8_t c1,c2,c3,c4,c5; + uint8_t *Whatever; + uint8_t PatPos = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t sample,note,Note[2]; + uint8_t Pattern_Data[128][1024]; + int16_t Pattern_Addresses[128]; + int32_t Track_Data_Address = 0; + int32_t Track_Table_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t SampleAddress[31]; + int32_t SampleSize[31]; + int32_t i=0,j,k,a,c,z;/*l*/ + int32_t voice[4]; + int32_t Where = PW_Start_Address; FILE *out;/*,*debug;*/ if ( Save_Status == BAD ) @@ -84,7 +84,7 @@ void Depack_P30 ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); if ( out == NULL) /* debug = fopen ( "debug", "w+b" );*/ @@ -130,7 +130,7 @@ void Depack_P30 ( void ) /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -166,8 +166,8 @@ void Depack_P30 ( void ) k /= 2; /* use of htonl() suggested by Xigh !.*/ z = htonl(k); - c1 = *((Uchar *)&z+2); - c2 = *((Uchar *)&z+3); + c1 = *((uint8_t *)&z+2); + c2 = *((uint8_t *)&z+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); fwrite ( &in_data[Where+10] , 2 , 1 , out ); diff --git a/prowizard/rippers/ThePlayer40.c b/prowizard/rippers/ThePlayer40.c index 2ca9cb18..bf4573a6 100644 --- a/prowizard/rippers/ThePlayer40.c +++ b/prowizard/rippers/ThePlayer40.c @@ -7,7 +7,7 @@ #include "extern.h" -short testP40A ( void ) +int16_t testP40A ( void ) { PW_Start_Address = PW_i; @@ -156,22 +156,22 @@ void Rip_P40B ( void ) */ void Depack_P40 ( void ) { - Uchar c1,c2,c3,c4,c5; - Uchar *Whatever; - Uchar PatPos = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar sample,note,Note[2]; - Uchar Track_Data[512][256]; - short Track_Addresses[128][4]; - long Track_Data_Address = 0; - long Track_Table_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long SampleAddress[31]; - long SampleSize[31]; - long i=0,j,k,l,a,c,z; - long Where = PW_Start_Address; + uint8_t c1,c2,c3,c4,c5; + uint8_t *Whatever; + uint8_t PatPos = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t sample,note,Note[2]; + uint8_t Track_Data[512][256]; + int16_t Track_Addresses[128][4]; + int32_t Track_Data_Address = 0; + int32_t Track_Table_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t SampleAddress[31]; + int32_t SampleSize[31]; + int32_t i=0,j,k,l,a,c,z; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -184,7 +184,7 @@ void Depack_P40 ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read check ID */ @@ -228,7 +228,7 @@ void Depack_P40 ( void ) /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -264,8 +264,8 @@ void Depack_P40 ( void ) k /= 2; /* use of htonl() suggested by Xigh !.*/ z = htonl(k); - c1 = *((Uchar *)&z+2); - c2 = *((Uchar *)&z+3); + c1 = *((uint8_t *)&z+2); + c2 = *((uint8_t *)&z+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); fwrite ( &in_data[Where+10] , 2 , 1 , out ); @@ -356,8 +356,8 @@ void Depack_P40 ( void ) case 0x06: case 0x0A: c3 = (c3 > 0x7f) ? ((0x100-c3)<<4) : c3; -// if ( c3 >= 0x80 ) -// c3 = (c3<<4)&0xf0; +/* if ( c3 >= 0x80 )*/ +/* c3 = (c3<<4)&0xf0;*/ break; default: break; @@ -369,7 +369,7 @@ void Depack_P40 ( void ) if ( (c4 > 0x00) && (c4 <0x80) ) k += c4; - if ( (c4 > 0x7f) && (c4 <=0xff) ) + if ( c4 > 0x7f )/* && (c4 <=0xff) )*/ { k+=1; for ( l=256 ; l>c4 ; l-- ) @@ -413,8 +413,8 @@ void Depack_P40 ( void ) case 0x06: case 0x0A: c3 = (c3 > 0x7f) ? ((0x100-c3)<<4) : c3; -// if ( c3 >= 0x80 ) -// c3 = (c3<<4)&0xf0; +/* if ( c3 >= 0x80 )*/ +/* c3 = (c3<<4)&0xf0;*/ break; default: break; @@ -426,7 +426,7 @@ void Depack_P40 ( void ) if ( (c4 > 0x00) && (c4 <0x80) ) k += c4; - if ( (c4 > 0x7f) && (c4 <=0xff) ) + if ( c4 > 0x7f ) /*&& (c4 <=0xff) )*/ { k+=1; for ( l=256 ; l>c4 ; l-- ) diff --git a/prowizard/rippers/ThePlayer41a.c b/prowizard/rippers/ThePlayer41a.c index 8c132db0..996d8dc8 100644 --- a/prowizard/rippers/ThePlayer41a.c +++ b/prowizard/rippers/ThePlayer41a.c @@ -6,7 +6,7 @@ #include "extern.h" -short testP41A ( void ) +int16_t testP41A ( void ) { PW_Start_Address = PW_i; @@ -70,19 +70,34 @@ short testP41A ( void ) void Rip_P41A ( void ) { + int32_t seed=0; + /* potential fake address if rip from memory - thus, start address*/ PW_l = ( (in_data[PW_Start_Address+16]*256*256*256) + (in_data[PW_Start_Address+17]*256*256) + (in_data[PW_Start_Address+18]*256) + in_data[PW_Start_Address+19] ); + PW_m = ( (in_data[PW_Start_Address+12]*256*256*256) + + (in_data[PW_Start_Address+13]*256*256) + + (in_data[PW_Start_Address+14]*256) + + in_data[PW_Start_Address+15] ); + /* check here for memory addresses, which are screwed up */ + PW_j = (in_data[PW_Start_Address+6]*16)+4+12; + if ( PW_j != PW_m ) + { + /* it's memory addresses then */ + seed = (PW_m - PW_j); + PW_l -= seed; + } /* get whole sample size */ + /* PW_k is the number of samples */ PW_o = 0; for ( PW_j=0 ; PW_j PW_o ) { PW_o = PW_m; @@ -120,22 +135,22 @@ void Rip_P41A ( void ) */ void Depack_P41A ( void ) { - Uchar c1,c2,c3,c4,c5; - Uchar *Whatever; - Uchar PatPos = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar sample,note,Note[2]; - Uchar Track_Data[512][256]; - short Track_Addresses[128][4]; - long Track_Data_Address = 0; - long Track_Table_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long SampleAddress[31]; - long SampleSize[31]; - long i=0,j,k,l,a,c,z; - long Where = PW_Start_Address; + uint8_t c1,c2,c3,c4,c5; + uint8_t *Whatever; + uint8_t PatPos = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t sample,note,Note[2]; + uint8_t Track_Data[512][256]; + int16_t Track_Addresses[128][4]; + int32_t Track_Data_Address = 0; + int32_t Track_Table_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t SampleAddress[31]; + int32_t SampleSize[31]; + int32_t i=0,j,k,l,a,c,z; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -148,7 +163,7 @@ void Depack_P41A ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read check ID */ @@ -190,9 +205,19 @@ void Depack_P41A ( void ) in_data[Where+3]; Where += 4; + /* check here for memory addresses, which are screwed up */ + i = (Nbr_Sample*16)+4+12; + if ( i != Track_Table_Address ) + { + /* it's memory addresses then */ + int32_t seed = (Track_Table_Address - i); + Track_Data_Address -= seed; + Track_Table_Address -= seed; + Sample_Data_Address -= seed; + } /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -204,7 +229,7 @@ void Depack_P41A ( void ) (in_data[Where+1]*256*256)+ (in_data[Where+2]*256)+ in_data[Where+3]; - SampleAddress[i] = j; + SampleAddress[i] = j - Sample_Data_Address; /* just a try with -*/ /* write sample name */ fwrite ( Whatever , 22 , 1 , out ); @@ -217,7 +242,7 @@ void Depack_P41A ( void ) k = (in_data[Where+6]*256*256*256)+ (in_data[Where+7]*256*256)+ (in_data[Where+8]*256)+ - in_data[Where+9]; + in_data[Where+9] - Sample_Data_Address; /* just a try with -*/ /* writing now */ fwrite ( &in_data[Where+4] , 2 , 1 , out ); @@ -228,8 +253,8 @@ void Depack_P41A ( void ) k /= 2; /* use of htonl() suggested by Xigh !.*/ z = htonl(k); - c1 = *((Uchar *)&z+2); - c2 = *((Uchar *)&z+3); + c1 = *((uint8_t *)&z+2); + c2 = *((uint8_t *)&z+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); fwrite ( &in_data[Where+10] , 2 , 1 , out ); @@ -320,8 +345,8 @@ void Depack_P41A ( void ) case 0x06: case 0x0A: c3 = (c3 > 0x7f) ? ((0x100-c3)<<4) : c3; -// if ( c3 >= 0x80 ) -// c3 = (c3<<4)&0xf0; +/* if ( c3 >= 0x80 )*/ +/* c3 = (c3<<4)&0xf0;*/ break; default: break; @@ -333,7 +358,7 @@ void Depack_P41A ( void ) if ( (c4 > 0x00) && (c4 <0x80) ) k += c4; - if ( (c4 > 0x7f) && (c4 <=0xff) ) + if ( c4 > 0x7f ) /* && (c4 <=0xff) )*/ { k+=1; for ( l=256 ; l>c4 ; l-- ) @@ -377,8 +402,8 @@ void Depack_P41A ( void ) case 0x06: case 0x0A: c3 = (c3 > 0x7f) ? ((0x100-c3)<<4) : c3; -// if ( c3 >= 0x80 ) -// c3 = (c3<<4)&0xf0; +/* if ( c3 >= 0x80 )*/ +/* c3 = (c3<<4)&0xf0;*/ break; default: break; @@ -390,7 +415,7 @@ void Depack_P41A ( void ) if ( (c4 > 0x00) && (c4 <0x80) ) k += c4; - if ( (c4 > 0x7f) && (c4 <=0xff) ) + if ( c4 > 0x7f ) /* && (c4 <=0xff) )*/ { k+=1; for ( l=256 ; l>c4 ; l-- ) diff --git a/prowizard/rippers/ThePlayer50a.c b/prowizard/rippers/ThePlayer50a.c index dcd74df4..dc3c7803 100644 --- a/prowizard/rippers/ThePlayer50a.c +++ b/prowizard/rippers/ThePlayer50a.c @@ -10,7 +10,7 @@ #include "extern.h" -short testP50A ( void ) +int16_t testP50A ( void ) { int nbr_notes=0; if ( PW_i < 7 ) @@ -35,6 +35,8 @@ short testP50A ( void ) /*printf ( "#2\n" );*/ return BAD; } + + /* 0 or more than 31 samples ? */ if ( ((PW_k&0x3f) > 0x1F) || ((PW_k&0x3F) == 0) ) { /*printf ( "#2,1 Start:%ld\n" , PW_Start_Address );*/ @@ -89,6 +91,13 @@ short testP50A ( void ) } } } + + /* test whole size */ + if (PW_WholeSampleSize <= 4) + { + /*printf ( "#5,3 Start $ld, whole sample size : %ld\n",PW_Start_Address,PW_WholeSampleSize );*/ + return BAD; + } /* test sample data address */ PW_j = (in_data[PW_Start_Address]*256)+in_data[PW_Start_Address+1]; @@ -276,25 +285,25 @@ void Rip_P50A ( void ) void Depack_P50A ( void ) { - Uchar c1,c2,c3,c4,c5,c6; - long Max; - Uchar *Whatever; + uint8_t c1,c2,c3,c4,c5,c6; + int32_t Max; + uint8_t *Whatever; signed char *SmpDataWork; - Uchar PatPos = 0x00; - Uchar PatMax = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar Track_Data[512][256]; - Uchar SmpSizes[31][2]; - Uchar GLOBAL_DELTA=OFF; - long Track_Address[128][4]; - long Track_Data_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long i=0,j,k,l,a,b,z; - long SampleSizes[31]; - long SampleAddresses[32]; - long Where = PW_Start_Address; + uint8_t PatPos = 0x00; + uint8_t PatMax = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t Track_Data[512][256]; + uint8_t SmpSizes[31][2]; + uint8_t GLOBAL_DELTA=OFF; + int32_t Track_Address[128][4]; + int32_t Track_Data_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t i=0,j,k,l,a,b,z; + int32_t SampleSizes[31]; + int32_t SampleAddresses[32]; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -308,7 +317,7 @@ void Depack_P50A ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read sample data address */ @@ -329,7 +338,7 @@ void Depack_P50A ( void ) Nbr_Sample &= 0x3F; /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -380,8 +389,8 @@ void Depack_P50A ( void ) /* use of htonl() suggested by Xigh !.*/ z = htonl(l); - c1 = *((Uchar *)&z+2); - c2 = *((Uchar *)&z+3); + c1 = *((uint8_t *)&z+2); + c2 = *((uint8_t *)&z+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); diff --git a/prowizard/rippers/ThePlayer60a.c b/prowizard/rippers/ThePlayer60a.c index 9ce658e0..35cec5a1 100644 --- a/prowizard/rippers/ThePlayer60a.c +++ b/prowizard/rippers/ThePlayer60a.c @@ -8,7 +8,7 @@ #include "extern.h" -short testP60A_nopack ( void ) +int16_t testP60A_nopack ( void ) { int nbr_notes=0; if ( PW_i < 7 ) @@ -205,7 +205,7 @@ short testP60A_nopack ( void ) /******************/ /* packed samples */ /******************/ -short testP60A_pack ( void ) +int16_t testP60A_pack ( void ) { if ( PW_i < 11 ) { @@ -406,7 +406,7 @@ void Rip_P60A ( void ) Save_Rip ( "The Player 6.0A module", P60A ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 12); /* 7 should do but call it "just to be sure" :) */ + PW_i += 8; /* 7 should do but call it "just to be sure" :) */ } @@ -434,28 +434,28 @@ void Rip_P60A ( void ) void Depack_P60A ( void ) { - Uchar c1,c2,c3,c4,c5,c6; - long Max; - Uchar *Whatever; + uint8_t c1,c2,c3,c4,c5,c6; + int32_t Max; + uint8_t *Whatever; signed char *SmpDataWork; - Uchar PatPos = 0x00; - Uchar PatMax = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar Track_Data[512][256]; - Uchar SmpSizes[31][2]; - Uchar PACK[31]; -/* Uchar DELTA[31];*/ - Uchar GLOBAL_DELTA=OFF; - Uchar GLOBAL_PACK=OFF; - long Track_Address[128][4]; - long Track_Data_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long i=0,j,k,l,a,b,z; - long SampleSizes[31]; - long SampleAddresses[32]; - long Where = PW_Start_Address; + uint8_t PatPos = 0x00; + uint8_t PatMax = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t Track_Data[512][256]; + uint8_t SmpSizes[31][2]; + uint8_t PACK[31]; +/* uint8_t DELTA[31];*/ + uint8_t GLOBAL_DELTA=OFF; + uint8_t GLOBAL_PACK=OFF; + int32_t Track_Address[128][4]; + int32_t Track_Data_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t i=0,j,k,l,a,b,z; + int32_t SampleSizes[31]; + int32_t SampleAddresses[32]; + int32_t Where = PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -474,7 +474,7 @@ void Depack_P60A ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read sample data address */ @@ -503,7 +503,7 @@ void Depack_P60A ( void ) Nbr_Sample &= 0x3F; /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -517,6 +517,7 @@ void Depack_P60A ( void ) SmpSizes[i][0] = in_data[Where]; SmpSizes[i][1] = in_data[Where+1]; j = (SmpSizes[i][0]*256)+SmpSizes[i][1]; +/*printf ("sample [%2ld] ",i);*/ if ( j > 0xFF00 ) { SampleSizes[i] = SampleSizes[0xFFFF-j]; @@ -531,6 +532,7 @@ void Depack_P60A ( void ) SampleSizes[i] = j*2; WholeSampleSize += SampleSizes[i]; } +/*printf ("%ld\n",SampleAddresses[i+1]);*/ j = SampleSizes[i]/2; fwrite ( &SmpSizes[i][0] , 1 , 1 , out ); fwrite ( &SmpSizes[i][1] , 1 , 1 , out ); @@ -561,8 +563,8 @@ void Depack_P60A ( void ) /* use of htonl() suggested by Xigh !.*/ z = htonl (l); - c1 = *((Uchar *)&z+2); - c2 = *((Uchar *)&z+3); + c1 = *((uint8_t *)&z+2); + c2 = *((uint8_t *)&z+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); diff --git a/prowizard/rippers/ThePlayer61a.c b/prowizard/rippers/ThePlayer61a.c index 8ad3f95d..360967ed 100644 --- a/prowizard/rippers/ThePlayer61a.c +++ b/prowizard/rippers/ThePlayer61a.c @@ -8,7 +8,7 @@ #include "extern.h" -short testP61A_nopack ( void ) +int16_t testP61A_nopack ( void ) { if ( PW_i < 7 ) { @@ -267,7 +267,7 @@ short testP61A_nopack ( void ) /******************/ /* packed samples */ /******************/ -short testP61A_pack ( void ) +int16_t testP61A_pack ( void ) { if ( PW_i < 11 ) { @@ -570,29 +570,29 @@ void Rip_P61A ( void ) void Depack_P61A ( void ) { - Uchar c1,c2,c3,c4,c5,c6; - long Max; - Uchar *Whatever; + uint8_t c1,c2,c3,c4,c5,c6; + int32_t Max; + uint8_t *Whatever; signed char *SmpDataWork; - Uchar PatPos = 0x00; - Uchar PatMax = 0x00; - Uchar Nbr_Sample = 0x00; - Uchar poss[37][2]; - Uchar Track_Data[512][256]; - Uchar SmpSizes[31][2]; - Uchar PACK[31]; -/* Uchar DELTA[31];*/ - Uchar GLOBAL_DELTA=OFF; - Uchar GLOBAL_PACK=OFF; - long Track_Address[128][4]; - long Track_Data_Address = 0; - long Sample_Data_Address = 0; - long WholeSampleSize = 0; - long i=0,j,k,l,a,b,z,w; - long SampleSizes[31]; - long SampleAddresses[32]; - long Unpacked_Sample_Data_Size; - long Where=PW_Start_Address; + uint8_t PatPos = 0x00; + uint8_t PatMax = 0x00; + uint8_t Nbr_Sample = 0x00; + uint8_t poss[37][2]; + uint8_t Track_Data[512][256]; + uint8_t SmpSizes[31][2]; + uint8_t PACK[31]; +/* uint8_t DELTA[31];*/ + uint8_t GLOBAL_DELTA=OFF; + uint8_t GLOBAL_PACK=OFF; + int32_t Track_Address[128][4]; + int32_t Track_Data_Address = 0; + int32_t Sample_Data_Address = 0; + int32_t WholeSampleSize = 0; + int32_t i=0,j,k,l,a,b,z,w; + int32_t SampleSizes[31]; + int32_t SampleAddresses[32]; + int32_t Unpacked_Sample_Data_Size; + int32_t Where=PW_Start_Address; FILE *out; if ( Save_Status == BAD ) @@ -611,7 +611,7 @@ void Depack_P61A ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read sample data address */ @@ -648,7 +648,7 @@ void Depack_P61A ( void ) } /* write title */ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -706,8 +706,8 @@ void Depack_P61A ( void ) /* use of htonl() suggested by Xigh !.*/ w = htonl(l); - c1 = *((Uchar *)&w+2); - c2 = *((Uchar *)&w+3); + c1 = *((uint8_t *)&w+2); + c2 = *((uint8_t *)&w+3); fwrite ( &c1 , 1 , 1 , out ); fwrite ( &c2 , 1 , 1 , out ); diff --git a/prowizard/rippers/TimeCruncher17.c b/prowizard/rippers/TimeCruncher17.c index c2d7a71b..140910ee 100644 --- a/prowizard/rippers/TimeCruncher17.c +++ b/prowizard/rippers/TimeCruncher17.c @@ -6,7 +6,7 @@ #include "extern.h" -short testTimeCruncher17 ( void ) +int16_t testTimeCruncher17 ( void ) { PW_Start_Address = PW_i; @@ -79,8 +79,8 @@ void Rip_TimeCruncher17 ( void ) { /* PW_l is still the whole size */ - Uchar * Amiga_EXE_Header_Block; - Uchar * Whatever; + uint8_t * Amiga_EXE_Header_Block; + uint8_t * Whatever; OutputSize = PW_l; @@ -89,7 +89,7 @@ void Rip_TimeCruncher17 ( void ) if ( Amiga_EXE_Header == BAD ) { OutputSize -= 36; - Amiga_EXE_Header_Block = (Uchar *) malloc ( 36 ); + Amiga_EXE_Header_Block = (uint8_t *) malloc ( 36 ); BZERO ( Amiga_EXE_Header_Block , 36 ); Amiga_EXE_Header_Block[2] = Amiga_EXE_Header_Block[30] = 0x03; Amiga_EXE_Header_Block[3] = 0xF3; @@ -103,7 +103,7 @@ void Rip_TimeCruncher17 ( void ) /* 68k machines code : c2 = *(Whatever+3); */ PW_j = PW_l - 60; PW_j /= 4; - Whatever = (Uchar *) &PW_j; + Whatever = (uint8_t *) &PW_j; Amiga_EXE_Header_Block[20] = Amiga_EXE_Header_Block[32] = *(Whatever+3); Amiga_EXE_Header_Block[21] = Amiga_EXE_Header_Block[33] = *(Whatever+2); Amiga_EXE_Header_Block[22] = Amiga_EXE_Header_Block[34] = *(Whatever+1); diff --git a/prowizard/rippers/TitanicsPlayer.c b/prowizard/rippers/TitanicsPlayer.c index 0b68d65e..6792f87e 100644 --- a/prowizard/rippers/TitanicsPlayer.c +++ b/prowizard/rippers/TitanicsPlayer.c @@ -6,7 +6,7 @@ #include "extern.h" -short testTitanicsPlayer ( void ) +int16_t testTitanicsPlayer ( void ) { if ( PW_i < 7 ) return BAD; @@ -58,6 +58,11 @@ short testTitanicsPlayer ( void ) /*printf ("#4 : (start : %ld)\n",PW_Start_Address);*/ return BAD; } + if ( (PW_j != 0) && (PW_j == PW_l)) + { + /*printf ("#4.1 : (start : %ld)\n",PW_Start_Address);*/ + return BAD; + } PW_WholeSampleSize += PW_j; } if (PW_WholeSampleSize < 2) @@ -99,10 +104,10 @@ short testTitanicsPlayer ( void ) /* With the help of Xigh :) .. thx */ -int _cdecl cmplong(const void * a, const void * b) +int cmpint32_t (const void * a, const void * b) { - long * aa = (long *) a; - long * bb = (long *) b; + int32_t * aa = (int32_t *) a; + int32_t * bb = (int32_t *) b; if (*aa == *bb) return 0; if(*aa > *bb) @@ -110,6 +115,9 @@ int _cdecl cmplong(const void * a, const void * b) return -1; } +/* 20100101 : little fix in a test of the nbr of row being too big + * pb pointed out by Claudio of XMP team. Thanks ! +*/ void Rip_TitanicsPlayer ( void ) { @@ -148,18 +156,18 @@ void Rip_TitanicsPlayer ( void ) void Depack_TitanicsPlayer ( void ) { - Uchar *Whatever; - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - long Pat_Addresses[128]; - long Pat_Addresses_ord[128]; - long Pat_Addresses_final[128]; - long Max=0l; - Uchar poss[37][2]; - Uchar PatPos; - long Where=PW_Start_Address; - long SmpAddresses[15]; - long SampleSizes[15]; - unsigned long i=0,j=0,k=0,l; + uint8_t *Whatever; + uint8_t c1=0x00; + int32_t Pat_Addresses[128]; + int32_t Pat_Addresses_ord[128]; + int32_t Pat_Addresses_final[128]; + int32_t Max=0l; + uint8_t poss[37][2]; + uint8_t PatPos; + int32_t Where=PW_Start_Address; + int32_t SmpAddresses[15]; + int32_t SampleSizes[15]; + uint32_t i=0,j=0,k=0; FILE *out; if ( Save_Status == BAD ) @@ -171,11 +179,11 @@ void Depack_TitanicsPlayer ( void ) fillPTKtable(poss); - sprintf ( Depacked_OutName , "%ld.stk" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.stk" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc ( 2048 ); + Whatever = (uint8_t *) malloc ( 2048 ); BZERO ( Whatever , 2048 ); fwrite ( &Whatever[0] , 20 , 1 , out ); @@ -224,11 +232,11 @@ void Depack_TitanicsPlayer ( void ) fwrite ( &PatPos , 1 , 1 , out ); /* restart byte */ - c1 = 0x00; + c1 = 0x78; /* 20130420 fix submitted by Warren Willmey */ fwrite ( &c1 , 1 , 1 , out ); /* With the help of Xigh :) .. thx */ - qsort (Pat_Addresses_ord,PatPos,sizeof(long),cmplong); + qsort (Pat_Addresses_ord,PatPos,sizeof(int32_t ),cmpint32_t ); j=0; for (i=0;i 1024) + if (k > 64) { /*printf ("pat %ld too big\n",i);*/ break; diff --git a/prowizard/rippers/TrackerPacker1.c b/prowizard/rippers/TrackerPacker1.c index 86da8b19..5ebf5653 100644 --- a/prowizard/rippers/TrackerPacker1.c +++ b/prowizard/rippers/TrackerPacker1.c @@ -6,7 +6,7 @@ #include "globals.h" #include "extern.h" -short testTP1 ( void ) +int16_t testTP1 ( void ) { PW_Start_Address = PW_i; @@ -119,19 +119,19 @@ void Rip_TP1 ( void ) void Depack_TP1 ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00; - Uchar poss[37][2]; - Uchar *Whatever; - Uchar Note,Smp,Fx,FxVal; - Uchar Patternlist[128]; - Uchar PatPos; - long Pats_Address[128]; - long i=0,j=0,k; - long Pats_Address_read[128]; - long Start_Pat_Address; - long Whole_Sample_Size=0; - long Sample_Data_Address; - long Where=PW_Start_Address; + uint8_t c1=0x00,c2=0x00,c3=0x00; + uint8_t poss[37][2]; + uint8_t *Whatever; + uint8_t Note,Smp,Fx,FxVal; + uint8_t Patternlist[128]; + uint8_t PatPos; + int32_t Pats_Address[128]; + int32_t i=0,j=0,k; + int32_t Pats_Address_read[128]; + int32_t Start_Pat_Address; + int32_t Whole_Sample_Size=0; + int32_t Sample_Data_Address; + int32_t Where=PW_Start_Address; FILE *out; fillPTKtable(poss); @@ -141,11 +141,11 @@ void Depack_TP1 ( void ) BZERO ( Pats_Address , 128*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc (65536); + Whatever = (uint8_t *) malloc (65536); BZERO ( Whatever , 65536 ); fwrite ( &in_data[Where+8] , 20 , 1 , out ); @@ -261,7 +261,7 @@ void Depack_TP1 ( void ) for ( j=0 ; j 0x0f ) { -/*printf ( "#3 Start: %ld\n" , PW_Start_Address );*/ +/*printf ( "#3 Start: %ld (PW_l:%ld) (Where:%ld)\n" , PW_Start_Address,PW_l,PW_Start_Address+30+PW_k*8 );*/ return BAD; } } @@ -189,17 +189,17 @@ void Rip_TP3 ( void ) void Depack_TP3 ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00; - Uchar poss[37][2]; - Uchar *Whatever; - Uchar Note,Smp,Fx,FxVal; - Uchar PatMax=0x00; - long Track_Address[128][4]; - long i=0,j=0,k; - long Start_Pat_Address=999999l; - long Whole_Sample_Size=0; - long Max_Track_Address=0; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t c1=0x00,c2=0x00,c3=0x00; + uint8_t poss[37][2]; + uint8_t *Whatever; + uint8_t Note,Smp,Fx,FxVal; + uint8_t PatMax=0x00; + int32_t Track_Address[128][4]; + int32_t i=0,j=0,k; + int32_t Start_Pat_Address=999999l; + int32_t Whole_Sample_Size=0; + int32_t Max_Track_Address=0; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -209,7 +209,7 @@ void Depack_TP3 ( void ) BZERO ( Track_Address , 128*4*4 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ @@ -223,7 +223,7 @@ void Depack_TP3 ( void ) j /= 8; /*printf ( "number of sample : %ld\n" , j );*/ - Whatever = (Uchar *) malloc ( 1024 ); + Whatever = (uint8_t *) malloc ( 1024 ); BZERO ( Whatever , 1024 ); for ( i=0 ; i=PW_in_size) ) @@ -270,7 +270,7 @@ short testUNIC_withemptyID ( void ) -short testUNIC_noID ( void ) +int16_t testUNIC_noID ( void ) { /* test 1 */ if ( (PW_i < 45) || ((PW_i-45+1083)>=PW_in_size) ) @@ -494,17 +494,17 @@ void Rip_UNIC_noID ( void ) void Depack_UNIC ( void ) { - Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00; - Uchar NumberOfPattern=0x00; - Uchar poss[37][2]; - Uchar Max=0x00; - Uchar Smp,Note,Fx,FxVal; - Uchar fine=0x00; - Uchar Pattern[1025]; - Uchar LOOP_START_STATUS=OFF; /* standard /2 */ - long i=0,j=0,k=0,l=0; - long WholeSampleSize=0; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t c1=0x00,c2=0x00,c3=0x00,c4=0x00; + uint8_t NumberOfPattern=0x00; + uint8_t poss[37][2]; + uint8_t Max=0x00; + uint8_t Smp,Note,Fx,FxVal; + uint8_t fine=0x00; + uint8_t Pattern[1025]; + uint8_t LOOP_START_STATUS=OFF; /* standard /2 */ + uint32_t i=0,j=0,k=0,l=0; + uint32_t WholeSampleSize=0; + uint32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -512,7 +512,7 @@ void Depack_UNIC ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ @@ -529,19 +529,28 @@ void Depack_UNIC ( void ) fwrite ( &c1 , 1 , 1 , out ); Where += 20; - /* fine on ? */ + /* fine */ c1 = in_data[Where++]; c2 = in_data[Where++]; j = (c1*256)+c2; if ( j != 0 ) { if ( j < 256 ) - fine = 0x10-c2; + fine = 0x10-(c2%7); else - fine = 0x100-c2; + { + /* fine = 0x100-(c2%7);*/ + /* 20130827 - fix for case that are *7 ... weird */ + j = 0x10000 - j; + if (j > 8) + fine = j / 7; + else + fine = j; + } } else fine = 0x00; + /* smp size */ c1 = in_data[Where++]; diff --git a/prowizard/rippers/UnicTracker2.c b/prowizard/rippers/UnicTracker2.c index fb1d1eab..0a16c682 100644 --- a/prowizard/rippers/UnicTracker2.c +++ b/prowizard/rippers/UnicTracker2.c @@ -10,7 +10,7 @@ #include "extern.h" -short testUNIC2 ( void ) +int16_t testUNIC2 ( void ) { /* test 1 */ if ( (PW_i < 25) || ((PW_i+1828)>=PW_in_size) ) /* 1828=Head+1 pat */ @@ -186,13 +186,13 @@ void Rip_UNIC2 ( void ) void Depack_UNIC2 ( void ) { - Uchar poss[37][2]; - Uchar Smp,Note,Fx,FxVal; - Uchar *Whatever; -/* Uchar LOOP_START_STATUS=OFF;*/ /* standard /2 */ - long i=0,j=0,k=0,l=0; - long WholeSampleSize=0; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t poss[37][2]; + uint8_t Smp,Note,Fx,FxVal; + uint8_t *Whatever; +/* uint8_t LOOP_START_STATUS=OFF;*/ /* standard /2 */ + int32_t i=0,j=0,k=0,l=0; + int32_t WholeSampleSize=0; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -200,11 +200,11 @@ void Depack_UNIC2 ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc (1028); + Whatever = (uint8_t *) malloc (1028); BZERO ( Whatever , 1028 ); fwrite ( Whatever , 20 , 1 , out ); diff --git a/prowizard/rippers/Viruz2.c b/prowizard/rippers/Viruz2.c index 4bfe0759..35b139f3 100644 --- a/prowizard/rippers/Viruz2.c +++ b/prowizard/rippers/Viruz2.c @@ -1,136 +1,136 @@ -/* Viruz2 - made by kb_ Farbrausch */ -/* 06-05-2007 - test version by Muerto - mostly asle :D*/ -/* 08-05-2007 - Saved the first V2m mod!! - BUT phoemes not incluted.. yet!*/ -/* testV2 */ - -/* This is an ongoing dev version made by Muerto - not part of PW4PC package */ - -#include "globals.h" -#include "extern.h" - -/* void testViruz2_60 (void)*/ -short testViruz2_60 () -{ - PW_Start_Address = PW_i; /* bypass the 20 bytes already tested */ - - for (PW_j = PW_Start_Address+20; PW_j<(PW_in_size-12); PW_j++) - { - /* PW_in_size if the size of the input file */ - - if ((in_data[PW_j+1] == 0x00) && - (in_data[PW_j+2] == 0x00) && - (in_data[PW_j+3] == 0x00) && - ((in_data[PW_j+4] == 0x01) || (in_data[PW_j+4] == 0x1F)) && - (in_data[PW_j+5] == 0x00) && - (in_data[PW_j+6] == 0x00) && - (in_data[PW_j+7] == 0x00) && - ((in_data[PW_j+8] == 0x08) || (in_data[PW_j+8] == 0x26)) && - (in_data[PW_j+9] == 0x00) && - (in_data[PW_j+10] == 0x00) && - (in_data[PW_j+11] == 0x00) ) - { - /* printf ( "\n found end tag for 6000 at %ld (%lx)\n",PW_j, PW_j ); */ - /*OutputSize is the global PW var to store the output size, used by Save_Rip*/ - OutputSize = (PW_j+12)-PW_Start_Address; - CONVERT = BAD; /* tells PW not to consider converting to PTK */ - Save_Rip ( "Viruz 2", Viruz2 ); - if ( Save_Status == GOOD ) - PW_i += 1; /* to bypass the case test */ - } - } - return GOOD; -} - -short testViruz2_80 () -{ - Uchar MYTEST = BAD; - PW_Start_Address = PW_i; /* bypass the 20 bytes already tested */ - - /* test 1 */ - for (PW_j = PW_Start_Address+20; PW_j<(PW_in_size-12); PW_j++) - { - /* PW_in_size if the size of the input file */ - /* Test before @@@ */ - if ((in_data[PW_j] == 0x16) && - (in_data[PW_j+1] == 0x00) && - (in_data[PW_j+2] == 0x00) && - (in_data[PW_j+3] == 0x00) && - ((in_data[PW_j+8] == 0x64) || (in_data[PW_j+8] == 0x6B) || (in_data[PW_j+8] == 0x6E) || (in_data[PW_j+8] == 0x7F) || (in_data[PW_j+8] == 0x5B) || (in_data[PW_j+8] == 0x60) || (in_data[PW_j+8] == 0x19) || (in_data[PW_j+8] == 0x66) || (in_data[PW_j+8] == 0x58) || (in_data[PW_j+8] == 0x0E) || (in_data[PW_j+8] == 0x5A) ) && - ((in_data[PW_j+17] == 0x00) || (in_data[PW_j+17] == 0x01) || (in_data[PW_j+17] == 0x02) || (in_data[PW_j+17] == 0x1F)) && - ((in_data[PW_j+18] == 0x00) || (in_data[PW_j+18] == 0x01) || (in_data[PW_j+18] == 0x33)) && - ((in_data[PW_j+19] == 0x00) || (in_data[PW_j+19] == 0x01) || (in_data[PW_j+19] == 0x02) || (in_data[PW_j+19] == 0x36))) - - { - MYTEST = GOOD; - printf ("first row of test OK (where : %ld)\n",PW_j); - break; - } - } - if (MYTEST == GOOD) - { /* test 1 OK - proceed to test 2, then save if successful */ - while (PW_j<(PW_in_size-12)) - { - /* test after @@@ */ - if ((in_data[PW_j] == 0xF8) && - (in_data[PW_j+1] == 0x02) && - (in_data[PW_j+2] == 0x00) && - (in_data[PW_j+3] == 0x00) && - (in_data[PW_j+4] == 0x86) && - (in_data[PW_j+5] == 0x03) && - (in_data[PW_j+6] == 0x00) && - (in_data[PW_j+7] == 0x00) && - (in_data[PW_j+8] == 0xA1) && - (in_data[PW_j+9] == 0x04) && - (in_data[PW_j+10] == 0x00) && - (in_data[PW_j+11] == 0x00)) - - { - /* printf ( "\n found end tag for 8000 at %ld (%lx)\n",PW_j, PW_j ); */ - /*OutputSize is the global PW var to store the output size, used by Save_Rip*/ - OutputSize = (PW_j+12)-PW_Start_Address; - CONVERT = BAD; /* tells PW not to consider converting to PTK */ - Save_Rip ( "Viruz 2", Viruz2 ); - if ( Save_Status == GOOD ) - PW_i += 1; /* to bypass the case test */ - } - PW_j++; - } - } - return GOOD; -} - -short testViruz2_E0 () -{ - PW_Start_Address = PW_i; /* bypass the 20 bytes already tested */ - - for (PW_j = PW_Start_Address+20; PW_j<(PW_in_size-12); PW_j++) - { - /* PW_in_size if the size of the input file */ - - if ((in_data[PW_j] == 0x94) && - ((in_data[PW_j+1] == 0x00) || (in_data[PW_j+1] == 0x01)) && - (in_data[PW_j+2] == 0x00) && - (in_data[PW_j+3] == 0x00) && - ((in_data[PW_j+4] == 0x01) || (in_data[PW_j+4] == 0x78) || (in_data[PW_j+4] == 0x81) || (in_data[PW_j+4] == 0xDD)) && - ((in_data[PW_j+5] == 0x00) || (in_data[PW_j+5] == 0x01)) && - (in_data[PW_j+6] == 0x00) && - (in_data[PW_j+7] == 0x00) && - ((in_data[PW_j+8] == 0x08) || (in_data[PW_j+8] == 0xC2) || (in_data[PW_j+8] == 0x27) || (in_data[PW_j+8] == 0xC8) || (in_data[PW_j+8] == 0x01) ) && - ((in_data[PW_j+9] == 0x00) || (in_data[PW_j+9] == 0x01)) && - (in_data[PW_j+10] == 0x00) && - (in_data[PW_j+11] == 0x00) ) - { - /* printf ( "\n found end tag for E001 at %ld (%lx)\n",PW_j, PW_j ); */ - /*OutputSize is the global PW var to store the output size, used by Save_Rip*/ - OutputSize = (PW_j+12)-PW_Start_Address; - CONVERT = BAD; /* tells PW not to consider converting to PTK */ - Save_Rip ( "Viruz 2", Viruz2 ); - if ( Save_Status == GOOD ) - PW_i += 1; /* to bypass the case test */ - } - } - return GOOD; -} - -/* end of func */ - +/* Viruz2 - made by kb_ Farbrausch */ +/* 06-05-2007 - test version by Muerto - mostly asle :D*/ +/* 08-05-2007 - Saved the first V2m mod!! - BUT phoemes not incluted.. yet!*/ +/* testV2 */ + +/* This is an ongoing dev version made by Muerto - not part of PW4PC package */ + +#include "globals.h" +#include "extern.h" + +/* void testViruz2_60 (void)*/ +int16_t testViruz2_60 () +{ + PW_Start_Address = PW_i; /* bypass the 20 bytes already tested */ + + for (PW_j = PW_Start_Address+20; PW_j<(PW_in_size-12); PW_j++) + { + /* PW_in_size if the size of the input file */ + + if ((in_data[PW_j+1] == 0x00) && + (in_data[PW_j+2] == 0x00) && + (in_data[PW_j+3] == 0x00) && + ((in_data[PW_j+4] == 0x01) || (in_data[PW_j+4] == 0x1F)) && + (in_data[PW_j+5] == 0x00) && + (in_data[PW_j+6] == 0x00) && + (in_data[PW_j+7] == 0x00) && + ((in_data[PW_j+8] == 0x08) || (in_data[PW_j+8] == 0x26)) && + (in_data[PW_j+9] == 0x00) && + (in_data[PW_j+10] == 0x00) && + (in_data[PW_j+11] == 0x00) ) + { + /* printf ( "\n found end tag for 6000 at %ld (%lx)\n",PW_j, PW_j ); */ + /*OutputSize is the global PW var to store the output size, used by Save_Rip*/ + OutputSize = (PW_j+12)-PW_Start_Address; + CONVERT = BAD; /* tells PW not to consider converting to PTK */ + Save_Rip ( "Viruz 2", Viruz2 ); + if ( Save_Status == GOOD ) + PW_i += 1; /* to bypass the case test */ + } + } + return GOOD; +} + +int16_t testViruz2_80 () +{ + uint8_t MYTEST = BAD; + PW_Start_Address = PW_i; /* bypass the 20 bytes already tested */ + + /* test 1 */ + for (PW_j = PW_Start_Address+20; PW_j<(PW_in_size-12); PW_j++) + { + /* PW_in_size if the size of the input file */ + /* Test before @@@ */ + if ((in_data[PW_j] == 0x16) && + (in_data[PW_j+1] == 0x00) && + (in_data[PW_j+2] == 0x00) && + (in_data[PW_j+3] == 0x00) && + ((in_data[PW_j+8] == 0x64) || (in_data[PW_j+8] == 0x6B) || (in_data[PW_j+8] == 0x6E) || (in_data[PW_j+8] == 0x7F) || (in_data[PW_j+8] == 0x5B) || (in_data[PW_j+8] == 0x60) || (in_data[PW_j+8] == 0x19) || (in_data[PW_j+8] == 0x66) || (in_data[PW_j+8] == 0x58) || (in_data[PW_j+8] == 0x0E) || (in_data[PW_j+8] == 0x5A) ) && + ((in_data[PW_j+17] == 0x00) || (in_data[PW_j+17] == 0x01) || (in_data[PW_j+17] == 0x02) || (in_data[PW_j+17] == 0x1F)) && + ((in_data[PW_j+18] == 0x00) || (in_data[PW_j+18] == 0x01) || (in_data[PW_j+18] == 0x33)) && + ((in_data[PW_j+19] == 0x00) || (in_data[PW_j+19] == 0x01) || (in_data[PW_j+19] == 0x02) || (in_data[PW_j+19] == 0x36))) + + { + MYTEST = GOOD; + printf ("first row of test OK (where : %ld)\n",PW_j); + break; + } + } + if (MYTEST == GOOD) + { /* test 1 OK - proceed to test 2, then save if successful */ + while (PW_j<(PW_in_size-12)) + { + /* test after @@@ */ + if ((in_data[PW_j] == 0xF8) && + (in_data[PW_j+1] == 0x02) && + (in_data[PW_j+2] == 0x00) && + (in_data[PW_j+3] == 0x00) && + (in_data[PW_j+4] == 0x86) && + (in_data[PW_j+5] == 0x03) && + (in_data[PW_j+6] == 0x00) && + (in_data[PW_j+7] == 0x00) && + (in_data[PW_j+8] == 0xA1) && + (in_data[PW_j+9] == 0x04) && + (in_data[PW_j+10] == 0x00) && + (in_data[PW_j+11] == 0x00)) + + { + /* printf ( "\n found end tag for 8000 at %ld (%lx)\n",PW_j, PW_j ); */ + /*OutputSize is the global PW var to store the output size, used by Save_Rip*/ + OutputSize = (PW_j+12)-PW_Start_Address; + CONVERT = BAD; /* tells PW not to consider converting to PTK */ + Save_Rip ( "Viruz 2", Viruz2 ); + if ( Save_Status == GOOD ) + PW_i += 1; /* to bypass the case test */ + } + PW_j++; + } + } + return GOOD; +} + +int16_t testViruz2_E0 () +{ + PW_Start_Address = PW_i; /* bypass the 20 bytes already tested */ + + for (PW_j = PW_Start_Address+20; PW_j<(PW_in_size-12); PW_j++) + { + /* PW_in_size if the size of the input file */ + + if ((in_data[PW_j] == 0x94) && + ((in_data[PW_j+1] == 0x00) || (in_data[PW_j+1] == 0x01)) && + (in_data[PW_j+2] == 0x00) && + (in_data[PW_j+3] == 0x00) && + ((in_data[PW_j+4] == 0x01) || (in_data[PW_j+4] == 0x78) || (in_data[PW_j+4] == 0x81) || (in_data[PW_j+4] == 0xDD)) && + ((in_data[PW_j+5] == 0x00) || (in_data[PW_j+5] == 0x01)) && + (in_data[PW_j+6] == 0x00) && + (in_data[PW_j+7] == 0x00) && + ((in_data[PW_j+8] == 0x08) || (in_data[PW_j+8] == 0xC2) || (in_data[PW_j+8] == 0x27) || (in_data[PW_j+8] == 0xC8) || (in_data[PW_j+8] == 0x01) ) && + ((in_data[PW_j+9] == 0x00) || (in_data[PW_j+9] == 0x01)) && + (in_data[PW_j+10] == 0x00) && + (in_data[PW_j+11] == 0x00) ) + { + /* printf ( "\n found end tag for E001 at %ld (%lx)\n",PW_j, PW_j ); */ + /*OutputSize is the global PW var to store the output size, used by Save_Rip*/ + OutputSize = (PW_j+12)-PW_Start_Address; + CONVERT = BAD; /* tells PW not to consider converting to PTK */ + Save_Rip ( "Viruz 2", Viruz2 ); + if ( Save_Status == GOOD ) + PW_i += 1; /* to bypass the case test */ + } + } + return GOOD; +} + +/* end of func */ + diff --git a/prowizard/rippers/WantonPacker.c b/prowizard/rippers/WantonPacker.c index 52b5851c..858cd80f 100644 --- a/prowizard/rippers/WantonPacker.c +++ b/prowizard/rippers/WantonPacker.c @@ -6,7 +6,7 @@ #include "extern.h" -short testWN ( void ) +int16_t testWN ( void ) { /* test 1 */ if ( PW_i < 1080 ) @@ -63,11 +63,11 @@ void Rip_WN ( void ) void Depack_WN ( void ) { - Uchar poss[37][2]; - Uchar *Whatever; - long WholeSampleSize=0; - long i=0,j=0; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t poss[37][2]; + uint8_t *Whatever; + int32_t WholeSampleSize=0; + int32_t i=0,j=0; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -75,7 +75,7 @@ void Depack_WN ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read header */ @@ -96,7 +96,7 @@ void Depack_WN ( void ) Where += 129; /* write ptk's ID */ - Whatever = (Uchar *) malloc (5); + Whatever = (uint8_t *) malloc (5); Whatever[0] = 'M'; Whatever[1] = '.'; Whatever[2] = 'K'; diff --git a/prowizard/rippers/XannPlayer.c b/prowizard/rippers/XannPlayer.c index c9cb037d..aebbc8da 100644 --- a/prowizard/rippers/XannPlayer.c +++ b/prowizard/rippers/XannPlayer.c @@ -6,7 +6,7 @@ #include "extern.h" -short testXANN ( void ) +int16_t testXANN ( void ) { /* test 1 */ if ( PW_i < 3 ) @@ -146,14 +146,14 @@ void Rip_XANN ( void ) void Depack_XANN ( void ) { - Uchar c1=0x00,c2=0x00; - Uchar poss[37][2]; - Uchar Max=0x00; - Uchar Note,Smp,Fx,FxVal; - Uchar *Whatever; - long i=0,j=0,l=0,z; - long WholeSampleSize=0; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t c1=0x00,c2=0x00; + uint8_t poss[37][2]; + uint8_t Max=0x00; + uint8_t Note,Smp,Fx,FxVal; + uint8_t *Whatever; + int32_t i=0,j=0,l=0,z; + int32_t WholeSampleSize=0; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -161,11 +161,11 @@ void Depack_XANN ( void ) if ( Save_Status == BAD ) return; - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* title */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -202,8 +202,8 @@ void Depack_XANN ( void ) /* use of htonl() suggested by Xigh !.*/ j/=2; z = htonl(j); - Whatever[0] = *((Uchar *)&z+2); - Whatever[1] = *((Uchar *)&z+3); + Whatever[0] = *((uint8_t *)&z+2); + Whatever[1] = *((uint8_t *)&z+3); fwrite ( Whatever , 2 , 1 , out ); /* write loop size */ diff --git a/prowizard/rippers/ZenPacker.c b/prowizard/rippers/ZenPacker.c index cfe15748..f91b1f36 100644 --- a/prowizard/rippers/ZenPacker.c +++ b/prowizard/rippers/ZenPacker.c @@ -6,7 +6,7 @@ #include "extern.h" -short testZEN ( void ) +int16_t testZEN ( void ) { /* test #1 */ if ( PW_i<9 ) @@ -151,18 +151,18 @@ void Rip_ZEN ( void ) void Depack_ZEN ( void ) { - Uchar PatPos; - Uchar *Whatever; - Uchar PatMax; - Uchar poss[37][2]; - Uchar Note,Smp,Fx,FxVal; - long WholeSampleSize=0; - long Pattern_Address[128]; - long Pattern_Address_Real[128]; - long Pattern_Table_Address; - long Sample_Data_Address=999999l; - long i,j,k,z; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + uint8_t PatPos; + uint8_t *Whatever; + uint8_t PatMax; + uint8_t poss[37][2]; + uint8_t Note,Smp,Fx,FxVal; + int32_t WholeSampleSize=0; + int32_t Pattern_Address[128]; + int32_t Pattern_Address_Real[128]; + int32_t Pattern_Table_Address; + int32_t Sample_Data_Address=999999l; + int32_t i,j,k,z; + int32_t Where=PW_Start_Address; /* main pointer to prevent fread() */ FILE *out; fillPTKtable(poss); @@ -172,7 +172,7 @@ void Depack_ZEN ( void ) BZERO ( Pattern_Address , 128*4); BZERO ( Pattern_Address_Real , 128*4); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); /* read pattern table address */ @@ -190,7 +190,7 @@ void Depack_ZEN ( void ) /*printf ( "Size of pattern list : %d\n" , PatPos );*/ /* write title */ - Whatever = (Uchar *) malloc (1024); + Whatever = (uint8_t *) malloc (1024); BZERO ( Whatever , 1024 ); fwrite ( Whatever , 20 , 1 , out ); @@ -229,8 +229,8 @@ void Depack_ZEN ( void ) /* write loop start */ /* use of htonl() suggested by Xigh !.*/ z = htonl(j); - Whatever[48] = *((Uchar *)&z+2); - Whatever[49] = *((Uchar *)&z+3); + Whatever[48] = *((uint8_t *)&z+2); + Whatever[49] = *((uint8_t *)&z+3); fwrite ( &Whatever[48] , 2 , 1 , out ); /* write loop size */ diff --git a/prowizard/rippers/bnr.c b/prowizard/rippers/bnr.c new file mode 100644 index 00000000..922c208d --- /dev/null +++ b/prowizard/rippers/bnr.c @@ -0,0 +1,214 @@ +/* testBNR() */ +/* Rip_BNR() */ +/* Depack_BNR() */ + +#include "globals.h" +#include "extern.h" + + +short testBNR ( void ) +{ + /* test 1 */ + if ( PW_i < 1080 ) + { + /*printf ( "#1 (PW_i:%ld)\n" , PW_i );*/ + return BAD; + } + + /* test 2 */ + PW_Start_Address = PW_i-1080; + PW_WholeSampleSize = 0; + for ( PW_k=0 ; PW_k<31 ; PW_k++ ) + { + /* size */ + PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); + /* loop size */ + PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2); + /* loop start */ + PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); + + if ( test_smps(PW_j*2, PW_n, PW_m, in_data[PW_Start_Address+45+30*PW_k], in_data[PW_Start_Address+44+30*PW_k] ) == BAD ) + { + /*printf ( "start : %ld\n", PW_Start_Address );*/ + return BAD; + } + + PW_WholeSampleSize += PW_j; + } + + /* test #4 pattern list size */ + PW_l = in_data[PW_Start_Address+950]; + if ( (PW_l>127) || (PW_l==0) ) + { + /*printf ( "#4,0 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + /* PW_l holds the size of the pattern list */ + PW_k=0; + for ( PW_j=0 ; PW_j<128 ; PW_j++ ) + { + if ( in_data[PW_Start_Address+952+PW_j] > PW_k ) + PW_k = in_data[PW_Start_Address+952+PW_j]; + if ( in_data[PW_Start_Address+952+PW_j] > 127 ) + { + /*printf ( "#4,1 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + } + /* PW_k holds the highest pattern number */ + /* test last patterns of the pattern list = 0 ? */ + PW_j += 2; /* found some obscure ptk :( */ + while ( PW_j < 128 ) + { + if ( in_data[PW_Start_Address+952+PW_j] > 0x7f ) + { + /*printf ( "#4,2 (Start:%ld) (PW_j:%ld) (at:%ld)\n" , PW_Start_Address,PW_j ,PW_Start_Address+952+PW_j );*/ + return BAD; + } + PW_j += 1; + } + /* PW_k is the number of pattern in the file (-1) */ + PW_k += 1; + + + /* test #5 pattern data ... */ + if ( ((PW_k*1024)+1084+PW_Start_Address) > PW_in_size ) + { + /*printf ( "#5,0 (Start:%ld)(1patsize:%ld)\n" , PW_Start_Address, 1024);*/ + return BAD; + } + + return GOOD; +} + + +/* Rip_AC1D */ +void Rip_BNR ( void ) +{ + /* PW_WholeSampleSize still hold the whole sample size */ + /* PW_k is still the number of pattern stored */ + + OutputSize = PW_WholeSampleSize + (PW_k*1024) + 1084; + + CONVERT = GOOD; + Save_Rip ( "Binary Packer module", BNR ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + + + +/* + * bnr.c 1999 (c) Asle / ReDoX + * 20071223 - added into PW at Muerto's request +*/ +void Depack_BNR ( void ) +{ + uint8_t c1,c2; + uint8_t *Whatever; + uint8_t Nbr_Pat=0; + uint8_t poss[37][2]; + int32_t WholeSampleSize=0; + int32_t i,j; + int32_t Where = PW_Start_Address; + FILE *out; + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + fillPTKtable(poss); + + /*printf ("\nWhere:%ld\n", Where);*/ + + /* read header */ + Whatever = (uint8_t *) malloc (1084); + BZERO ( Whatever , 1084 ); + for ( i=0 ; i<1084 ; i++ ) + { + Whatever[i] = in_data[i+Where]; + } + + /* reorder loops and sample size */ + for (i=0 ; i<31 ; i++) + { + c1 = Whatever[i*30+20+26]; + c2 = Whatever[i*30+20+27]; + Whatever[i*30+20+26] = Whatever[i*30+20+28]; + Whatever[i*30+20+27] = Whatever[i*30+20+29]; + Whatever[i*30+20+28] = c1; + Whatever[i*30+20+29] = c2; + WholeSampleSize += (((Whatever[i*30+20+22]*256)+Whatever[i*30+20+23])*2); + } + + /* M.K. ... */ + Whatever[1080] = 'M'; + Whatever[1081] = '.'; + Whatever[1082] = 'K'; + Whatever[1083] = '.'; + + /* write header */ + fwrite (Whatever,1084,1,out); + Where += 1084; + + /* get number of patterns */ + for (i=952; i<1080 ; i++) + { + if (Whatever[i] > Nbr_Pat) + Nbr_Pat = Whatever[i]; + } + Nbr_Pat += 1; + + /* pattern data */ + for ( i=0 ; i>2)&0x0f; + /* Smp Number */ + Whatever[j*4+2] |= (in_data[Where+i*1024+j*4+3]<<1)&0xf0; + Whatever[j*4] = (in_data[Where+i*1024+j*4+3]>>3)&0xf0; + + /* test flag #2 */ + if ( (in_data[Where+i*1024+j*4] & 0x40) == 0x40 ) + continue; + /* test flag #1 */ + if ( (in_data[Where+i*1024+j*4] & 0x80) == 0x80 ) + { +/* printf ( "!!! at : %ld, Fx '%x' was converted to 0x0F\n" + , var+i*1024+j*4 + , WholeFile[var+i*1024+j*4] );*/ + Whatever[j*4+2] |= 0x0f; /* forcing set BPM */ + } + + /* notes ... */ + Whatever[j*4] |= poss[37-(in_data[Where+i*1024+j*4+1]>>1)][0]&0x0f; + Whatever[j*4+1] = poss[37-(in_data[Where+i*1024+j*4+1]>>1)][1]; + + } + fwrite ( Whatever , 1024 , 1 , out ); + } + + free ( Whatever ); + + /* sample data */ + Where += (Nbr_Pat*1024); + /*for (i = Where; i PW_in_size ) @@ -45,7 +45,8 @@ short testArcDDataCruncher ( void ) } -short testCRND ( void ) +/* reminder : PW_l must get the packed size */ +int16_t testCRND ( void ) { PW_Start_Address = PW_i; @@ -62,3 +63,33 @@ short testCRND ( void ) return GOOD; } + +/* reminder : PW_l must get the packed size */ +int16_t testB9AB ( void ) +{ + if (PW_i<13) + return BAD; + PW_Start_Address = PW_i-13; + + /* packed size */ + PW_l = ( (in_data[PW_Start_Address]*256*256*256) + + (in_data[PW_Start_Address+1]*256*256) + + (in_data[PW_Start_Address+2]*256) + + in_data[PW_Start_Address+3] ); + /* unpacked size */ + PW_m = ( (in_data[PW_Start_Address+8]*256*256*256) + + (in_data[PW_Start_Address+9]*256*256) + + (in_data[PW_Start_Address+10]*256) + + in_data[PW_Start_Address+11] ); + + if ( (PW_l + PW_i) > PW_in_size ) + return BAD; + if ( PW_l > 0x989689 ) + return BAD; + if ( PW_m > 0x989689 ) + return BAD; + if ( (PW_l + PW_i) > PW_in_size ) + return BAD; + + return GOOD; +} diff --git a/prowizard/rippers/mosh.c b/prowizard/rippers/mosh.c new file mode 100644 index 00000000..328b138a --- /dev/null +++ b/prowizard/rippers/mosh.c @@ -0,0 +1,185 @@ +/* testMOSH() */ +/* Rip_MOSH() */ +/* Depack_MOSH() */ + + +#include "globals.h" +#include "extern.h" + + +int16_t testMOSH ( void ) +{ + /* test 1 */ + if ( PW_i < 378 ) + { + return BAD; + } + + PW_Start_Address = PW_i-378; + + /* samples */ + PW_WholeSampleSize = 0; + for ( PW_k=0 ; PW_k<31 ; PW_k++ ) + { + /* size */ + PW_j = (((in_data[PW_Start_Address+6+PW_k*8]*256)+in_data[PW_Start_Address+7+PW_k*8])*2); + /* loop start */ + PW_m = (((in_data[PW_Start_Address+2+PW_k*8]*256)+in_data[PW_Start_Address+3+PW_k*8])*2); + /* loop size */ + PW_n = (((in_data[PW_Start_Address+PW_k*8]*256)+in_data[PW_Start_Address+1+PW_k*8])*2); + + if ( test_smps(PW_j*2, PW_m, PW_n, in_data[PW_Start_Address+5+8*PW_k], in_data[PW_Start_Address+4+8*PW_k] ) == BAD ) + { + /*printf ( "start : %ld\n", PW_Start_Address );*/ + return BAD; + } + + PW_WholeSampleSize += PW_j; + } + + /* test #4 pattern list size */ + PW_l = in_data[PW_Start_Address+248]; + if ( (PW_l>127) || (PW_l==0) ) + { + /*printf ( "#4,0 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + /* PW_l holds the size of the pattern list */ + PW_k=0; + for ( PW_j=0 ; PW_j<128 ; PW_j++ ) + { + if ( in_data[PW_Start_Address+250+PW_j] > PW_k ) + PW_k = in_data[PW_Start_Address+250+PW_j]; + if ( in_data[PW_Start_Address+250+PW_j] > 127 ) + { + /*printf ( "#4,1 (Start:%ld)\n" , PW_Start_Address );*/ + return BAD; + } + } + /* PW_k is the number of pattern in the file (-1) */ + PW_k += 1; + + + /* test #5 pattern data ... */ + if ( ((PW_k*1024)+382+PW_Start_Address) > PW_in_size ) + { + /*printf ( "#5,0 (Start:%ld)\n" , PW_Start_Address);*/ + return BAD; + } + for ( PW_j=0 ; PW_j<(PW_k*256) ; PW_j++ ) + { + /* sample > 1f or pitch > 358 ? */ + if ( in_data[PW_Start_Address+382+PW_j*4] > 0x13 ) + { + /*printf ( "#5.1 (Start:%ld)(sample value:%x)(Where:%lx)\n" , PW_Start_Address,in_data[PW_Start_Address+382+PW_j*4],PW_Start_Address+382+PW_j*4);*/ + return BAD; + } + PW_l = ((in_data[PW_Start_Address+382+PW_j*4]&0x0f)*256)+in_data[PW_Start_Address+383+PW_j*4]; + if ( (PW_l>0) && (PW_l<0x1C) ) + { + /*printf ( "#5,2 (Start:%ld)(PW_l:%lx)(Where:%lx)\n" , PW_Start_Address,PW_l,PW_Start_Address+382+PW_j*4 );*/ + return BAD; + } + } + + return GOOD; +} + + + +void Rip_MOSH ( void ) +{ + /* PW_k is still the number of patterns */ + + OutputSize = (PW_k*1024) + 382 + PW_WholeSampleSize; + + CONVERT = GOOD; + Save_Rip ( "MOSH packed module", MOSH ); + + if ( Save_Status == GOOD ) + PW_i += 379; /* after the 'M' of M.K. */ +} + + + +/* + * MOSH.c 2007 (c) Asle + * +*/ +void Depack_MOSH ( void ) +{ + uint8_t *Whatever; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0; + int32_t Where=PW_Start_Address; + FILE *out; + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + Whatever = (uint8_t *) malloc (1024); + BZERO (Whatever , 1024); + /* title */ + fwrite ( Whatever , 20 , 1 , out ); + + for ( i=0 ; i<31 ; i++ ) + { + /* loop size */ + Whatever[i*30+28] = in_data[Where]; + Whatever[i*30+29] = in_data[Where+1]; + /* loop start */ + Whatever[i*30+26] = in_data[Where+2]; + Whatever[i*30+27] = in_data[Where+3]; + /* fine */ + Whatever[i*30+24] = in_data[Where+4]; + /* volume */ + Whatever[i*30+25] = in_data[Where+5]; + /* size */ + Whatever[i*30+22] = in_data[Where+6]; + Whatever[i*30+23] = in_data[Where+7]; + WholeSampleSize += (((in_data[Where+6]*256)+in_data[Where+7])*2); + + Where += 8; + } + fwrite (Whatever,930,1,out); + /*printf ( "Whole sample size : %ld\n" , WholeSampleSize );*/ + + /* write until after M.K. */ + fwrite ( &in_data[Where] , 134 , 1 , out ); + Where += 2; /* to be on at the patternlist level */ + + /* getting highest pattern */ + Max = 0x00; + for ( i=0 ; i<128 ; i++ ) + { + Max = ( in_data[Where] > Max ) ? in_data[Where] : Max; + Where += 1; + } + Max += 1; + Where += 4; /*M.K.*/ + /*printf ( "\nNumber of pattern : %d\n" , Max );*/ + fwrite ( &in_data[Where] , (Max*1024) , 1 , out ); + Where += (Max*1024); /*patdata*/ + + /* pattern data */ + + free ( Whatever ); + + /* sample data */ + fwrite ( &in_data[Where] , WholeSampleSize , 1 , out ); + + + /* crap */ + Crap ( " Mosh Player " , BAD , BAD , out ); + + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ +} + diff --git a/prowizard/rippers/okta.c b/prowizard/rippers/okta.c new file mode 100644 index 00000000..b6d369b7 --- /dev/null +++ b/prowizard/rippers/okta.c @@ -0,0 +1,141 @@ +/* testOkta() */ +/* Rip_Okta() */ + +#include "globals.h" +#include "extern.h" + + +int16_t testOkta ( void ) +{ + /* test 1 */ + PW_Start_Address = PW_i; + PW_m = PW_Start_Address; + PW_m += 12; /* after OKTASONGCMOD */ + + /* CMOD chunk size */ + PW_j = (in_data[PW_m]*256*256*256)+ + (in_data[PW_m+1]*256*256)+ + (in_data[PW_m+2]*256)+ + in_data[PW_m+3]; + if ((PW_j > 8) || (PW_j<4)) /* never seen it being different than 8 */ + { +/* printf ("invalid number of voices : %l\n",PW_j);*/ + return BAD; + } + + PW_m += PW_j+4; + /*should now be on SAMP*/ + if ((in_data[PW_m]!='S')|| + (in_data[PW_m+1]!='A')|| + (in_data[PW_m+2]!='M')|| + (in_data[PW_m+3]!='P')) + { +/* printf ("bad tag. expecting SAMP (start:%ld)\n",PW_Start_Address);*/ + return BAD; + } + + PW_m +=4; + /* SAMP chunk size */ + PW_j = (in_data[PW_m]*256*256*256)+ + (in_data[PW_m+1]*256*256)+ + (in_data[PW_m+2]*256)+ + in_data[PW_m+3]; + if (PW_j != 0x480) /* size fixed as specified */ + { +/* printf ("invalid SAMP chunk size : %lx\n",PW_j);*/ + return BAD; + } + PW_m +=4; + + /* PW_m is the first sample now */ + return GOOD; +} + + + +void Rip_Okta ( void ) +{ + int32_t Where=PW_m; +/*printf ( "Where : %ld\n",Where);*/ + + /*get the number of samples */ + PW_l = 0; + for (PW_k=0; PW_k<36; PW_k++) + { + PW_m = (in_data[Where+20+PW_k*32]*256*256*256)+ + (in_data[Where+21+PW_k*32]*256*256)+ + (in_data[Where+22+PW_k*32]*256)+ + in_data[Where+23+PW_k*32]; + if (PW_m != 0) + PW_l += 1; /* so PW_l holds the nbr of samples (i.e. SBOD)*/ + } + /* bypass SAMP */ + Where += 0x480; + + /* bypass SPEE entire chunk, which total size should be 4 + 4 + 2 */ + Where += +10; + + /* bypass SLEN word and its size which is always 2 */ + Where += 8; + + /* get song length (i.e. number of PBOD) */ + PW_m = (in_data[Where]*256)+in_data[Where+1]; + Where += 2; + + /* bypass PLEN entire chunk which size is always 4 + 4 + 2 */ + Where += 10; + + /* bypass PATT entire chunk which size is always 128 + 4 + 4 */ + Where += 136; + + /* now, lets calculate the size of patterns (PBODs) */ + for (PW_k=0; PW_k PW_in_size) + break; +/*printf ( "Where : %ld\n",Where);*/ + } + /* Where is now on the first SBOD */ + + /* now, lets calculate the size of samples (SBODs) */ + for (PW_k=0; PW_k PW_in_size) + { + PW_o = BAD; + break; + } + } + /* We're is now at the end of the OKTA file */ + + + if (PW_o != BAD) + { + OutputSize = Where - PW_Start_Address; + + CONVERT = BAD; + Save_Rip ( "Oktalizer module", Oktalizer ); + + if ( Save_Status == GOOD ) + PW_i += 1; + } + else + { + printf ("found a too much truncated Oktalizer file\n"); + } +} + diff --git a/prowizard/rippers/pmd3.c b/prowizard/rippers/pmd3.c new file mode 100644 index 00000000..bff21c6e --- /dev/null +++ b/prowizard/rippers/pmd3.c @@ -0,0 +1,310 @@ +/* testPMD3() */ +/* Rip_PMD3() */ +/* Depack_PMD3() */ + + +#include "globals.h" +#include "extern.h" + + +int16_t testPMD3 ( void ) +{ + /* test 1 */ + if ( PW_i < 1080 ) + { + /*printf ( "#1 (PW_i:%d)\n" , PW_i );*/ + return BAD; + } + /*if ( PW_Start_Address == 0)printf ("yo");*/ + + /* test 2 */ + PW_Start_Address = PW_i-1080; + + /* test 1.1 */ + if ( PW_Start_Address + 12 > PW_in_size ) + { + /*printf ( "#1.1 (PW_i:%d)\n" , PW_i );*/ + return BAD; + } + + + for ( PW_k=0 ; PW_k<31 ; PW_k++ ) + { + /* size */ + PW_j = (((in_data[PW_Start_Address+42+PW_k*30]*256)+in_data[PW_Start_Address+43+PW_k*30])*2); + /* loop start */ + PW_m = (((in_data[PW_Start_Address+46+PW_k*30]*256)+in_data[PW_Start_Address+47+PW_k*30])*2); + /* loop size */ + PW_n = (((in_data[PW_Start_Address+48+PW_k*30]*256)+in_data[PW_Start_Address+49+PW_k*30])*2); + + if ( test_smps (PW_j,PW_m,PW_n,in_data[PW_Start_Address+45+PW_k*30]/2,in_data[PW_Start_Address+44+PW_k*30]) == BAD ) + { + /*printf ( "#2 (Start:%d)(siz:%d)(lstart:%d)(lsiz:%d) (smp:%d)\n" , PW_Start_Address,PW_j,PW_m,PW_n,PW_k );*/ + return BAD; + } + } + + /*if ( PW_Start_Address == 0)printf ("yo");*/ + + /* test #4 pattern list size */ + PW_l = in_data[PW_Start_Address+950]; + if ( PW_l>127 ) + { + /*printf ( "#4,0 (Start:%d)\n" , PW_Start_Address );*/ + return BAD; + } + + /*if ( PW_Start_Address == 0)printf ("yo");*/ + + /* PW_l holds the size of the pattern list */ + PW_k=0; + for ( PW_j=0 ; PW_j<128 ; PW_j++ ) + { + if ( in_data[PW_Start_Address+952+PW_j] > PW_k ) + PW_k = in_data[PW_Start_Address+952+PW_j]; + if ( in_data[PW_Start_Address+952+PW_j] > 127 ) + { + /*printf ( "#4,1 (Start:%d)\n" , PW_Start_Address );*/ + return BAD; + } + } + + /*if ( PW_Start_Address == 0)printf ("yo");*/ + + /* PW_k holds the highest pattern number */ + /* test last patterns of the pattern list = 0 ? */ + PW_j += 2; /* found some obscure ptk :( */ + while ( PW_j < 128 ) + { + if ( in_data[PW_Start_Address+952+PW_j] > 0x7f ) + { + /*printf ( "#4,2 (Start:%d) (PW_j:%d) (at:%d)\n" , PW_Start_Address,PW_j ,PW_Start_Address+952+PW_j );*/ + return BAD; + } + PW_j += 1; + } + /* PW_k is the number of pattern in the file (-1) */ + PW_k += 1; + + /* if ( PW_Start_Address == 0)printf ("yo");*/ + + /* test #5 size ... */ + PW_m = ((in_data[PW_Start_Address+1084]*256*256*256)+ + (in_data[PW_Start_Address+1085]*256*256)+ + (in_data[PW_Start_Address+1086]*256)+ + in_data[PW_Start_Address+1087]); + PW_o = ((in_data[PW_Start_Address+1088]*256*256*256)+ + (in_data[PW_Start_Address+1089]*256*256)+ + (in_data[PW_Start_Address+1090]*256)+ + in_data[PW_Start_Address+1091]); + if ( (PW_o + PW_n +PW_Start_Address) > PW_in_size ) + { + /*printf ( "#5,0 (Start:%d)\n" , PW_Start_Address );*/ + return BAD; + } + + return GOOD; +} + + +void Rip_PMD3 ( void ) +{ + uint8_t c=0x00; + /* PW_k is still the nbr of pattern */ + /* PW_m is still the size of note pointers */ + /* PW_o is still the size of ref table for notes */ + + if (in_data[PW_Start_Address + 1082] == 'D') + c = 0x20; + else /* 'd' */ + c = 0x40; + + PW_WholeSampleSize = 0; + for ( PW_j=0 ; PW_j<31 ; PW_j++ ) + PW_WholeSampleSize += (((in_data[PW_Start_Address+42+PW_j*30]*256)+in_data[PW_Start_Address+43+PW_j*30])*2); + + OutputSize += PW_WholeSampleSize + PW_m + PW_o + 1092 + (PW_k*c); + + CONVERT = BAD; + if (c == 0x20) + Save_Rip ( "Module-Patterncompressor (PMD3)", PMD3 ); + else + Save_Rip ( "Module-Patterncompressor (PMd3)", PMd3 ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + + + +/* + * PMD3.c 20160413 (c) Asle + * + * Converts PMD3 MODs back to PTK or OCT + * +*/ + +void Depack_PMD3 ( void ) +{ + uint8_t c=0x00; + uint8_t *Whatever; + uint8_t Max=0x00; + int32_t WholeSampleSize=0; + int32_t i=0, addy1, addy2, addy3, size1, size2, size3, ptr1, ptr2, ptr3; + int32_t Where=PW_Start_Address; + FILE *out; /*, *DEBUG;*/ + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + +/* DEBUG = fopen ("_debug_.txt", "w+b");*/ + + /* get whole sample size and patch vols (/2)*/ + for ( i=0 ; i<31 ; i++ ) + { + WholeSampleSize += (((in_data[Where+42+i*30]*256)+in_data[Where+43+i*30])*2); + } + /*printf ( "Whole sanple size : %ld\n" , WholeSampleSize );*/ + + /* read and write whole header */ + fwrite ( &in_data[Where] , 1080 , 1 , out ); + + /* write ID */ + if (in_data[PW_Start_Address + 1082] == 'D') + c = 0x20; + else /* 'd' */ + c = 0x40; + + Whatever = (uint8_t *) malloc (4); + if (c == 0x20) + { + Whatever[0] = 'M'; + Whatever[1] = '.'; + Whatever[2] = 'K'; + Whatever[3] = '.'; + } + else + { + Whatever[0] = 'C'; + Whatever[1] = 'D'; + Whatever[2] = '8'; + Whatever[3] = '1'; + } + fwrite ( Whatever , 4 , 1 , out ); + free ( Whatever ); + + Where += 952; + + /* get number of pattern */ + Max = 0x00; + for ( i=0 ; i<128 ; i++ ) + { + if ( in_data[Where+i] > Max ) + Max = in_data[Where+i]; + } + Max += 1; + /*printf ( "Number of pattern : %d\n" , Max );*/ + + Where += (128 + 4); + + ptr1 = addy1 = Where + 8; + size1 = Max * c; /* c says if it's 4 or 8 channels */ + ptr2 = addy2 = addy1 + size1; + size2 = ((in_data[Where+0]*256*256*256)+ + (in_data[Where+1]*256*256)+ + (in_data[Where+2]*256)+ + in_data[Where+3]); + ptr3 = addy3 = addy2 + size2; + size3 = ((in_data[Where+4]*256*256*256)+ + (in_data[Where+5]*256*256)+ + (in_data[Where+6]*256)+ + in_data[Where+7]); + + + /* pattern data */ + for (i=0; i %d & %d => ",PW_j+ptr2+l, PW_j+l, in_data[PW_j+ptr2+l], c1,c2);*/ + l+=1; + + /* fetch relative note and write it */ +/* fprintf (DEBUG,"%x-%x-%x-%x | ", + in_data[PW_k+ptr3+c2], + in_data[PW_k+ptr3+c2+1], + in_data[PW_k+ptr3+c2+2], + in_data[PW_k+ptr3+c2+3] + );*/ + for (repeat=0; repeat PW_in_size ) + { + /*printf ( "#2 (start:%ld) (central addy:%ld)\n" , PW_Start_Address , PW_m);*/ + return BAD; + } + + /* test some bytes */ + if ( (in_data[PW_Start_Address+6] != 0xFF) || (in_data[PW_Start_Address+7] != 0xD4) ) + { + /*printf ( "#3 (start:%ld)\n" , PW_Start_Address);*/ + return BAD; + } + + /* get tech addys */ + PW_n = (( in_data[PW_Start_Address+PW_m-2+2]*256)+ /* smps desc */ + in_data[PW_Start_Address+PW_m-1+2] ); + PW_o = (( in_data[PW_Start_Address+PW_m-6+2]*256)+ /* patlist addy */ + in_data[PW_Start_Address+PW_m-5+2] ); + PW_j = (( in_data[PW_Start_Address+PW_m-10+2]*256)+ /* pat data addy */ + in_data[PW_Start_Address+PW_m-9+2] ); + + /* test in-size again */ + if ( (PW_Start_Address+PW_m+2+PW_n+4 > PW_in_size ) || + (PW_Start_Address+PW_m+2+PW_o+4 > PW_in_size ) ) + { + /*printf ( "#4 (start:%ld) (PW_n:%ld) (PW_o:%ld) (PW_j:%ld)\n" , PW_Start_Address , PW_n,PW_o,PW_j);*/ + return BAD; + } + + /* check both adresses consistency */ + if ( (PW_n <= PW_o) && (PW_n != 1) ) + { + /*printf ( "#5 (start:%ld) (smp addy:%ld) (patlist addy:%ld) (PW_m:%ld)\n" , PW_Start_Address , PW_n, PW_o,PW_m);*/ + return BAD; + } + + /* no sample - then check only patlist at the end */ + if (PW_n == 1) + { + PW_k = PW_Start_Address+PW_m+2+PW_o; + if ( (PW_k + 4) > PW_in_size ) /* one pattern ? odd but ... */ + return GOOD; + PW_k += 4; + PW_l = 1; + PW_n = PW_o - PW_j; + /*printf ("(PW_k:%ld)(PW_n:%ld)\n",PW_k,PW_n);*/ + while(PW_l < PW_n) + { + /*printf ("%lx - \n", PW_l);*/ + PW_l = (( in_data[PW_k]*256*256*256)+ + ( in_data[PW_k+1]*256*256)+ + ( in_data[PW_k+2]*256)+ + in_data[PW_k+3] ); + if ( ((PW_k + 4) > PW_in_size ) || (PW_l == 0)) /* end of file, so end of patlist .. or 0 */ + return GOOD; + PW_k += 4; + } + PW_k -= 4; + } + else /* there are some samples */ + { + PW_n = PW_Start_Address+PW_m+2+PW_n; + PW_m = (in_data[PW_n+2]*256) + in_data[PW_n+3]; + if ( ((PW_n+PW_m) > PW_in_size) || ((PW_m%32) != 0) ) + { + /*printf ( "#6 (start:%ld) (size of smp desc:%ld)(PW_n:%ld)\n" , PW_Start_Address , PW_m,PW_n);*/ + return BAD; + } + if ( PW_m == 0 ) + { /* weird hack ?!? try to guess the smp desc size */ + for ( ; ;PW_m += 32 ) + { + /*printf ("+");*/ + if (PW_m + 4 + 32 > PW_in_size) + { + /*printf ( "#6,1 (start:%ld) (size of smp desc:%ld)(PW_n:%ld)\n" , PW_Start_Address , PW_m,PW_n);*/ + return BAD; + } + PW_j = (( in_data[PW_n+PW_m+4]*256*256*256)+ + ( in_data[PW_n+PW_m+5]*256*256)+ + ( in_data[PW_n+PW_m+6]*256)+ + in_data[PW_n+PW_m+7] ); + PW_k = (( in_data[PW_n+PW_m+8]*256*256*256)+ + ( in_data[PW_n+PW_m+9]*256*256)+ + ( in_data[PW_n+PW_m+10]*256)+ + in_data[PW_n+PW_m+11] ); + PW_l = (( in_data[PW_n+PW_m+12]*256*256*256)+ + ( in_data[PW_n+PW_m+13]*256*256)+ + ( in_data[PW_n+PW_m+14]*256)+ + in_data[PW_n+PW_m+15] ); + if ((PW_j > PW_k) || (PW_k >= PW_l)) + { + /*printf ("%lx,%lx,%lx\n",PW_j,PW_k,PW_l);*/ + break; + } + } + } + /*printf ("\n(PW_n:%ld)(PW_m:%ld)\n",PW_n,PW_m);*/ + /* get biggest end addy of samples */ + PW_o = 0; + for ( PW_j=0; PW_j<(PW_m/32); PW_j+=1) + { + /*printf ("%lx - \n",PW_o);*/ + PW_k = ((in_data[PW_n+14+PW_j*32]*256) + in_data[PW_n+15+PW_j*32]); + if (PW_k > PW_o) + PW_o = PW_k; + } + PW_n += (PW_m + PW_o + 4); + } + + return GOOD; +} + + + +void Rip_SIDMON1 ( void ) +{ + + OutputSize = PW_n - PW_Start_Address; + + CONVERT = BAD; + Save_Rip ( "Sidmon v1 module", Sidmon1 ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + diff --git a/prowizard/rippers/sidmon2.c b/prowizard/rippers/sidmon2.c new file mode 100644 index 00000000..ead29867 --- /dev/null +++ b/prowizard/rippers/sidmon2.c @@ -0,0 +1,82 @@ +/* + thanks to Laurent Clevy + 20091125 - Asle + 20160319 - reworked from scratch +*/ +/* testSIDMON2() */ +/* Rip_SIDMON2() */ + + + +#include "globals.h" +#include "extern.h" + + +int16_t testSIDMON2 ( void ) +{ + if (PW_i<58) + return BAD; + + + PW_Start_Address = PW_i-58; + if ((PW_Start_Address + 0x5a) > PW_in_size) + return BAD; + + if ( (in_data[PW_Start_Address+6] != 0x00) || + (in_data[PW_Start_Address+7] != 0x00) || + (in_data[PW_Start_Address+8] != 0x00) || + (in_data[PW_Start_Address+9] != 0x1c) || + (in_data[PW_Start_Address+10]!= 0x00) || + (in_data[PW_Start_Address+11] != 0x00) || + (in_data[PW_Start_Address+12] != 0x00) || + (in_data[PW_Start_Address+13] != 0x04) || + (in_data[PW_Start_Address+68] != '-') || + (in_data[PW_Start_Address+69] != ' ') || + (in_data[PW_Start_Address+70] != 'T')) + return BAD; + + /* successives sizes */ + PW_n = 0; + for (PW_j = 0; PW_j<11; PW_j++) + { + PW_m = (( in_data[PW_Start_Address+14+(PW_j*4)]*256*256*256)+ + ( in_data[PW_Start_Address+15+(PW_j*4)]*256*256)+ + ( in_data[PW_Start_Address+16+(PW_j*4)]*256)+ + in_data[PW_Start_Address+17+(PW_j*4)] ); + PW_n += PW_m; + if ( ((PW_Start_Address + PW_n) > PW_in_size ) || (PW_m > 0xffff) || (PW_m == 0)) + { + /*printf ( "#1,%ld (start:%ld) (size:%ld)\n" , PW_j, PW_Start_Address , PW_m);*/ + return BAD; + } + if (PW_j == 7) + { + PW_k = (( in_data[PW_Start_Address+4]*256)+ + in_data[PW_Start_Address+5] ); + if (PW_k != PW_m) + { + /*printf ( "#1,a (start:%ld) (size:%ld) (PW_k:%ld)\n" , PW_Start_Address , PW_m,PW_k);*/ + return BAD; + } + } + } + /*printf ("(PW_n:%u)\n",PW_n);*/ + + + return GOOD; +} + + + +void Rip_SIDMON2 ( void ) +{ + + OutputSize = PW_i - PW_Start_Address; + + CONVERT = BAD; + Save_Rip ( "Sidmon v2 module", Sidmon2 ); + + if ( Save_Status == GOOD ) + PW_i += 1; +} + diff --git a/prowizard/rippers/skizzo.c b/prowizard/rippers/skizzo.c index 9e45d4da..8adcfe1b 100644 --- a/prowizard/rippers/skizzo.c +++ b/prowizard/rippers/skizzo.c @@ -1,181 +1,184 @@ -/* (5th of may 2007) -*/ -/* testSkizzo() */ -/* Rip_Skizzo() */ -/* Depack_Skizzo() */ - - -#include "globals.h" -#include "extern.h" - - -short testSkizzo ( void ) -{ - /* test #1 */ - PW_Start_Address = PW_i-24; - if ((PW_i + 38) > PW_in_size) - { - /*printf ("[1] PW_Start_Address : %ld\n", PW_Start_Address);*/ - return BAD; - } - PW_j = in_data[PW_Start_Address+22]; /* nbr of samples */ - if ((PW_j > 31) || (PW_j==0)) - { - /*printf ("[2] (nbr of samples:%ld) PW_Start_Address : %ld\n", PW_j,PW_Start_Address);*/ - return BAD; - } - - return GOOD; -} - - -void Rip_Skizzo ( void ) -{ - /* PW_j is the nbr of samples */ - /* get nbr of stored patts */ - PW_k = in_data[PW_Start_Address+23]; - /* get size of patlist */ - PW_m = in_data[PW_Start_Address+20] & 0x7f; - PW_WholeSampleSize = 0; - for ( PW_l=0 ; PW_l PW_in_size) + { + /*printf ("[1] PW_Start_Address : %ld\n", PW_Start_Address);*/ + return BAD; + } + PW_j = in_data[PW_Start_Address+22]; /* nbr of samples */ + if ((PW_j > 31) || (PW_j==0)) + { + /*printf ("[2] (nbr of samples:%ld) PW_Start_Address : %ld\n", PW_j,PW_Start_Address);*/ + return BAD; + } + + return GOOD; +} + + +void Rip_Skizzo ( void ) +{ + /* PW_j is the nbr of samples */ + /* get nbr of stored patts */ + PW_k = in_data[PW_Start_Address+23]; + /* get size of patlist */ + PW_m = in_data[PW_Start_Address+20] & 0x7f; + PW_WholeSampleSize = 0; + for ( PW_l=0 ; PW_l PW_in_size) + return BAD; + + /* test samples */ + PW_n = 0; + PW_WholeSampleSize = 0; + for ( PW_k=0 ; PW_k<15 ; PW_k++ ) + { + /* fine */ + if ( in_data[PW_Start_Address+2+PW_k*12] != 0 ) + return BAD; + /* volume */ + if ( in_data[PW_Start_Address+3+PW_k*12] > 0x40 ) + return BAD; + /* size */ + samplesize = ((in_data[PW_Start_Address+PW_k*12] * 256) + in_data[PW_Start_Address+1+PW_k*12])*2; + PW_WholeSampleSize += samplesize; + /* lstart */ + PW_j = ((in_data[PW_Start_Address+4+PW_k*12] * 256) + in_data[PW_Start_Address+5+PW_k*12])*2; + /* lsize */ + PW_o = ((in_data[PW_Start_Address+6+PW_k*12] * 256) + in_data[PW_Start_Address+7+PW_k*12])*2; + /* sizes tests */ + if ((PW_j > samplesize+2) || (PW_o > samplesize+2 ) || ((PW_j + PW_o)>(samplesize*2)+2)) + return BAD; + /* loop start not 0 while size 0*/ + if ((PW_j != 0) && (PW_o == 0)) + return BAD; + /* loop start = loop size not 0 */ + if ((PW_j + PW_o) > samplesize) + return BAD; + /* addys */ + PW_m = ((in_data[PW_Start_Address+8+PW_k*12]*256*256*256) + + (in_data[PW_Start_Address+9+PW_k*12]*256*256) + + (in_data[PW_Start_Address+10+PW_k*12]*256) + + in_data[PW_Start_Address+11+PW_k*12]); + if ((PW_m < PW_n) || (PW_m < 0x100)) + return BAD; + PW_n = PW_m; + } + + /* pattern size */ + PW_j = in_data[PW_Start_Address+193]; + if ( (PW_j == 0) || (PW_j > 64) ) + return BAD; + + /* pattern list */ + PW_j = in_data[PW_Start_Address+193]; + for (PW_k = 0; PW_k<0x38; PW_k++) + { + if ( in_data[PW_Start_Address+194+PW_k] > 0x38 ) + return BAD; + } + + /* whole size ok ? */ + if ( PW_WholeSampleSize < 4 ) + return BAD; + + return GOOD; +} + + +void Rip_STRUGGLE ( void ) +{ + PW_WholeSampleSize = 0; + for ( PW_k=0 ; PW_k<15 ; PW_k++ ) + PW_WholeSampleSize += ((in_data[PW_Start_Address+PW_k*12]*256)+in_data[PW_Start_Address+1+PW_k*12])*2; + + PW_n = 0; + for ( PW_k=0 ; PW_k<0x38 ; PW_k++ ) + if (in_data[PW_Start_Address+PW_k+0xC2] > PW_n) + PW_n = in_data[PW_Start_Address+PW_k+0xC2]; + + PW_n += 1; /* max pattern number */ + + /* 0x100 header size */ + OutputSize = 0x100 + PW_WholeSampleSize + (PW_n*768); + + CONVERT = GOOD; + Save_Rip ( "Struggle game module", STRUGGLE ); + + if ( Save_Status == GOOD ) + PW_i += 3; +} + + +/* + * STRUGGLE.c 2008 (c) Sylvain "Asle" Chipaux + * + * example provided by Muerto, as usual :) +*/ + +#define ON 1 +#define OFF 2 + +void Depack_STRUGGLE ( void ) +{ + uint8_t *Whatever; + int32_t Where=PW_Start_Address; + uint32_t i=0,j=0,k=0; + FILE *out; + + if ( Save_Status == BAD ) + return; + + sprintf ( Depacked_OutName , "%d.mod" , Cpt_Filename-1 ); + out = PW_fopen ( Depacked_OutName , "w+b" ); + + /* title */ + Whatever = (uint8_t *) malloc ( 1024 ); + BZERO ( Whatever , 1024 ); + fwrite ( Whatever , 20 , 1 , out ); + + /* read and write whole header */ + /*printf ( "Converting sample headers ... " );*/ + PW_WholeSampleSize = 0; + for ( i=0 ; i<15 ; i++ ) + { + /* write name */ + fwrite ( Whatever , 22 , 1 , out ); + /* size/finetune/volume/loops */ + PW_WholeSampleSize += ((in_data[Where] * 256) + in_data[Where+1])*2; + fwrite ( &in_data[Where] , 8 , 1 , out ); + Where += 12; + } + + /* bypassing 12 empty bytes (!) */ + Where += 12; + + /* pattern list */ + fwrite (&in_data[Where+1],1,1,out); + fwrite (Whatever,1,1,out); + Where += 2; + /* 0x38 pos .. apparently */ + /* write pattern list */ + fwrite ( &in_data[Where] , 0x38 , 1 , out ); + /* complete to 128 */ + fwrite (Whatever,72,1,out); + /* get highest pattern nbr */ + for (i=0;i<0x38;i++) + { + if (in_data[Where]>j) + j = in_data[Where]; + Where ++; + } + /* j is the highest pattern number */ + + /* bypass 6 empty bytes */ + Where += 6; + + /* pattern data */ + /*printf ( "Converting pattern datas (Where = %x, j = %x)",Where,j );*/ + for ( i=0 ; i<=j ; i++ ) + { + BZERO ( Whatever , 1024 ); + for (k=0;k<64*4;k++) + { + Whatever[k*4] = in_data[Where]; + Whatever[k*4+1] = in_data[Where+1]; + Whatever[k*4+2] = in_data[Where+2]<<4; + Where += 3; + } + fwrite ( Whatever , 1024 , 1 , out ); + } + free ( Whatever ); + /*printf ( " ok\n" );*/ + /*fflush ( stdout );*/ + + + /* sample data */ + /*printf ( "Saving sample data ... " );*/ + fwrite ( &in_data[Where] , PW_WholeSampleSize , 1 , out ); + + + /* crap */ + /*Crap ( "Struggle game music" , BAD , BAD , out );*/ + + fflush ( out ); + fclose ( out ); + + printf ( "done\n" ); + return; /* useless ... but */ +} -- 2.47.3