CHANGED everything to use C/C++/MFC runtime DLLs + libpng/zlib DLL versions
ADDED workaround for missing crc32_combine function in default zlib DLL
This commit is contained in:
parent
54addad74b
commit
82b4889980
|
@ -39,17 +39,24 @@ They are built with the static C runtime (this is what the releases use).
|
|||
# Visual C++ 2008 project files #
|
||||
#################################
|
||||
|
||||
There are two solution files for Visual C++ 2008:
|
||||
Using Microsoft Visual C++ 2008, you can build the Win32/MFC and the Win32/Qt build.
|
||||
Refer to the instructions below for further assistance:
|
||||
|
||||
===Win32/MFC===
|
||||
The Windows MFC GUI version project files are located in trunk/project/vc2008_mfc (VBA2008.sln).
|
||||
In order to compile it, you have to compile or download a precompiled version of zlib and libpng first
|
||||
and set your compiler's INCLUDE and LIB path accordingly.
|
||||
You also need Microsoft's DirectX SDK (At least for DirectInput).
|
||||
This is the full-featured Windows build using the MFC GUI.
|
||||
The project files are located in trunk/project/vc2008_mfc (VBA2008.sln).
|
||||
Before you can compile it, you have to take care of some prerequisites:
|
||||
Download the zlib & libpng sources from the internet and extract them both to the same folder.
|
||||
Rename them so you have a folder called libpng and another one called zlib in the same loaction.
|
||||
Open libpng/projects/visualc71/libpng.sln. Let the assistant convert them if necessary.
|
||||
Build the "DLL Release" & "DLL Debug" configurations.
|
||||
Set up your operating system's PATH variable to point to the created zlib & libpng DLLs.
|
||||
Set up your compiler's LIB & INCLUDE paths to point to the created lib files and the source files.
|
||||
You also have to install Microsoft's DirectX SDK for DirectInput & XAudio2.
|
||||
If you want to enable OpenAL sound output, install the OpenAL SDK. If you do not want it, #define NO_OAL.
|
||||
Some pixel filters come with assembler code compatible with NASM syntax.
|
||||
Extract NASM somewhere and add it to your compiler's PATH environment variable.
|
||||
All .asm files should be handled with the "nasm.rules" build rules file.
|
||||
Some pixel filters come with assembler code, which compatible to the NASM syntax.
|
||||
Extract NASM somewhere and add it to your compiler's executable file paths.
|
||||
All .asm files will be handled with the "nasm.rules" build rules file which comes with this project file.
|
||||
|
||||
===Win32/Qt===
|
||||
The MS Visual C++ 2008 Express-compatible project file can be found in trunk/project/vc2008_qt.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)_temp"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="0"
|
||||
BuildLogFile="$(IntDir)\$(ProjectName)_BuildLog.htm"
|
||||
>
|
||||
|
@ -58,7 +58,7 @@
|
|||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeLibrary="3"
|
||||
StructMemberAlignment="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
|
@ -85,14 +85,14 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="nafxcwd.lib LIBCMTD.lib zlibd.lib libpngd.lib"
|
||||
AdditionalDependencies="zlib1d.lib libpng13d.lib"
|
||||
OutputFile="$(OutDir)\VisualBoyAdvance.exe"
|
||||
Version=""
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateManifest="true"
|
||||
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"
|
||||
IgnoreDefaultLibraryNames="nafxcwd.lib;LIBCMTD.lib"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="1"
|
||||
|
@ -129,7 +129,7 @@
|
|||
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)_temp"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="1"
|
||||
UseOfMFC="2"
|
||||
UseOfATL="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="0"
|
||||
|
@ -166,7 +166,7 @@
|
|||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=""..\..\..\dependencies\File_Extractor-0.4.3\fex";..\..\..\dependencies\msvc"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;GBA_LOGGING;OEMRESOURCE;MMX;ASM;FINAL_VERSION;BKPT_SUPPORT;_CRT_SECURE_NO_DEPRECATE;HAS_FILE_EXTRACTOR"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
FloatingPointModel="2"
|
||||
|
@ -193,17 +193,15 @@
|
|||
Name="VCLinkerTool"
|
||||
RegisterOutput="false"
|
||||
IgnoreImportLibrary="false"
|
||||
AdditionalDependencies="nafxcw.lib zlib.lib libpng.lib LIBCMT.lib"
|
||||
ShowProgress="0"
|
||||
AdditionalDependencies="zlib1.lib libpng13.lib"
|
||||
OutputFile="$(OutDir)\VisualBoyAdvance.exe"
|
||||
Version=""
|
||||
LinkIncremental="0"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""c:\Program Files\Microsoft DirectX SDK (November 2007)\lib\x86""
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateManifest="true"
|
||||
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
IgnoreDefaultLibraryNames="nafxcw.lib;LIBCMT.lib"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="false"
|
||||
AssemblyDebug="2"
|
||||
GenerateMapFile="false"
|
||||
|
@ -454,14 +452,6 @@
|
|||
<File
|
||||
RelativePath="..\..\src\memgzio.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\win32\protect.c"
|
||||
|
|
|
@ -6,6 +6,94 @@
|
|||
#include <zlib.h>
|
||||
#include "protect.h"
|
||||
|
||||
/* ========================================================================= */
|
||||
// read below
|
||||
static unsigned long gf2_matrix_times(mat, vec)
|
||||
unsigned long *mat;
|
||||
unsigned long vec;
|
||||
{
|
||||
unsigned long sum;
|
||||
|
||||
sum = 0;
|
||||
while (vec) {
|
||||
if (vec & 1)
|
||||
sum ^= *mat;
|
||||
vec >>= 1;
|
||||
mat++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
// read below
|
||||
static void gf2_matrix_square(square, mat)
|
||||
unsigned long *square;
|
||||
unsigned long *mat;
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n = 0; n < 32; n++)
|
||||
square[n] = gf2_matrix_times(mat, mat[n]);
|
||||
}
|
||||
|
||||
// This function is taken from zlib 1.2.3 (file: crc32.c)
|
||||
// It is not exported by the DLL even though it is listed in zlib.h (bug?)
|
||||
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
||||
uLong crc1;
|
||||
uLong crc2;
|
||||
z_off_t len2;
|
||||
{
|
||||
int n;
|
||||
unsigned long row;
|
||||
unsigned long even[32]; /* even-power-of-two zeros operator */
|
||||
unsigned long odd[32]; /* odd-power-of-two zeros operator */
|
||||
|
||||
/* degenerate case */
|
||||
if (len2 == 0)
|
||||
return crc1;
|
||||
|
||||
/* put operator for one zero bit in odd */
|
||||
odd[0] = 0xedb88320L; /* CRC-32 polynomial */
|
||||
row = 1;
|
||||
for (n = 1; n < 32; n++) {
|
||||
odd[n] = row;
|
||||
row <<= 1;
|
||||
}
|
||||
|
||||
/* put operator for two zero bits in even */
|
||||
gf2_matrix_square(even, odd);
|
||||
|
||||
/* put operator for four zero bits in odd */
|
||||
gf2_matrix_square(odd, even);
|
||||
|
||||
/* apply len2 zeros to crc1 (first square will put the operator for one
|
||||
zero byte, eight zero bits, in even) */
|
||||
do {
|
||||
/* apply zeros operator for this bit of len2 */
|
||||
gf2_matrix_square(even, odd);
|
||||
if (len2 & 1)
|
||||
crc1 = gf2_matrix_times(even, crc1);
|
||||
len2 >>= 1;
|
||||
|
||||
/* if no more bits set, then done */
|
||||
if (len2 == 0)
|
||||
break;
|
||||
|
||||
/* another iteration of the loop with odd and even swapped */
|
||||
gf2_matrix_square(odd, even);
|
||||
if (len2 & 1)
|
||||
crc1 = gf2_matrix_times(odd, crc1);
|
||||
len2 >>= 1;
|
||||
|
||||
/* if no more bits set, then done */
|
||||
} while (len2 != 0);
|
||||
|
||||
/* return combined crc */
|
||||
crc1 ^= crc2;
|
||||
return crc1;
|
||||
}
|
||||
/* ========================================================================= */
|
||||
|
||||
|
||||
char *unprotect_buffer(unsigned char *buffer, size_t buffer_len)
|
||||
{
|
||||
unsigned char *p = buffer, *end_p = p+buffer_len-1, previous = 0x11;
|
||||
|
|
Loading…
Reference in New Issue