diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 0aa7ea629..fff9edf10 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -3677,6 +3677,7 @@ udmf 0 = "Add tag"; 1 = "Remove tag"; 2 = "Replace first tag"; + 3 = "Change trigger tag"; } } } @@ -3699,6 +3700,7 @@ udmf 0 = "Add tag"; 1 = "Remove tag"; 2 = "Replace first tag"; + 3 = "Change trigger tag"; } } } diff --git a/libs/FMOD.props b/libs/FMOD.props deleted file mode 100644 index 785f11ce1..000000000 --- a/libs/FMOD.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - $(SolutionDir)libs\fmodex\inc;$(IncludePath) - $(SolutionDir)libs\fmodex\lib;$(LibraryPath) - - - - - fmodexL64_vc.lib;%(AdditionalDependencies) - - - - - fmodexL_vc.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/dll-binaries/i686/Old/fmod.dll b/libs/dll-binaries/i686/Old/fmod.dll deleted file mode 100644 index 6b0e379d3..000000000 Binary files a/libs/dll-binaries/i686/Old/fmod.dll and /dev/null differ diff --git a/libs/dll-binaries/i686/Old/fmodexL.dll b/libs/dll-binaries/i686/Old/fmodexL.dll deleted file mode 100644 index 1ac9e21c9..000000000 Binary files a/libs/dll-binaries/i686/Old/fmodexL.dll and /dev/null differ diff --git a/libs/dll-binaries/i686/fmodex.dll b/libs/dll-binaries/i686/fmodex.dll deleted file mode 100644 index 875f8a267..000000000 Binary files a/libs/dll-binaries/i686/fmodex.dll and /dev/null differ diff --git a/libs/dll-binaries/x86_64/Old/fmod64.dll b/libs/dll-binaries/x86_64/Old/fmod64.dll deleted file mode 100644 index 2a8bab284..000000000 Binary files a/libs/dll-binaries/x86_64/Old/fmod64.dll and /dev/null differ diff --git a/libs/dll-binaries/x86_64/Old/fmodexL64.dll b/libs/dll-binaries/x86_64/Old/fmodexL64.dll deleted file mode 100644 index 463628c6e..000000000 Binary files a/libs/dll-binaries/x86_64/Old/fmodexL64.dll and /dev/null differ diff --git a/libs/dll-binaries/x86_64/fmodex64.dll b/libs/dll-binaries/x86_64/fmodex64.dll deleted file mode 100644 index f08c0033b..000000000 Binary files a/libs/dll-binaries/x86_64/fmodex64.dll and /dev/null differ diff --git a/libs/fmodex/inc/fmod.h b/libs/fmodex/inc/fmod.h deleted file mode 100644 index f3fbd853e..000000000 --- a/libs/fmodex/inc/fmod.h +++ /dev/null @@ -1,2462 +0,0 @@ - -/* ============================================================================================ */ -/* FMOD Ex - Main C/C++ header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* This header is the base header for all other FMOD headers. If you are programming in C */ -/* use this exclusively, or if you are programming C++ use this in conjunction with FMOD.HPP */ -/* */ -/* ============================================================================================ */ - -#ifndef _FMOD_H -#define _FMOD_H - -/* - FMOD version number. Check this against FMOD::System::getVersion. - 0xaaaabbcc -> aaaa = major version number. bb = minor version number. cc = development version number. -*/ - -#define FMOD_VERSION 0x00044412 - -/* - Compiler specific settings. -*/ - -#if defined(__CYGWIN32__) - #define F_CDECL __cdecl - #define F_STDCALL __stdcall - #define F_DECLSPEC __declspec - #define F_DLLEXPORT ( dllexport ) -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - #define F_CDECL _cdecl - #define F_STDCALL _stdcall - #define F_DECLSPEC __declspec - #define F_DLLEXPORT ( dllexport ) -#elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) - #define F_CDECL - #define F_STDCALL - #define F_DECLSPEC - #define F_DLLEXPORT __attribute__ ((visibility("default"))) -#else - #define F_CDECL - #define F_STDCALL - #define F_DECLSPEC - #define F_DLLEXPORT -#endif - -#ifdef DLL_EXPORTS - #if defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) - #define F_API __attribute__ ((visibility("default"))) - #else - #define F_API __declspec(dllexport) F_STDCALL - #endif -#else - #define F_API F_STDCALL -#endif - -#define F_CALLBACK F_STDCALL - -/* - FMOD types. -*/ - -typedef int FMOD_BOOL; -typedef struct FMOD_SYSTEM FMOD_SYSTEM; -typedef struct FMOD_SOUND FMOD_SOUND; -typedef struct FMOD_CHANNEL FMOD_CHANNEL; -typedef struct FMOD_CHANNELGROUP FMOD_CHANNELGROUP; -typedef struct FMOD_SOUNDGROUP FMOD_SOUNDGROUP; -typedef struct FMOD_REVERB FMOD_REVERB; -typedef struct FMOD_DSP FMOD_DSP; -typedef struct FMOD_DSPCONNECTION FMOD_DSPCONNECTION; -typedef struct FMOD_POLYGON FMOD_POLYGON; -typedef struct FMOD_GEOMETRY FMOD_GEOMETRY; -typedef struct FMOD_SYNCPOINT FMOD_SYNCPOINT; -typedef unsigned int FMOD_MODE; -typedef unsigned int FMOD_TIMEUNIT; -typedef unsigned int FMOD_INITFLAGS; -typedef unsigned int FMOD_CAPS; -typedef unsigned int FMOD_DEBUGLEVEL; -typedef unsigned int FMOD_MEMORY_TYPE; - -/* -[ENUM] -[ - [DESCRIPTION] - error codes. Returned from every function. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] -] -*/ -typedef enum -{ - FMOD_OK, /* No errors. */ - FMOD_ERR_ALREADYLOCKED, /* Tried to call lock a second time before unlock was called. */ - FMOD_ERR_BADCOMMAND, /* Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound). */ - FMOD_ERR_CDDA_DRIVERS, /* Neither NTSCSI nor ASPI could be initialised. */ - FMOD_ERR_CDDA_INIT, /* An error occurred while initialising the CDDA subsystem. */ - FMOD_ERR_CDDA_INVALID_DEVICE, /* Couldn't find the specified device. */ - FMOD_ERR_CDDA_NOAUDIO, /* No audio tracks on the specified disc. */ - FMOD_ERR_CDDA_NODEVICES, /* No CD/DVD devices were found. */ - FMOD_ERR_CDDA_NODISC, /* No disc present in the specified drive. */ - FMOD_ERR_CDDA_READ, /* A CDDA read error occurred. */ - FMOD_ERR_CHANNEL_ALLOC, /* Error trying to allocate a channel. */ - FMOD_ERR_CHANNEL_STOLEN, /* The specified channel has been reused to play another sound. */ - FMOD_ERR_COM, /* A Win32 COM related error occured. COM failed to initialize or a QueryInterface failed meaning a Windows codec or driver was not installed properly. */ - FMOD_ERR_DMA, /* DMA Failure. See debug output for more information. */ - FMOD_ERR_DSP_CONNECTION, /* DSP connection error. Connection possibly caused a cyclic dependancy. Or tried to connect a tree too many units deep (more than 128). */ - FMOD_ERR_DSP_FORMAT, /* DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format. */ - FMOD_ERR_DSP_NOTFOUND, /* DSP connection error. Couldn't find the DSP unit specified. */ - FMOD_ERR_DSP_RUNNING, /* DSP error. Cannot perform this operation while the network is in the middle of running. This will most likely happen if a connection or disconnection is attempted in a DSP callback. */ - FMOD_ERR_DSP_TOOMANYCONNECTIONS,/* DSP connection error. The unit being connected to or disconnected should only have 1 input or output. */ - FMOD_ERR_FILE_BAD, /* Error loading file. */ - FMOD_ERR_FILE_COULDNOTSEEK, /* Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format. */ - FMOD_ERR_FILE_DISKEJECTED, /* Media was ejected while reading. */ - FMOD_ERR_FILE_EOF, /* End of file unexpectedly reached while trying to read essential data (truncated data?). */ - FMOD_ERR_FILE_NOTFOUND, /* File not found. */ - FMOD_ERR_FILE_UNWANTED, /* Unwanted file access occured. */ - FMOD_ERR_FORMAT, /* Unsupported file or audio format. */ - FMOD_ERR_HTTP, /* A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere. */ - FMOD_ERR_HTTP_ACCESS, /* The specified resource requires authentication or is forbidden. */ - FMOD_ERR_HTTP_PROXY_AUTH, /* Proxy authentication is required to access the specified resource. */ - FMOD_ERR_HTTP_SERVER_ERROR, /* A HTTP server error occurred. */ - FMOD_ERR_HTTP_TIMEOUT, /* The HTTP request timed out. */ - FMOD_ERR_INITIALIZATION, /* FMOD was not initialized correctly to support this function. */ - FMOD_ERR_INITIALIZED, /* Cannot call this command after System::init. */ - FMOD_ERR_INTERNAL, /* An error occured that wasn't supposed to. Contact support. */ - FMOD_ERR_INVALID_ADDRESS, /* On Xbox 360, this memory address passed to FMOD must be physical, (ie allocated with XPhysicalAlloc.) */ - FMOD_ERR_INVALID_FLOAT, /* Value passed in was a NaN, Inf or denormalized float. */ - FMOD_ERR_INVALID_HANDLE, /* An invalid object handle was used. */ - FMOD_ERR_INVALID_PARAM, /* An invalid parameter was passed to this function. */ - FMOD_ERR_INVALID_POSITION, /* An invalid seek position was passed to this function. */ - FMOD_ERR_INVALID_SPEAKER, /* An invalid speaker was passed to this function based on the current speaker mode. */ - FMOD_ERR_INVALID_SYNCPOINT, /* The syncpoint did not come from this sound handle. */ - FMOD_ERR_INVALID_VECTOR, /* The vectors passed in are not unit length, or perpendicular. */ - FMOD_ERR_MAXAUDIBLE, /* Reached maximum audible playback count for this sound's soundgroup. */ - FMOD_ERR_MEMORY, /* Not enough memory or resources. */ - FMOD_ERR_MEMORY_CANTPOINT, /* Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used. */ - FMOD_ERR_MEMORY_SRAM, /* Not enough memory or resources on console sound ram. */ - FMOD_ERR_NEEDS2D, /* Tried to call a command on a 3d sound when the command was meant for 2d sound. */ - FMOD_ERR_NEEDS3D, /* Tried to call a command on a 2d sound when the command was meant for 3d sound. */ - FMOD_ERR_NEEDSHARDWARE, /* Tried to use a feature that requires hardware support. (ie trying to play a GCADPCM compressed sound in software on Wii). */ - FMOD_ERR_NEEDSSOFTWARE, /* Tried to use a feature that requires the software engine. Software engine has either been turned off, or command was executed on a hardware channel which does not support this feature. */ - FMOD_ERR_NET_CONNECT, /* Couldn't connect to the specified host. */ - FMOD_ERR_NET_SOCKET_ERROR, /* A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere. */ - FMOD_ERR_NET_URL, /* The specified URL couldn't be resolved. */ - FMOD_ERR_NET_WOULD_BLOCK, /* Operation on a non-blocking socket could not complete immediately. */ - FMOD_ERR_NOTREADY, /* Operation could not be performed because specified sound/DSP connection is not ready. */ - FMOD_ERR_OUTPUT_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ - FMOD_ERR_OUTPUT_CREATEBUFFER, /* Error creating hardware sound buffer. */ - FMOD_ERR_OUTPUT_DRIVERCALL, /* A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted. */ - FMOD_ERR_OUTPUT_ENUMERATION, /* Error enumerating the available driver list. List may be inconsistent due to a recent device addition or removal. */ - FMOD_ERR_OUTPUT_FORMAT, /* Soundcard does not support the minimum features needed for this soundsystem (16bit stereo output). */ - FMOD_ERR_OUTPUT_INIT, /* Error initializing output device. */ - FMOD_ERR_OUTPUT_NOHARDWARE, /* FMOD_HARDWARE was specified but the sound card does not have the resources necessary to play it. */ - FMOD_ERR_OUTPUT_NOSOFTWARE, /* Attempted to create a software sound but no software channels were specified in System::init. */ - FMOD_ERR_PAN, /* Panning only works with mono or stereo sound sources. */ - FMOD_ERR_PLUGIN, /* An unspecified error has been returned from a 3rd party plugin. */ - FMOD_ERR_PLUGIN_INSTANCES, /* The number of allowed instances of a plugin has been exceeded. */ - FMOD_ERR_PLUGIN_MISSING, /* A requested output, dsp unit type or codec was not available. */ - FMOD_ERR_PLUGIN_RESOURCE, /* A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback or other DLLs that it needs to load) */ - FMOD_ERR_PRELOADED, /* The specified sound is still in use by the event system, call EventSystem::unloadFSB before trying to release it. */ - FMOD_ERR_PROGRAMMERSOUND, /* The specified sound is still in use by the event system, wait for the event which is using it finish with it. */ - FMOD_ERR_RECORD, /* An error occured trying to initialize the recording device. */ - FMOD_ERR_REVERB_INSTANCE, /* Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesnt exist. */ - FMOD_ERR_SUBSOUND_ALLOCATED, /* This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first. */ - FMOD_ERR_SUBSOUND_CANTMOVE, /* Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file. */ - FMOD_ERR_SUBSOUND_MODE, /* The subsound's mode bits do not match with the parent sound's mode bits. See documentation for function that it was called with. */ - FMOD_ERR_SUBSOUNDS, /* The error occured because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound, or a parent sound was played without setting up a sentence first. */ - FMOD_ERR_TAGNOTFOUND, /* The specified tag could not be found or there are no tags. */ - FMOD_ERR_TOOMANYCHANNELS, /* The sound created exceeds the allowable input channel count. This can be increased using the maxinputchannels parameter in System::setSoftwareFormat. */ - FMOD_ERR_UNIMPLEMENTED, /* Something in FMOD hasn't been implemented when it should be! contact support! */ - FMOD_ERR_UNINITIALIZED, /* This command failed because System::init or System::setDriver was not called. */ - FMOD_ERR_UNSUPPORTED, /* A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. */ - FMOD_ERR_UPDATE, /* An error caused by System::update occured. */ - FMOD_ERR_VERSION, /* The version number of this file format is not supported. */ - - FMOD_ERR_EVENT_FAILED, /* An Event failed to be retrieved, most likely due to 'just fail' being specified as the max playbacks behavior. */ - FMOD_ERR_EVENT_INFOONLY, /* Can't execute this command on an EVENT_INFOONLY event. */ - FMOD_ERR_EVENT_INTERNAL, /* An error occured that wasn't supposed to. See debug log for reason. */ - FMOD_ERR_EVENT_MAXSTREAMS, /* Event failed because 'Max streams' was hit when FMOD_EVENT_INIT_FAIL_ON_MAXSTREAMS was specified. */ - FMOD_ERR_EVENT_MISMATCH, /* FSB mismatches the FEV it was compiled with, the stream/sample mode it was meant to be created with was different, or the FEV was built for a different platform. */ - FMOD_ERR_EVENT_NAMECONFLICT, /* A category with the same name already exists. */ - FMOD_ERR_EVENT_NOTFOUND, /* The requested event, event group, event category or event property could not be found. */ - FMOD_ERR_EVENT_NEEDSSIMPLE, /* Tried to call a function on a complex event that's only supported by simple events. */ - FMOD_ERR_EVENT_GUIDCONFLICT, /* An event with the same GUID already exists. */ - FMOD_ERR_EVENT_ALREADY_LOADED, /* The specified project or bank has already been loaded. Having multiple copies of the same project loaded simultaneously is forbidden. */ - - FMOD_ERR_MUSIC_UNINITIALIZED, /* Music system is not initialized probably because no music data is loaded. */ - FMOD_ERR_MUSIC_NOTFOUND, /* The requested music entity could not be found. */ - FMOD_ERR_MUSIC_NOCALLBACK, /* The music callback is required, but it has not been set. */ - - FMOD_RESULT_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_RESULT; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a point in 3D space. - - [REMARKS] - FMOD uses a left handed co-ordinate system by default. - To use a right handed co-ordinate system specify FMOD_INIT_3D_RIGHTHANDED from FMOD_INITFLAGS in System::init. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::set3DListenerAttributes - System::get3DListenerAttributes - Channel::set3DAttributes - Channel::get3DAttributes - Channel::set3DCustomRolloff - Channel::get3DCustomRolloff - Sound::set3DCustomRolloff - Sound::get3DCustomRolloff - Geometry::addPolygon - Geometry::setPolygonVertex - Geometry::getPolygonVertex - Geometry::setRotation - Geometry::getRotation - Geometry::setPosition - Geometry::getPosition - Geometry::setScale - Geometry::getScale - FMOD_INITFLAGS -] -*/ -typedef struct -{ - float x; /* X co-ordinate in 3D space. */ - float y; /* Y co-ordinate in 3D space. */ - float z; /* Z co-ordinate in 3D space. */ -} FMOD_VECTOR; - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a globally unique identifier. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getDriverInfo -] -*/ -typedef struct -{ - unsigned int Data1; /* Specifies the first 8 hexadecimal digits of the GUID */ - unsigned short Data2; /* Specifies the first group of 4 hexadecimal digits. */ - unsigned short Data3; /* Specifies the second group of 4 hexadecimal digits. */ - unsigned char Data4[8]; /* Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits. The remaining 6 bytes contain the final 12 hexadecimal digits. */ -} FMOD_GUID; - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure that is passed into FMOD_FILE_ASYNCREADCALLBACK. Use the information in this structure to perform - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - Instructions: write to 'buffer', and 'bytesread' BEFORE setting 'result'. - As soon as result is set, FMOD will asynchronously continue internally using the data provided in this structure. - - Set 'result' to the result expected from a normal file read callback. - If the read was successful, set it to FMOD_OK. - If it read some data but hit the end of the file, set it to FMOD_ERR_FILE_EOF. - If a bad error occurred, return FMOD_ERR_FILE_BAD - If a disk was ejected, return FMOD_ERR_FILE_DISKEJECTED. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_FILE_ASYNCREADCALLBACK - FMOD_FILE_ASYNCCANCELCALLBACK -] -*/ -typedef struct -{ - void *handle; /* [r] The file handle that was filled out in the open callback. */ - unsigned int offset; /* [r] Seek position, make sure you read from this file offset. */ - unsigned int sizebytes; /* [r] how many bytes requested for read. */ - int priority; /* [r] 0 = low importance. 100 = extremely important (ie 'must read now or stuttering may occur') */ - - void *buffer; /* [w] Buffer to read file data into. */ - unsigned int bytesread; /* [w] Fill this in before setting result code to tell FMOD how many bytes were read. */ - FMOD_RESULT result; /* [r/w] Result code, FMOD_OK tells the system it is ready to consume the data. Set this last! Default value = FMOD_ERR_NOTREADY. */ - - void *userdata; /* [r] User data pointer. */ -} FMOD_ASYNCREADINFO; - - -/* -[ENUM] -[ - [DESCRIPTION] - These output types are used with System::setOutput / System::getOutput, to choose which output method to use. - - [REMARKS] - To pass information to the driver when initializing fmod use the extradriverdata parameter in System::init for the following reasons. - - FMOD_OUTPUTTYPE_WAVWRITER - extradriverdata is a pointer to a char * filename that the wav writer will output to. - - FMOD_OUTPUTTYPE_WAVWRITER_NRT - extradriverdata is a pointer to a char * filename that the wav writer will output to. - - FMOD_OUTPUTTYPE_DSOUND - extradriverdata is a pointer to a HWND so that FMOD can set the focus on the audio for a particular window. - - FMOD_OUTPUTTYPE_PS3 - extradriverdata is a pointer to a FMOD_PS3_EXTRADRIVERDATA struct. This can be found in fmodps3.h. - - FMOD_OUTPUTTYPE_GC - extradriverdata is a pointer to a FMOD_GC_INFO struct. This can be found in fmodgc.h. - - FMOD_OUTPUTTYPE_WII - extradriverdata is a pointer to a FMOD_WII_INFO struct. This can be found in fmodwii.h. - - FMOD_OUTPUTTYPE_ALSA - extradriverdata is a pointer to a FMOD_LINUX_EXTRADRIVERDATA struct. This can be found in fmodlinux.h. - - Currently these are the only FMOD drivers that take extra information. Other unknown plugins may have different requirements. - - Note! If FMOD_OUTPUTTYPE_WAVWRITER_NRT or FMOD_OUTPUTTYPE_NOSOUND_NRT are used, and if the System::update function is being called - very quickly (ie for a non realtime decode) it may be being called too quickly for the FMOD streamer thread to respond to. - The result will be a skipping/stuttering output in the captured audio. - - To remedy this, disable the FMOD Ex streamer thread, and use FMOD_INIT_STREAM_FROM_UPDATE to avoid skipping in the output stream, - as it will lock the mixer and the streamer together in the same thread. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setOutput - System::getOutput - System::setSoftwareFormat - System::getSoftwareFormat - System::init - System::update - FMOD_INITFLAGS -] -*/ -typedef enum -{ - FMOD_OUTPUTTYPE_AUTODETECT, /* Picks the best output mode for the platform. This is the default. */ - - FMOD_OUTPUTTYPE_UNKNOWN, /* All - 3rd party plugin, unknown. This is for use with System::getOutput only. */ - FMOD_OUTPUTTYPE_NOSOUND, /* All - All calls in this mode succeed but make no sound. */ - FMOD_OUTPUTTYPE_WAVWRITER, /* All - Writes output to fmodoutput.wav by default. Use the 'extradriverdata' parameter in System::init, by simply passing the filename as a string, to set the wav filename. */ - FMOD_OUTPUTTYPE_NOSOUND_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_NOSOUND. User can drive mixer with System::update at whatever rate they want. */ - FMOD_OUTPUTTYPE_WAVWRITER_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_WAVWRITER. User can drive mixer with System::update at whatever rate they want. */ - - FMOD_OUTPUTTYPE_DSOUND, /* Win32/Win64 - DirectSound output. (Default on Windows XP and below) */ - FMOD_OUTPUTTYPE_WINMM, /* Win32/Win64 - Windows Multimedia output. */ - FMOD_OUTPUTTYPE_WASAPI, /* Win32 - Windows Audio Session API. (Default on Windows Vista and above) */ - FMOD_OUTPUTTYPE_ASIO, /* Win32 - Low latency ASIO 2.0 driver. */ - FMOD_OUTPUTTYPE_OSS, /* Linux/Linux64 - Open Sound System output. (Default on Linux, third preference) */ - FMOD_OUTPUTTYPE_ALSA, /* Linux/Linux64 - Advanced Linux Sound Architecture output. (Default on Linux, second preference if available) */ - FMOD_OUTPUTTYPE_ESD, /* Linux/Linux64 - Enlightment Sound Daemon output. */ - FMOD_OUTPUTTYPE_PULSEAUDIO, /* Linux/Linux64 - PulseAudio output. (Default on Linux, first preference if available) */ - FMOD_OUTPUTTYPE_COREAUDIO, /* Mac - Macintosh CoreAudio output. (Default on Mac) */ - FMOD_OUTPUTTYPE_XBOX360, /* Xbox 360 - Native Xbox360 output. (Default on Xbox 360) */ - FMOD_OUTPUTTYPE_PSP, /* PSP - Native PSP output. (Default on PSP) */ - FMOD_OUTPUTTYPE_PS3, /* PS3 - Native PS3 output. (Default on PS3) */ - FMOD_OUTPUTTYPE_NGP, /* NGP - Native NGP output. (Default on NGP) */ - FMOD_OUTPUTTYPE_WII, /* Wii - Native Wii output. (Default on Wii) */ - FMOD_OUTPUTTYPE_3DS, /* 3DS - Native 3DS output (Default on 3DS) */ - FMOD_OUTPUTTYPE_AUDIOTRACK, /* Android - Java Audio Track output. (Default on Android 2.2 and below) */ - FMOD_OUTPUTTYPE_OPENSL, /* Android - OpenSL ES output. (Default on Android 2.3 and above) */ - FMOD_OUTPUTTYPE_NACL, /* Native Client - Native Client output. (Default on Native Client) */ - FMOD_OUTPUTTYPE_WIIU, /* Wii U - Native Wii U output. (Default on Wii U) */ - FMOD_OUTPUTTYPE_ASOUND, /* BlackBerry - Native BlackBerry asound output. (Default on BlackBerry) */ - - FMOD_OUTPUTTYPE_MAX, /* Maximum number of output types supported. */ - FMOD_OUTPUTTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_OUTPUTTYPE; - - -/* -[DEFINE] -[ - [NAME] - FMOD_CAPS - - [DESCRIPTION] - Bit fields to use with System::getDriverCaps to determine the capabilities of a card / output device. - - [REMARKS] - It is important to check FMOD_CAPS_HARDWARE_EMULATED on windows machines, to then adjust System::setDSPBufferSize to (1024, 10) to compensate for the higher latency. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getDriverCaps - System::setDSPBufferSize -] -*/ -#define FMOD_CAPS_NONE 0x00000000 /* Device has no special capabilities. */ -#define FMOD_CAPS_HARDWARE 0x00000001 /* Device supports hardware mixing. */ -#define FMOD_CAPS_HARDWARE_EMULATED 0x00000002 /* User has device set to 'Hardware acceleration = off' in control panel, and now extra 200ms latency is incurred. */ -#define FMOD_CAPS_OUTPUT_MULTICHANNEL 0x00000004 /* Device can do multichannel output, ie greater than 2 channels. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM8 0x00000008 /* Device can output to 8bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM16 0x00000010 /* Device can output to 16bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM24 0x00000020 /* Device can output to 24bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM32 0x00000040 /* Device can output to 32bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCMFLOAT 0x00000080 /* Device can output to 32bit floating point PCM. */ -#define FMOD_CAPS_REVERB_LIMITED 0x00002000 /* Device supports some form of limited hardware reverb, maybe parameterless and only selectable by environment. */ -#define FMOD_CAPS_LOOPBACK 0x00004000 /* Device is a loopback recording device */ -/* [DEFINE_END] */ - -/* -[DEFINE] -[ - [NAME] - FMOD_DEBUGLEVEL - - [DESCRIPTION] - Bit fields to use with FMOD::Debug_SetLevel / FMOD::Debug_GetLevel to control the level of tty debug output with logging versions of FMOD (fmodL). - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Debug_SetLevel - Debug_GetLevel -] -*/ -#define FMOD_DEBUG_LEVEL_NONE 0x00000000 -#define FMOD_DEBUG_LEVEL_LOG 0x00000001 /* Will display generic logging messages. */ -#define FMOD_DEBUG_LEVEL_ERROR 0x00000002 /* Will display errors. */ -#define FMOD_DEBUG_LEVEL_WARNING 0x00000004 /* Will display warnings that are not fatal. */ -#define FMOD_DEBUG_LEVEL_HINT 0x00000008 /* Will hint to you if there is something possibly better you could be doing. */ -#define FMOD_DEBUG_LEVEL_ALL 0x000000FF -#define FMOD_DEBUG_TYPE_MEMORY 0x00000100 /* Show FMOD memory related logging messages. */ -#define FMOD_DEBUG_TYPE_THREAD 0x00000200 /* Show FMOD thread related logging messages. */ -#define FMOD_DEBUG_TYPE_FILE 0x00000400 /* Show FMOD file system related logging messages. */ -#define FMOD_DEBUG_TYPE_NET 0x00000800 /* Show FMOD network related logging messages. */ -#define FMOD_DEBUG_TYPE_EVENT 0x00001000 /* Show FMOD Event related logging messages. */ -#define FMOD_DEBUG_TYPE_ALL 0x0000FFFF -#define FMOD_DEBUG_DISPLAY_TIMESTAMPS 0x01000000 /* Display the timestamp of the log entry in milliseconds. */ -#define FMOD_DEBUG_DISPLAY_LINENUMBERS 0x02000000 /* Display the FMOD Ex source code line numbers, for debugging purposes. */ -#define FMOD_DEBUG_DISPLAY_COMPRESS 0x04000000 /* If a message is repeated more than 5 times it will stop displaying it and instead display the number of times the message was logged. */ -#define FMOD_DEBUG_DISPLAY_THREAD 0x08000000 /* Display the thread ID of the calling function that caused this log entry to appear. */ -#define FMOD_DEBUG_DISPLAY_ALL 0x0F000000 -#define FMOD_DEBUG_ALL 0xFFFFFFFF -/* [DEFINE_END] */ - - -/* -[DEFINE] -[ - [NAME] - FMOD_MEMORY_TYPE - - [DESCRIPTION] - Bit fields for memory allocation type being passed into FMOD memory callbacks. - - [REMARKS] - Remember this is a bitfield. You may get more than 1 bit set (ie physical + persistent) so do not simply switch on the types! You must check each bit individually or clear out the bits that you do not want within the callback. - Bits can be excluded if you want during Memory_Initialize so that you never get them. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_MEMORY_ALLOCCALLBACK - FMOD_MEMORY_REALLOCCALLBACK - FMOD_MEMORY_FREECALLBACK - Memory_Initialize - -] -*/ -#define FMOD_MEMORY_NORMAL 0x00000000 /* Standard memory. */ -#define FMOD_MEMORY_STREAM_FILE 0x00000001 /* Stream file buffer, size controllable with System::setStreamBufferSize. */ -#define FMOD_MEMORY_STREAM_DECODE 0x00000002 /* Stream decode buffer, size controllable with FMOD_CREATESOUNDEXINFO::decodebuffersize. */ -#define FMOD_MEMORY_SAMPLEDATA 0x00000004 /* Sample data buffer. Raw audio data, usually PCM/MPEG/ADPCM/XMA data. */ -#define FMOD_MEMORY_DSP_OUTPUTBUFFER 0x00000008 /* DSP memory block allocated when more than 1 output exists on a DSP node. */ -#define FMOD_MEMORY_XBOX360_PHYSICAL 0x00100000 /* Requires XPhysicalAlloc / XPhysicalFree. */ -#define FMOD_MEMORY_PERSISTENT 0x00200000 /* Persistent memory. Memory will be freed when System::release is called. */ -#define FMOD_MEMORY_SECONDARY 0x00400000 /* Secondary memory. Allocation should be in secondary memory. For example RSX on the PS3. */ -#define FMOD_MEMORY_ALL 0xFFFFFFFF -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These are speaker types defined for use with the System::setSpeakerMode or System::getSpeakerMode command. - - [REMARKS] - These are important notes on speaker modes in regards to sounds created with FMOD_SOFTWARE. - Note below the phrase 'sound channels' is used. These are the subchannels inside a sound, they are not related and - have nothing to do with the FMOD class "Channel". - For example a mono sound has 1 sound channel, a stereo sound has 2 sound channels, and an AC3 or 6 channel wav file have 6 "sound channels". - - FMOD_SPEAKERMODE_RAW - --------------------- - This mode is for output devices that are not specifically mono/stereo/quad/surround/5.1 or 7.1, but are multichannel. - Use System::setSoftwareFormat to specify the number of speakers you want to address, otherwise it will default to 2 (stereo). - Sound channels map to speakers sequentially, so a mono sound maps to output speaker 0, stereo sound maps to output speaker 0 & 1. - The user assumes knowledge of the speaker order. FMOD_SPEAKER enumerations may not apply, so raw channel indices should be used. - Multichannel sounds map input channels to output channels 1:1. - Channel::setPan and Channel::setSpeakerMix do not work. - Speaker levels must be manually set with Channel::setSpeakerLevels. - - FMOD_SPEAKERMODE_MONO - --------------------- - This mode is for a 1 speaker arrangement. - Panning does not work in this speaker mode. - Mono, stereo and multichannel sounds have each sound channel played on the one speaker unity. - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - Channel::setSpeakerMix does not work. - - FMOD_SPEAKERMODE_STEREO - ----------------------- - This mode is for 2 speaker arrangements that have a left and right speaker. - - Mono sounds default to an even distribution between left and right. They can be panned with Channel::setPan. - - Stereo sounds default to the middle, or full left in the left speaker and full right in the right speaker. - - They can be cross faded with Channel::setPan. - - Multichannel sounds have each sound channel played on each speaker at unity. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but only front left and right parameters are used, the rest are ignored. - - FMOD_SPEAKERMODE_QUAD - ------------------------ - This mode is for 4 speaker arrangements that have a front left, front right, rear left and a rear right speaker. - - Mono sounds default to an even distribution between front left and front right. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but side left, side right, center and lfe are ignored. - - FMOD_SPEAKERMODE_SURROUND - ------------------------ - This mode is for 5 speaker arrangements that have a left/right/center/rear left/rear right. - - Mono sounds default to the center speaker. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but side left / side right are ignored. - - FMOD_SPEAKERMODE_5POINT1 - ------------------------ - This mode is for 5.1 speaker arrangements that have a left/right/center/rear left/rear right and a subwoofer speaker. - - Mono sounds default to the center speaker. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but side left / side right are ignored. - - FMOD_SPEAKERMODE_7POINT1 - ------------------------ - This mode is for 7.1 speaker arrangements that have a left/right/center/rear left/rear right/side left/side right - and a subwoofer speaker. - - Mono sounds default to the center speaker. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works and every parameter is used to set the balance of a sound in any speaker. - - FMOD_SPEAKERMODE_SRS5_1_MATRIX - ------------------------------------------------------ - This mode is for mono, stereo, 5.1 and 6.1 speaker arrangements, as it is backwards and forwards compatible with - stereo, but to get a surround effect a SRS 5.1, Prologic or Prologic 2 hardware decoder / amplifier is needed or - a compatible SRS equipped device (e.g., laptop, TV, etc.) or accessory (e.g., headphone). - Pan behavior is the same as FMOD_SPEAKERMODE_5POINT1. - - If this function is called the numoutputchannels setting in System::setSoftwareFormat is overwritten. - - Output rate must be 44100, 48000 or 96000 for this to work otherwise FMOD_ERR_OUTPUT_INIT will be returned. - - FMOD_SPEAKERMODE_DOLBY5_1_MATRIX - ------------------------------------------------------ - This mode is for 5.1 speaker arrangements using a stereo signal, to get a surround effect a Dolby Pro Logic II - hardware decoder / amplifier is needed. - Pan behavior is the same as FMOD_SPEAKERMODE_5POINT1. - - If this function is called the numoutputchannels setting in System::setSoftwareFormat is overwritten. - - Output rate must be 32000, 44100 or 48000 for this to work otherwise FMOD_ERR_OUTPUT_INIT will be returned. - - FMOD_SPEAKERMODE_MYEARS - ------------------------------------------------------ - This mode is for headphones. This will attempt to load a MyEars profile (see myears.net.au) and use it to generate - surround sound on headphones using a personalized HRTF algorithm, for realistic 3d sound. - Pan behavior is the same as FMOD_SPEAKERMODE_7POINT1. - MyEars speaker mode will automatically be set if the speakermode is FMOD_SPEAKERMODE_STEREO and the MyEars profile exists. - If this mode is set explicitly, FMOD_INIT_DISABLE_MYEARS_AUTODETECT has no effect. - If this mode is set explicitly and the MyEars profile does not exist, FMOD_ERR_OUTPUT_DRIVERCALL will be returned. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setSpeakerMode - System::getSpeakerMode - System::getDriverCaps - System::setSoftwareFormat - Channel::setSpeakerLevels -] -*/ -typedef enum -{ - FMOD_SPEAKERMODE_RAW, /* There is no specific speakermode. Sound channels are mapped in order of input to output. Use System::setSoftwareFormat to specify speaker count. See remarks for more information. */ - FMOD_SPEAKERMODE_MONO, /* The speakers are monaural. */ - FMOD_SPEAKERMODE_STEREO, /* The speakers are stereo (DEFAULT). */ - FMOD_SPEAKERMODE_QUAD, /* 4 speaker setup. This includes front left, front right, rear left, rear right. */ - FMOD_SPEAKERMODE_SURROUND, /* 5 speaker setup. This includes front left, front right, center, rear left, rear right. */ - FMOD_SPEAKERMODE_5POINT1, /* 5.1 speaker setup. This includes front left, front right, center, rear left, rear right and a subwoofer. */ - FMOD_SPEAKERMODE_7POINT1, /* 7.1 speaker setup. This includes front left, front right, center, rear left, rear right, side left, side right and a subwoofer. */ - - FMOD_SPEAKERMODE_SRS5_1_MATRIX, /* Stereo compatible output, embedded with surround information. SRS 5.1/Prologic/Prologic2 decoders will split the signal into a 5.1 speaker set-up or SRS virtual surround will decode into a 2-speaker/headphone setup. See remarks about limitations.*/ - FMOD_SPEAKERMODE_DOLBY5_1_MATRIX, /* Stereo compatible output, embedded with surround information. Dolby Pro Logic II decoders will split the signal into a 5.1 speaker set-up. */ - FMOD_SPEAKERMODE_MYEARS, /* Stereo output, but data is encoded using personalized HRTF algorithms. See myears.net.au */ - - FMOD_SPEAKERMODE_MAX, /* Maximum number of speaker modes supported. */ - FMOD_SPEAKERMODE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SPEAKERMODE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These are speaker types defined for use with the Channel::setSpeakerLevels command. - It can also be used for speaker placement in the System::set3DSpeakerPosition command. - - [REMARKS] - If you are using FMOD_SPEAKERMODE_RAW and speaker assignments are meaningless, just cast a raw integer value to this type. - For example (FMOD_SPEAKER)7 would use the 7th speaker (also the same as FMOD_SPEAKER_SIDE_RIGHT). - Values higher than this can be used if an output system has more than 8 speaker types / output channels. 15 is the current maximum. - - NOTE: On Playstation 3 in 7.1, the extra 2 speakers are not side left/side right, they are 'surround back left'/'surround back right' which - locate the speakers behind the listener instead of to the sides like on PC. FMOD_SPEAKER_SBL/FMOD_SPEAKER_SBR are provided to make it - clearer what speaker is being addressed on that platform. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_SPEAKERMODE - Channel::setSpeakerLevels - Channel::getSpeakerLevels - System::set3DSpeakerPosition - System::get3DSpeakerPosition -] -*/ -typedef enum -{ - FMOD_SPEAKER_FRONT_LEFT, - FMOD_SPEAKER_FRONT_RIGHT, - FMOD_SPEAKER_FRONT_CENTER, - FMOD_SPEAKER_LOW_FREQUENCY, - FMOD_SPEAKER_BACK_LEFT, - FMOD_SPEAKER_BACK_RIGHT, - FMOD_SPEAKER_SIDE_LEFT, - FMOD_SPEAKER_SIDE_RIGHT, - - FMOD_SPEAKER_MAX, /* Maximum number of speaker types supported. */ - FMOD_SPEAKER_MONO = FMOD_SPEAKER_FRONT_LEFT, /* For use with FMOD_SPEAKERMODE_MONO and Channel::SetSpeakerLevels. Mapped to same value as FMOD_SPEAKER_FRONT_LEFT. */ - FMOD_SPEAKER_NULL = 65535, /* A non speaker. Use this with ASIO mapping to ignore a speaker. */ - FMOD_SPEAKER_SBL = FMOD_SPEAKER_SIDE_LEFT, /* For use with FMOD_SPEAKERMODE_7POINT1 on PS3 where the extra speakers are surround back inside of side speakers. */ - FMOD_SPEAKER_SBR = FMOD_SPEAKER_SIDE_RIGHT, /* For use with FMOD_SPEAKERMODE_7POINT1 on PS3 where the extra speakers are surround back inside of side speakers. */ - FMOD_SPEAKER_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SPEAKER; - - -/* -[ENUM] -[ - [DESCRIPTION] - These are plugin types defined for use with the System::getNumPlugins, - System::getPluginInfo and System::unloadPlugin functions. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getNumPlugins - System::getPluginInfo - System::unloadPlugin -] -*/ -typedef enum -{ - FMOD_PLUGINTYPE_OUTPUT, /* The plugin type is an output module. FMOD mixed audio will play through one of these devices */ - FMOD_PLUGINTYPE_CODEC, /* The plugin type is a file format codec. FMOD will use these codecs to load file formats for playback. */ - FMOD_PLUGINTYPE_DSP, /* The plugin type is a DSP unit. FMOD will use these plugins as part of its DSP network to apply effects to output or generate sound in realtime. */ - - FMOD_PLUGINTYPE_MAX, /* Maximum number of plugin types supported. */ - FMOD_PLUGINTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_PLUGINTYPE; - - -/* -[DEFINE] -[ - [NAME] - FMOD_INITFLAGS - - [DESCRIPTION] - Initialization flags. Use them with System::init in the flags parameter to change various behavior. - - [REMARKS] - Use System::setAdvancedSettings to adjust settings for some of the features that are enabled by these flags. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::init - System::update - System::setAdvancedSettings - Channel::set3DOcclusion -] -*/ -#define FMOD_INIT_NORMAL 0x00000000 /* All platforms - Initialize normally */ -#define FMOD_INIT_STREAM_FROM_UPDATE 0x00000001 /* All platforms - No stream thread is created internally. Streams are driven from System::update. Mainly used with non-realtime outputs. */ -#define FMOD_INIT_3D_RIGHTHANDED 0x00000002 /* All platforms - FMOD will treat +X as right, +Y as up and +Z as backwards (towards you). */ -#define FMOD_INIT_SOFTWARE_DISABLE 0x00000004 /* All platforms - Disable software mixer to save memory. Anything created with FMOD_SOFTWARE will fail and DSP will not work. */ -#define FMOD_INIT_OCCLUSION_LOWPASS 0x00000008 /* All platforms - All FMOD_SOFTWARE (and FMOD_HARDWARE on 3DS and NGP) with FMOD_3D based voices will add a software lowpass filter effect into the DSP chain which is automatically used when Channel::set3DOcclusion is used or the geometry API. */ -#define FMOD_INIT_HRTF_LOWPASS 0x00000010 /* All platforms - All FMOD_SOFTWARE (and FMOD_HARDWARE on 3DS and NGP) with FMOD_3D based voices will add a software lowpass filter effect into the DSP chain which causes sounds to sound duller when the sound goes behind the listener. Use System::setAdvancedSettings to adjust cutoff frequency. */ -#define FMOD_INIT_DISTANCE_FILTERING 0x00000200 /* All platforms - All FMOD_SOFTWARE with FMOD_3D based voices will add a software lowpass and highpass filter effect into the DSP chain which will act as a distance-automated bandpass filter. Use System::setAdvancedSettings to adjust the center frequency. */ -#define FMOD_INIT_REVERB_PREALLOCBUFFERS 0x00000040 /* All platforms - FMOD Software reverb will preallocate enough buffers for reverb per channel, rather than allocating them and freeing them at runtime. */ -#define FMOD_INIT_ENABLE_PROFILE 0x00000020 /* All platforms - Enable TCP/IP based host which allows FMOD Designer or FMOD Profiler to connect to it, and view memory, CPU and the DSP network graph in real-time. */ -#define FMOD_INIT_VOL0_BECOMES_VIRTUAL 0x00000080 /* All platforms - Any sounds that are 0 volume will go virtual and not be processed except for having their positions updated virtually. Use System::setAdvancedSettings to adjust what volume besides zero to switch to virtual at. */ -#define FMOD_INIT_WASAPI_EXCLUSIVE 0x00000100 /* Win32 Vista only - for WASAPI output - Enable exclusive access to hardware, lower latency at the expense of excluding other applications from accessing the audio hardware. */ -#define FMOD_INIT_PS3_PREFERDTS 0x00800000 /* PS3 only - Prefer DTS over Dolby Digital if both are supported. Note: 8 and 6 channel LPCM is always preferred over both DTS and Dolby Digital. */ -#define FMOD_INIT_PS3_FORCE2CHLPCM 0x01000000 /* PS3 only - Force PS3 system output mode to 2 channel LPCM. */ -#define FMOD_INIT_DISABLEDOLBY 0x00100000 /* Wii / 3DS - Disable Dolby Pro Logic surround. Speakermode will be set to STEREO even if user has selected surround in the system settings. */ -#define FMOD_INIT_SYSTEM_MUSICMUTENOTPAUSE 0x00200000 /* Xbox 360 / PS3 - The "music" channelgroup which by default pauses when custom 360 dashboard / PS3 BGM music is played, can be changed to mute (therefore continues playing) instead of pausing, by using this flag. */ -#define FMOD_INIT_SYNCMIXERWITHUPDATE 0x00400000 /* Win32/Wii/PS3/Xbox/Xbox 360 - FMOD Mixer thread is woken up to do a mix when System::update is called rather than waking periodically on its own timer. */ -#define FMOD_INIT_GEOMETRY_USECLOSEST 0x04000000 /* All platforms - With the geometry engine, only process the closest polygon rather than accumulating all polygons the sound to listener line intersects. */ -#define FMOD_INIT_DISABLE_MYEARS_AUTODETECT 0x08000000 /* Win32 - Disables automatic setting of FMOD_SPEAKERMODE_STEREO to FMOD_SPEAKERMODE_MYEARS if the MyEars profile exists on the PC. MyEars is HRTF 7.1 downmixing through headphones. */ -#define FMOD_INIT_PS3_DISABLEDTS 0x10000000 /* PS3 only - Disable DTS output mode selection */ -#define FMOD_INIT_PS3_DISABLEDOLBYDIGITAL 0x20000000 /* PS3 only - Disable Dolby Digital output mode selection */ -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions describe the type of song being played. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getFormat -] -*/ -typedef enum -{ - FMOD_SOUND_TYPE_UNKNOWN, /* 3rd party / unknown plugin format. */ - FMOD_SOUND_TYPE_AIFF, /* AIFF. */ - FMOD_SOUND_TYPE_ASF, /* Microsoft Advanced Systems Format (ie WMA/ASF/WMV). */ - FMOD_SOUND_TYPE_AT3, /* Sony ATRAC 3 format */ - FMOD_SOUND_TYPE_CDDA, /* Digital CD audio. */ - FMOD_SOUND_TYPE_DLS, /* Sound font / downloadable sound bank. */ - FMOD_SOUND_TYPE_FLAC, /* FLAC lossless codec. */ - FMOD_SOUND_TYPE_FSB, /* FMOD Sample Bank. */ - FMOD_SOUND_TYPE_GCADPCM, /* Nintendo GameCube/Wii ADPCM */ - FMOD_SOUND_TYPE_IT, /* Impulse Tracker. */ - FMOD_SOUND_TYPE_MIDI, /* MIDI. extracodecdata is a pointer to an FMOD_MIDI_EXTRACODECDATA structure. */ - FMOD_SOUND_TYPE_MOD, /* Protracker / Fasttracker MOD. */ - FMOD_SOUND_TYPE_MPEG, /* MP2/MP3 MPEG. */ - FMOD_SOUND_TYPE_OGGVORBIS, /* Ogg vorbis. */ - FMOD_SOUND_TYPE_PLAYLIST, /* Information only from ASX/PLS/M3U/WAX playlists */ - FMOD_SOUND_TYPE_RAW, /* Raw PCM data. */ - FMOD_SOUND_TYPE_S3M, /* ScreamTracker 3. */ - FMOD_SOUND_TYPE_SF2, /* Sound font 2 format. */ - FMOD_SOUND_TYPE_USER, /* User created sound. */ - FMOD_SOUND_TYPE_WAV, /* Microsoft WAV. */ - FMOD_SOUND_TYPE_XM, /* FastTracker 2 XM. */ - FMOD_SOUND_TYPE_XMA, /* Xbox360 XMA */ - FMOD_SOUND_TYPE_VAG, /* PlayStation Portable ADPCM VAG format. */ - FMOD_SOUND_TYPE_AUDIOQUEUE, /* iPhone hardware decoder, supports AAC, ALAC and MP3. extracodecdata is a pointer to an FMOD_AUDIOQUEUE_EXTRACODECDATA structure. */ - FMOD_SOUND_TYPE_XWMA, /* Xbox360 XWMA */ - FMOD_SOUND_TYPE_BCWAV, /* 3DS BCWAV container format for DSP ADPCM and PCM */ - FMOD_SOUND_TYPE_AT9, /* NGP ATRAC 9 format */ - FMOD_SOUND_TYPE_VORBIS, /* Raw vorbis */ - FMOD_SOUND_TYPE_MEDIA_FOUNDATION,/* Microsoft Media Foundation wrappers, supports ASF/WMA */ - - FMOD_SOUND_TYPE_MAX, /* Maximum number of sound types supported. */ - FMOD_SOUND_TYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SOUND_TYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions describe the native format of the hardware or software buffer that will be used. - - [REMARKS] - This is the format the native hardware or software buffer will be or is created in. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createSound - Sound::getFormat -] -*/ -typedef enum -{ - FMOD_SOUND_FORMAT_NONE, /* Unitialized / unknown. */ - FMOD_SOUND_FORMAT_PCM8, /* 8bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCM16, /* 16bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCM24, /* 24bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCM32, /* 32bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCMFLOAT, /* 32bit floating point PCM data. */ - FMOD_SOUND_FORMAT_GCADPCM, /* Compressed Nintendo 3DS/Wii DSP data. */ - FMOD_SOUND_FORMAT_IMAADPCM, /* Compressed IMA ADPCM data. */ - FMOD_SOUND_FORMAT_VAG, /* Compressed PlayStation Portable ADPCM data. */ - FMOD_SOUND_FORMAT_HEVAG, /* Compressed PSVita ADPCM data. */ - FMOD_SOUND_FORMAT_XMA, /* Compressed Xbox360 XMA data. */ - FMOD_SOUND_FORMAT_MPEG, /* Compressed MPEG layer 2 or 3 data. */ - FMOD_SOUND_FORMAT_CELT, /* Compressed CELT data. */ - FMOD_SOUND_FORMAT_AT9, /* Compressed PSVita ATRAC9 data. */ - FMOD_SOUND_FORMAT_XWMA, /* Compressed Xbox360 xWMA data. */ - FMOD_SOUND_FORMAT_VORBIS, /* Compressed Vorbis data. */ - - FMOD_SOUND_FORMAT_MAX, /* Maximum number of sound formats supported. */ - FMOD_SOUND_FORMAT_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SOUND_FORMAT; - - -/* -[DEFINE] -[ - [NAME] - FMOD_MODE - - [DESCRIPTION] - Sound description bitfields, bitwise OR them together for loading and describing sounds. - - [REMARKS] - By default a sound will open as a static sound that is decompressed fully into memory to PCM. (ie equivalent of FMOD_CREATESAMPLE) - To have a sound stream instead, use FMOD_CREATESTREAM, or use the wrapper function System::createStream. - Some opening modes (ie FMOD_OPENUSER, FMOD_OPENMEMORY, FMOD_OPENMEMORY_POINT, FMOD_OPENRAW) will need extra information. - This can be provided using the FMOD_CREATESOUNDEXINFO structure. - - Specifying FMOD_OPENMEMORY_POINT will POINT to your memory rather allocating its own sound buffers and duplicating it internally. - This means you cannot free the memory while FMOD is using it, until after Sound::release is called. - With FMOD_OPENMEMORY_POINT, for PCM formats, only WAV, FSB, and RAW are supported. For compressed formats, only those formats supported by FMOD_CREATECOMPRESSEDSAMPLE are supported. - With FMOD_OPENMEMORY_POINT and FMOD_OPENRAW or PCM, if using them together, note that you must pad the data on each side by 16 bytes. This is so fmod can modify the ends of the data for looping/interpolation/mixing purposes. If a wav file, you will need to insert silence, and then reset loop points to stop the playback from playing that silence. - With FMOD_OPENMEMORY_POINT, For Wii/PSP FMOD_HARDWARE supports this flag for the GCADPCM/VAG formats. On other platforms FMOD_SOFTWARE must be used. - - Xbox 360 memory On Xbox 360 Specifying FMOD_OPENMEMORY_POINT to a virtual memory address will cause FMOD_ERR_INVALID_ADDRESS - to be returned. Use physical memory only for this functionality. - - FMOD_LOWMEM is used on a sound if you want to minimize the memory overhead, by having FMOD not allocate memory for certain - features that are not likely to be used in a game environment. These are : - 1. Sound::getName functionality is removed. 256 bytes per sound is saved. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createSound - System::createStream - Sound::setMode - Sound::getMode - Channel::setMode - Channel::getMode - Sound::set3DCustomRolloff - Channel::set3DCustomRolloff - Sound::getOpenState -] -*/ -#define FMOD_DEFAULT 0x00000000 /* Default for all modes listed below. FMOD_LOOP_OFF, FMOD_2D, FMOD_HARDWARE */ -#define FMOD_LOOP_OFF 0x00000001 /* For non looping sounds. (DEFAULT). Overrides FMOD_LOOP_NORMAL / FMOD_LOOP_BIDI. */ -#define FMOD_LOOP_NORMAL 0x00000002 /* For forward looping sounds. */ -#define FMOD_LOOP_BIDI 0x00000004 /* For bidirectional looping sounds. (only works on software mixed static sounds). */ -#define FMOD_2D 0x00000008 /* Ignores any 3d processing. (DEFAULT). */ -#define FMOD_3D 0x00000010 /* Makes the sound positionable in 3D. Overrides FMOD_2D. */ -#define FMOD_HARDWARE 0x00000020 /* Attempts to make sounds use hardware acceleration. (DEFAULT). Note on platforms that don't support FMOD_HARDWARE (only 3DS, PS Vita, PSP, Wii and Wii U support FMOD_HARDWARE), this will be internally treated as FMOD_SOFTWARE. */ -#define FMOD_SOFTWARE 0x00000040 /* Makes the sound be mixed by the FMOD CPU based software mixer. Overrides FMOD_HARDWARE. Use this for FFT, DSP, compressed sample support, 2D multi-speaker support and other software related features. */ -#define FMOD_CREATESTREAM 0x00000080 /* Decompress at runtime, streaming from the source provided (ie from disk). Overrides FMOD_CREATESAMPLE and FMOD_CREATECOMPRESSEDSAMPLE. Note a stream can only be played once at a time due to a stream only having 1 stream buffer and file handle. Open multiple streams to have them play concurrently. */ -#define FMOD_CREATESAMPLE 0x00000100 /* Decompress at loadtime, decompressing or decoding whole file into memory as the target sample format (ie PCM). Fastest for FMOD_SOFTWARE based playback and most flexible. */ -#define FMOD_CREATECOMPRESSEDSAMPLE 0x00000200 /* Load MP2, MP3, IMAADPCM or XMA into memory and leave it compressed. During playback the FMOD software mixer will decode it in realtime as a 'compressed sample'. Can only be used in combination with FMOD_SOFTWARE. Overrides FMOD_CREATESAMPLE. If the sound data is not ADPCM, MPEG or XMA it will behave as if it was created with FMOD_CREATESAMPLE and decode the sound into PCM. */ -#define FMOD_OPENUSER 0x00000400 /* Opens a user created static sample or stream. Use FMOD_CREATESOUNDEXINFO to specify format and/or read callbacks. If a user created 'sample' is created with no read callback, the sample will be empty. Use Sound::lock and Sound::unlock to place sound data into the sound if this is the case. */ -#define FMOD_OPENMEMORY 0x00000800 /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use FMOD_CREATESOUNDEXINFO to specify length. If used with FMOD_CREATESAMPLE or FMOD_CREATECOMPRESSEDSAMPLE, FMOD duplicates the memory into its own buffers. Your own buffer can be freed after open. If used with FMOD_CREATESTREAM, FMOD will stream out of the buffer whose pointer you passed in. In this case, your own buffer should not be freed until you have finished with and released the stream.*/ -#define FMOD_OPENMEMORY_POINT 0x10000000 /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use FMOD_CREATESOUNDEXINFO to specify length. This differs to FMOD_OPENMEMORY in that it uses the memory as is, without duplicating the memory into its own buffers. For Wii/PSP FMOD_HARDWARE supports this flag for the GCADPCM/VAG formats. On other platforms FMOD_SOFTWARE must be used, as sound hardware on the other platforms (ie PC) cannot access main ram. Cannot be freed after open, only after Sound::release. Will not work if the data is compressed and FMOD_CREATECOMPRESSEDSAMPLE is not used. */ -#define FMOD_OPENRAW 0x00001000 /* Will ignore file format and treat as raw pcm. Use FMOD_CREATESOUNDEXINFO to specify format. Requires at least defaultfrequency, numchannels and format to be specified before it will open. Must be little endian data. */ -#define FMOD_OPENONLY 0x00002000 /* Just open the file, dont prebuffer or read. Good for fast opens for info, or when sound::readData is to be used. */ -#define FMOD_ACCURATETIME 0x00004000 /* For System::createSound - for accurate Sound::getLength/Channel::setPosition on VBR MP3, and MOD/S3M/XM/IT/MIDI files. Scans file first, so takes longer to open. FMOD_OPENONLY does not affect this. */ -#define FMOD_MPEGSEARCH 0x00008000 /* For corrupted / bad MP3 files. This will search all the way through the file until it hits a valid MPEG header. Normally only searches for 4k. */ -#define FMOD_NONBLOCKING 0x00010000 /* For opening sounds and getting streamed subsounds (seeking) asyncronously. Use Sound::getOpenState to poll the state of the sound as it opens or retrieves the subsound in the background. */ -#define FMOD_UNIQUE 0x00020000 /* Unique sound, can only be played one at a time */ -#define FMOD_3D_HEADRELATIVE 0x00040000 /* Make the sound's position, velocity and orientation relative to the listener. */ -#define FMOD_3D_WORLDRELATIVE 0x00080000 /* Make the sound's position, velocity and orientation absolute (relative to the world). (DEFAULT) */ -#define FMOD_3D_INVERSEROLLOFF 0x00100000 /* This sound will follow the inverse rolloff model where mindistance = full volume, maxdistance = where sound stops attenuating, and rolloff is fixed according to the global rolloff factor. (DEFAULT) */ -#define FMOD_3D_LINEARROLLOFF 0x00200000 /* This sound will follow a linear rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored. */ -#define FMOD_3D_LINEARSQUAREROLLOFF 0x00400000 /* This sound will follow a linear-square rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored. */ -#define FMOD_3D_CUSTOMROLLOFF 0x04000000 /* This sound will follow a rolloff model defined by Sound::set3DCustomRolloff / Channel::set3DCustomRolloff. */ -#define FMOD_3D_IGNOREGEOMETRY 0x40000000 /* Is not affect by geometry occlusion. If not specified in Sound::setMode, or Channel::setMode, the flag is cleared and it is affected by geometry again. */ -#define FMOD_UNICODE 0x01000000 /* Filename is double-byte unicode. */ -#define FMOD_IGNORETAGS 0x02000000 /* Skips id3v2/asf/etc tag checks when opening a sound, to reduce seek/read overhead when opening files (helps with CD performance). */ -#define FMOD_LOWMEM 0x08000000 /* Removes some features from samples to give a lower memory overhead, like Sound::getName. See remarks. */ -#define FMOD_LOADSECONDARYRAM 0x20000000 /* Load sound into the secondary RAM of supported platform. On PS3, sounds will be loaded into RSX/VRAM. */ -#define FMOD_VIRTUAL_PLAYFROMSTART 0x80000000 /* For sounds that start virtual (due to being quiet or low importance), instead of swapping back to audible, and playing at the correct offset according to time, this flag makes the sound play from the start. */ - -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These values describe what state a sound is in after FMOD_NONBLOCKING has been used to open it. - - [REMARKS] - With streams, if you are using FMOD_NONBLOCKING, note that if the user calls Sound::getSubSound, a stream will go into FMOD_OPENSTATE_SEEKING state and sound related commands will return FMOD_ERR_NOTREADY. - With streams, if you are using FMOD_NONBLOCKING, note that if the user calls Channel::getPosition, a stream will go into FMOD_OPENSTATE_SETPOSITION state and sound related commands will return FMOD_ERR_NOTREADY. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getOpenState - FMOD_MODE -] -*/ -typedef enum -{ - FMOD_OPENSTATE_READY = 0, /* Opened and ready to play. */ - FMOD_OPENSTATE_LOADING, /* Initial load in progress. */ - FMOD_OPENSTATE_ERROR, /* Failed to open - file not found, out of memory etc. See return value of Sound::getOpenState for what happened. */ - FMOD_OPENSTATE_CONNECTING, /* Connecting to remote host (internet sounds only). */ - FMOD_OPENSTATE_BUFFERING, /* Buffering data. */ - FMOD_OPENSTATE_SEEKING, /* Seeking to subsound and re-flushing stream buffer. */ - FMOD_OPENSTATE_PLAYING, /* Ready and playing, but not possible to release at this time without stalling the main thread. */ - FMOD_OPENSTATE_SETPOSITION, /* Seeking within a stream to a different position. */ - - FMOD_OPENSTATE_MAX, /* Maximum number of open state types. */ - FMOD_OPENSTATE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_OPENSTATE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These flags are used with SoundGroup::setMaxAudibleBehavior to determine what happens when more sounds - are played than are specified with SoundGroup::setMaxAudible. - - [REMARKS] - When using FMOD_SOUNDGROUP_BEHAVIOR_MUTE, SoundGroup::setMuteFadeSpeed can be used to stop a sudden transition. - Instead, the time specified will be used to cross fade between the sounds that go silent and the ones that become audible. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - SoundGroup::setMaxAudibleBehavior - SoundGroup::getMaxAudibleBehavior - SoundGroup::setMaxAudible - SoundGroup::getMaxAudible - SoundGroup::setMuteFadeSpeed - SoundGroup::getMuteFadeSpeed -] -*/ -typedef enum -{ - FMOD_SOUNDGROUP_BEHAVIOR_FAIL, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will simply fail during System::playSound. */ - FMOD_SOUNDGROUP_BEHAVIOR_MUTE, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will be silent, then if another sound in the group stops the sound that was silent before becomes audible again. */ - FMOD_SOUNDGROUP_BEHAVIOR_STEALLOWEST, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will steal the quietest / least important sound playing in the group. */ - - FMOD_SOUNDGROUP_BEHAVIOR_MAX, /* Maximum number of open state types. */ - FMOD_SOUNDGROUP_BEHAVIOR_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SOUNDGROUP_BEHAVIOR; - - -/* -[ENUM] -[ - [DESCRIPTION] - These callback types are used with Channel::setCallback. - - [REMARKS] - Each callback has commanddata parameters passed as int unique to the type of callback. - See reference to FMOD_CHANNEL_CALLBACK to determine what they might mean for each type of callback. - - Note! Currently the user must call System::update for these callbacks to trigger! - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Channel::setCallback - FMOD_CHANNEL_CALLBACK - System::update -] -*/ -typedef enum -{ - FMOD_CHANNEL_CALLBACKTYPE_END, /* Called when a sound ends. */ - FMOD_CHANNEL_CALLBACKTYPE_VIRTUALVOICE, /* Called when a voice is swapped out or swapped in. */ - FMOD_CHANNEL_CALLBACKTYPE_SYNCPOINT, /* Called when a syncpoint is encountered. Can be from wav file markers. */ - FMOD_CHANNEL_CALLBACKTYPE_OCCLUSION, /* Called when the channel has its geometry occlusion value calculated. Can be used to clamp or change the value. */ - - FMOD_CHANNEL_CALLBACKTYPE_MAX, /* Maximum number of callback types supported. */ - FMOD_CHANNEL_CALLBACKTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_CHANNEL_CALLBACKTYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These callback types are used with System::setCallback. - - [REMARKS] - Each callback has commanddata parameters passed as void* unique to the type of callback. - See reference to FMOD_SYSTEM_CALLBACK to determine what they might mean for each type of callback. - - Note! Using FMOD_SYSTEM_CALLBACKTYPE_DEVICELISTCHANGED (on Mac only) requires the application to be running an event loop which will allow external changes to device list to be detected by FMOD. - - Note! The 'system' object pointer will be null for FMOD_SYSTEM_CALLBACKTYPE_THREADCREATED and FMOD_SYSTEM_CALLBACKTYPE_MEMORYALLOCATIONFAILED callbacks. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setCallback - FMOD_SYSTEM_CALLBACK - System::update - DSP::addInput -] -*/ -typedef enum -{ - FMOD_SYSTEM_CALLBACKTYPE_DEVICELISTCHANGED, /* Called from System::update when the enumerated list of devices has changed. */ - FMOD_SYSTEM_CALLBACKTYPE_DEVICELOST, /* Called from System::update when an output device has been lost due to control panel parameter changes and FMOD cannot automatically recover. */ - FMOD_SYSTEM_CALLBACKTYPE_MEMORYALLOCATIONFAILED, /* Called directly when a memory allocation fails somewhere in FMOD. (NOTE - 'system' will be NULL in this callback type.)*/ - FMOD_SYSTEM_CALLBACKTYPE_THREADCREATED, /* Called directly when a thread is created. (NOTE - 'system' will be NULL in this callback type.) */ - FMOD_SYSTEM_CALLBACKTYPE_BADDSPCONNECTION, /* Called when a bad connection was made with DSP::addInput. Usually called from mixer thread because that is where the connections are made. */ - FMOD_SYSTEM_CALLBACKTYPE_BADDSPLEVEL, /* Called when too many effects were added exceeding the maximum tree depth of 128. This is most likely caused by accidentally adding too many DSP effects. Usually called from mixer thread because that is where the connections are made. */ - - FMOD_SYSTEM_CALLBACKTYPE_MAX, /* Maximum number of callback types supported. */ - FMOD_SYSTEM_CALLBACKTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SYSTEM_CALLBACKTYPE; - - -/* - FMOD Callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACKTYPE type, void *commanddata1, void *commanddata2); - -typedef FMOD_RESULT (F_CALLBACK *FMOD_CHANNEL_CALLBACK) (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *commanddata1, void *commanddata2); - -typedef FMOD_RESULT (F_CALLBACK *FMOD_SOUND_NONBLOCKCALLBACK)(FMOD_SOUND *sound, FMOD_RESULT result); -typedef FMOD_RESULT (F_CALLBACK *FMOD_SOUND_PCMREADCALLBACK)(FMOD_SOUND *sound, void *data, unsigned int datalen); -typedef FMOD_RESULT (F_CALLBACK *FMOD_SOUND_PCMSETPOSCALLBACK)(FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype); - -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_OPENCALLBACK) (const char *name, int unicode, unsigned int *filesize, void **handle, void **userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_CLOSECALLBACK) (void *handle, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_READCALLBACK) (void *handle, void *buffer, unsigned int sizebytes, unsigned int *bytesread, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_SEEKCALLBACK) (void *handle, unsigned int pos, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_ASYNCREADCALLBACK)(FMOD_ASYNCREADINFO *info, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_ASYNCCANCELCALLBACK)(void *handle, void *userdata); - -typedef void * (F_CALLBACK *FMOD_MEMORY_ALLOCCALLBACK) (unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); -typedef void * (F_CALLBACK *FMOD_MEMORY_REALLOCCALLBACK)(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); -typedef void (F_CALLBACK *FMOD_MEMORY_FREECALLBACK) (void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr); - -typedef float (F_CALLBACK *FMOD_3D_ROLLOFFCALLBACK) (FMOD_CHANNEL *channel, float distance); - - -/* -[ENUM] -[ - [DESCRIPTION] - List of windowing methods used in spectrum analysis to reduce leakage / transient signals intefering with the analysis. - This is a problem with analysis of continuous signals that only have a small portion of the signal sample (the fft window size). - Windowing the signal with a curve or triangle tapers the sides of the fft window to help alleviate this problem. - - [REMARKS] - Cyclic signals such as a sine wave that repeat their cycle in a multiple of the window size do not need windowing. - I.e. If the sine wave repeats every 1024, 512, 256 etc samples and the FMOD fft window is 1024, then the signal would not need windowing. - Not windowing is the same as FMOD_DSP_FFT_WINDOW_RECT, which is the default. - If the cycle of the signal (ie the sine wave) is not a multiple of the window size, it will cause frequency abnormalities, so a different windowing method is needed. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getSpectrum - Channel::getSpectrum -] -*/ -typedef enum -{ - FMOD_DSP_FFT_WINDOW_RECT, /* w[n] = 1.0 */ - FMOD_DSP_FFT_WINDOW_TRIANGLE, /* w[n] = TRI(2n/N) */ - FMOD_DSP_FFT_WINDOW_HAMMING, /* w[n] = 0.54 - (0.46 * COS(n/N) ) */ - FMOD_DSP_FFT_WINDOW_HANNING, /* w[n] = 0.5 * (1.0 - COS(n/N) ) */ - FMOD_DSP_FFT_WINDOW_BLACKMAN, /* w[n] = 0.42 - (0.5 * COS(n/N) ) + (0.08 * COS(2.0 * n/N) ) */ - FMOD_DSP_FFT_WINDOW_BLACKMANHARRIS, /* w[n] = 0.35875 - (0.48829 * COS(1.0 * n/N)) + (0.14128 * COS(2.0 * n/N)) - (0.01168 * COS(3.0 * n/N)) */ - - FMOD_DSP_FFT_WINDOW_MAX, /* Maximum number of FFT window types supported. */ - FMOD_DSP_FFT_WINDOW_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DSP_FFT_WINDOW; - - -/* -[ENUM] -[ - [DESCRIPTION] - List of interpolation types that the FMOD Ex software mixer supports. - - [REMARKS] - The default resampler type is FMOD_DSP_RESAMPLER_LINEAR. - Use System::setSoftwareFormat to tell FMOD the resampling quality you require for FMOD_SOFTWARE based sounds. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setSoftwareFormat - System::getSoftwareFormat -] -*/ -typedef enum -{ - FMOD_DSP_RESAMPLER_NOINTERP, /* No interpolation. High frequency aliasing hiss will be audible depending on the sample rate of the sound. */ - FMOD_DSP_RESAMPLER_LINEAR, /* Linear interpolation (default method). Fast and good quality, causes very slight lowpass effect on low frequency sounds. */ - FMOD_DSP_RESAMPLER_CUBIC, /* Cubic interpolation. Slower than linear interpolation but better quality. */ - FMOD_DSP_RESAMPLER_SPLINE, /* 5 point spline interpolation. Slowest resampling method but best quality. */ - - FMOD_DSP_RESAMPLER_MAX, /* Maximum number of resample methods supported. */ - FMOD_DSP_RESAMPLER_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DSP_RESAMPLER; - - -/* -[ENUM] -[ - [DESCRIPTION] - List of tag types that could be stored within a sound. These include id3 tags, metadata from netstreams and vorbis/asf data. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag -] -*/ -typedef enum -{ - FMOD_TAGTYPE_UNKNOWN = 0, - FMOD_TAGTYPE_ID3V1, - FMOD_TAGTYPE_ID3V2, - FMOD_TAGTYPE_VORBISCOMMENT, - FMOD_TAGTYPE_SHOUTCAST, - FMOD_TAGTYPE_ICECAST, - FMOD_TAGTYPE_ASF, - FMOD_TAGTYPE_MIDI, - FMOD_TAGTYPE_PLAYLIST, - FMOD_TAGTYPE_FMOD, - FMOD_TAGTYPE_USER, - - FMOD_TAGTYPE_MAX, /* Maximum number of tag types supported. */ - FMOD_TAGTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_TAGTYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - List of data types that can be returned by Sound::getTag - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag -] -*/ -typedef enum -{ - FMOD_TAGDATATYPE_BINARY = 0, - FMOD_TAGDATATYPE_INT, - FMOD_TAGDATATYPE_FLOAT, - FMOD_TAGDATATYPE_STRING, - FMOD_TAGDATATYPE_STRING_UTF16, - FMOD_TAGDATATYPE_STRING_UTF16BE, - FMOD_TAGDATATYPE_STRING_UTF8, - FMOD_TAGDATATYPE_CDTOC, - - FMOD_TAGDATATYPE_MAX, /* Maximum number of tag datatypes supported. */ - FMOD_TAGDATATYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_TAGDATATYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Types of delay that can be used with Channel::setDelay / Channel::getDelay. - - [REMARKS] - If you haven't called Channel::setDelay yet, if you call Channel::getDelay with FMOD_DELAYTYPE_DSPCLOCK_START it will return the - equivalent global DSP clock value to determine when a channel started, so that you can use it for other channels to sync against. - - Use System::getDSPClock to also get the current dspclock time, a base for future calls to Channel::setDelay. - - Use FMOD_64BIT_ADD or FMOD_64BIT_SUB to add a hi/lo combination together and cope with wraparound. - - If FMOD_DELAYTYPE_END_MS is specified, the value is not treated as a 64 bit number, just the delayhi value is used and it is treated as milliseconds. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Channel::setDelay - Channel::getDelay - System::getDSPClock -] -*/ -typedef enum -{ - FMOD_DELAYTYPE_END_MS, /* Delay at the end of the sound in milliseconds. Use delayhi only. Channel::isPlaying will remain true until this delay has passed even though the sound itself has stopped playing.*/ - FMOD_DELAYTYPE_DSPCLOCK_START, /* Time the sound started if Channel::getDelay is used, or if Channel::setDelay is used, the sound will delay playing until this exact tick. */ - FMOD_DELAYTYPE_DSPCLOCK_END, /* Time the sound should end. If this is non-zero, the channel will go silent at this exact tick. */ - FMOD_DELAYTYPE_DSPCLOCK_PAUSE, /* Time the sound should pause. If this is non-zero, the channel will pause at this exact tick. */ - - FMOD_DELAYTYPE_MAX, /* Maximum number of tag datatypes supported. */ - FMOD_DELAYTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DELAYTYPE; - - -#define FMOD_64BIT_ADD(_hi1, _lo1, _hi2, _lo2) _hi1 += ((_hi2) + ((((_lo1) + (_lo2)) < (_lo1)) ? 1 : 0)); (_lo1) += (_lo2); -#define FMOD_64BIT_SUB(_hi1, _lo1, _hi2, _lo2) _hi1 -= ((_hi2) + ((((_lo1) - (_lo2)) > (_lo1)) ? 1 : 0)); (_lo1) -= (_lo2); - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a piece of tag data. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag - FMOD_TAGTYPE - FMOD_TAGDATATYPE -] -*/ -typedef struct FMOD_TAG -{ - FMOD_TAGTYPE type; /* [r] The type of this tag. */ - FMOD_TAGDATATYPE datatype; /* [r] The type of data that this tag contains */ - char *name; /* [r] The name of this tag i.e. "TITLE", "ARTIST" etc. */ - void *data; /* [r] Pointer to the tag data - its format is determined by the datatype member */ - unsigned int datalen; /* [r] Length of the data contained in this tag */ - FMOD_BOOL updated; /* [r] True if this tag has been updated since last being accessed with Sound::getTag */ -} FMOD_TAG; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a CD/DVD table of contents - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag -] -*/ -typedef struct FMOD_CDTOC -{ - int numtracks; /* [r] The number of tracks on the CD */ - int min[100]; /* [r] The start offset of each track in minutes */ - int sec[100]; /* [r] The start offset of each track in seconds */ - int frame[100]; /* [r] The start offset of each track in frames */ -} FMOD_CDTOC; - - -/* -[DEFINE] -[ - [NAME] - FMOD_TIMEUNIT - - [DESCRIPTION] - List of time types that can be returned by Sound::getLength and used with Channel::setPosition or Channel::getPosition. - - [REMARKS] - FMOD_TIMEUNIT_SENTENCE_MS, FMOD_TIMEUNIT_SENTENCE_PCM, FMOD_TIMEUNIT_SENTENCE_PCMBYTES, FMOD_TIMEUNIT_SENTENCE and FMOD_TIMEUNIT_SENTENCE_SUBSOUND are only supported by Channel functions. - Do not combine flags except FMOD_TIMEUNIT_BUFFERED. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getLength - Channel::setPosition - Channel::getPosition -] -*/ -#define FMOD_TIMEUNIT_MS 0x00000001 /* Milliseconds. */ -#define FMOD_TIMEUNIT_PCM 0x00000002 /* PCM samples, related to milliseconds * samplerate / 1000. */ -#define FMOD_TIMEUNIT_PCMBYTES 0x00000004 /* Bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes). */ -#define FMOD_TIMEUNIT_RAWBYTES 0x00000008 /* Raw file bytes of (compressed) sound data (does not include headers). Only used by Sound::getLength and Channel::getPosition. */ -#define FMOD_TIMEUNIT_PCMFRACTION 0x00000010 /* Fractions of 1 PCM sample. Unsigned int range 0 to 0xFFFFFFFF. Used for sub-sample granularity for DSP purposes. */ -#define FMOD_TIMEUNIT_MODORDER 0x00000100 /* MOD/S3M/XM/IT. Order in a sequenced module format. Use Sound::getFormat to determine the PCM format being decoded to. */ -#define FMOD_TIMEUNIT_MODROW 0x00000200 /* MOD/S3M/XM/IT. Current row in a sequenced module format. Sound::getLength will return the number of rows in the currently playing or seeked to pattern. */ -#define FMOD_TIMEUNIT_MODPATTERN 0x00000400 /* MOD/S3M/XM/IT. Current pattern in a sequenced module format. Sound::getLength will return the number of patterns in the song and Channel::getPosition will return the currently playing pattern. */ -#define FMOD_TIMEUNIT_SENTENCE_MS 0x00010000 /* Currently playing subsound in a sentence time in milliseconds. */ -#define FMOD_TIMEUNIT_SENTENCE_PCM 0x00020000 /* Currently playing subsound in a sentence time in PCM Samples, related to milliseconds * samplerate / 1000. */ -#define FMOD_TIMEUNIT_SENTENCE_PCMBYTES 0x00040000 /* Currently playing subsound in a sentence time in bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes). */ -#define FMOD_TIMEUNIT_SENTENCE 0x00080000 /* Currently playing sentence index according to the channel. */ -#define FMOD_TIMEUNIT_SENTENCE_SUBSOUND 0x00100000 /* Currently playing subsound index in a sentence. */ -#define FMOD_TIMEUNIT_BUFFERED 0x10000000 /* Time value as seen by buffered stream. This is always ahead of audible time, and is only used for processing. */ -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - When creating a multichannel sound, FMOD will pan them to their default speaker locations, for example a 6 channel sound will default to one channel per 5.1 output speaker. - Another example is a stereo sound. It will default to left = front left, right = front right. - - This is for sounds that are not 'default'. For example you might have a sound that is 6 channels but actually made up of 3 stereo pairs, that should all be located in front left, front right only. - - [REMARKS] - For full flexibility of speaker assignments, use Channel::setSpeakerLevels. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_CREATESOUNDEXINFO - Channel::setSpeakerLevels -] -*/ -typedef enum -{ - FMOD_SPEAKERMAPTYPE_DEFAULT, /* This is the default, and just means FMOD decides which speakers it puts the source channels. */ - FMOD_SPEAKERMAPTYPE_ALLMONO, /* This means the sound is made up of all mono sounds. All voices will be panned to the front center by default in this case. */ - FMOD_SPEAKERMAPTYPE_ALLSTEREO, /* This means the sound is made up of all stereo sounds. All voices will be panned to front left and front right alternating every second channel. */ - FMOD_SPEAKERMAPTYPE_51_PROTOOLS /* Map a 5.1 sound to use protools L C R Ls Rs LFE mapping. Will return an error if not a 6 channel sound. */ -} FMOD_SPEAKERMAPTYPE; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Use this structure with System::createSound when more control is needed over loading. - The possible reasons to use this with System::createSound are: - - Loading a file from memory. - - Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length. - - To create a user created / non file based sound. - - To specify a starting subsound to seek to within a multi-sample sounds (ie FSB/DLS/SF2) when created as a stream. - - To specify which subsounds to load for multi-sample sounds (ie FSB/DLS/SF2) so that memory is saved and only a subset is actually loaded/read from disk. - - To specify 'piggyback' read and seek callbacks for capture of sound data as fmod reads and decodes it. Useful for ripping decoded PCM data from sounds as they are loaded / played. - - To specify a MIDI DLS/SF2 sample set file to load when opening a MIDI file. - See below on what members to fill for each of the above types of sound you want to create. - - [REMARKS] - This structure is optional! Specify 0 or NULL in System::createSound if you don't need it! - - Loading a file from memory. - - Create the sound using the FMOD_OPENMEMORY flag. - - Mandatory. Specify 'length' for the size of the memory block in bytes. - - Other flags are optional. - - - Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length. - - Mandatory. Specify 'fileoffset' and 'length'. - - Other flags are optional. - - - To create a user created / non file based sound. - - Create the sound using the FMOD_OPENUSER flag. - - Mandatory. Specify 'defaultfrequency, 'numchannels' and 'format'. - - Other flags are optional. - - - To specify a starting subsound to seek to and flush with, within a multi-sample stream (ie FSB/DLS/SF2). - - - Mandatory. Specify 'initialsubsound'. - - - To specify which subsounds to load for multi-sample sounds (ie FSB/DLS/SF2) so that memory is saved and only a subset is actually loaded/read from disk. - - - Mandatory. Specify 'inclusionlist' and 'inclusionlistnum'. - - - To specify 'piggyback' read and seek callbacks for capture of sound data as fmod reads and decodes it. Useful for ripping decoded PCM data from sounds as they are loaded / played. - - - Mandatory. Specify 'pcmreadcallback' and 'pcmseekcallback'. - - - To specify a MIDI DLS/SF2 sample set file to load when opening a MIDI file. - - - Mandatory. Specify 'dlsname'. - - - Setting the 'decodebuffersize' is for cpu intensive codecs that may be causing stuttering, not file intensive codecs (ie those from CD or netstreams) which are normally - altered with System::setStreamBufferSize. As an example of cpu intensive codecs, an mp3 file will take more cpu to decode than a PCM wav file. - If you have a stuttering effect, then it is using more cpu than the decode buffer playback rate can keep up with. Increasing the decode buffersize will most likely solve this problem. - - - FSB codec. If inclusionlist and numsubsounds are used together, this will trigger a special mode where subsounds are shuffled down to save memory. (useful for large FSB - files where you only want to load 1 sound). There will be no gaps, ie no null subsounds. As an example, if there are 10,000 subsounds and there is an inclusionlist with only 1 entry, - and numsubsounds = 1, then subsound 0 will be that entry, and there will only be the memory allocated for 1 subsound. Previously there would still be 10,000 subsound pointers and other - associated codec entries allocated along with it multiplied by 10,000. - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createSound - System::setStreamBufferSize - FMOD_MODE - FMOD_SOUND_FORMAT - FMOD_SOUND_TYPE - FMOD_SPEAKERMAPTYPE -] -*/ -typedef struct FMOD_CREATESOUNDEXINFO -{ - int cbsize; /* [w] Size of this structure. This is used so the structure can be expanded in the future and still work on older versions of FMOD Ex. */ - unsigned int length; /* [w] Optional. Specify 0 to ignore. Size in bytes of file to load, or sound to create (in this case only if FMOD_OPENUSER is used). Required if loading from memory. If 0 is specified, then it will use the size of the file (unless loading from memory then an error will be returned). */ - unsigned int fileoffset; /* [w] Optional. Specify 0 to ignore. Offset from start of the file to start loading from. This is useful for loading files from inside big data files. */ - int numchannels; /* [w] Optional. Specify 0 to ignore. Number of channels in a sound mandatory if FMOD_OPENUSER or FMOD_OPENRAW is used. */ - int defaultfrequency; /* [w] Optional. Specify 0 to ignore. Default frequency of sound in a sound mandatory if FMOD_OPENUSER or FMOD_OPENRAW is used. Other formats use the frequency determined by the file format. */ - FMOD_SOUND_FORMAT format; /* [w] Optional. Specify 0 or FMOD_SOUND_FORMAT_NONE to ignore. Format of the sound mandatory if FMOD_OPENUSER or FMOD_OPENRAW is used. Other formats use the format determined by the file format. */ - unsigned int decodebuffersize; /* [w] Optional. Specify 0 to ignore. For streams. This determines the size of the double buffer (in PCM samples) that a stream uses. Use this for user created streams if you want to determine the size of the callback buffer passed to you. Specify 0 to use FMOD's default size which is currently equivalent to 400ms of the sound format created/loaded. */ - int initialsubsound; /* [w] Optional. Specify 0 to ignore. In a multi-sample file format such as .FSB/.DLS/.SF2, specify the initial subsound to seek to, only if FMOD_CREATESTREAM is used. */ - int numsubsounds; /* [w] Optional. Specify 0 to ignore or have no subsounds. In a sound created with FMOD_OPENUSER, specify the number of subsounds that are accessable with Sound::getSubSound. If not created with FMOD_OPENUSER, this will limit the number of subsounds loaded within a multi-subsound file. If using FSB, then if FMOD_CREATESOUNDEXINFO::inclusionlist is used, this will shuffle subsounds down so that there are not any gaps. It will mean that the indices of the sounds will be different. */ - int *inclusionlist; /* [w] Optional. Specify 0 to ignore. In a multi-sample format such as .FSB/.DLS/.SF2 it may be desirable to specify only a subset of sounds to be loaded out of the whole file. This is an array of subsound indices to load into memory when created. */ - int inclusionlistnum; /* [w] Optional. Specify 0 to ignore. This is the number of integers contained within the inclusionlist array. */ - FMOD_SOUND_PCMREADCALLBACK pcmreadcallback; /* [w] Optional. Specify 0 to ignore. Callback to 'piggyback' on FMOD's read functions and accept or even write PCM data while FMOD is opening the sound. Used for user sounds created with FMOD_OPENUSER or for capturing decoded data as FMOD reads it. */ - FMOD_SOUND_PCMSETPOSCALLBACK pcmsetposcallback; /* [w] Optional. Specify 0 to ignore. Callback for when the user calls a seeking function such as Channel::setTime or Channel::setPosition within a multi-sample sound, and for when it is opened.*/ - FMOD_SOUND_NONBLOCKCALLBACK nonblockcallback; /* [w] Optional. Specify 0 to ignore. Callback for successful completion, or error while loading a sound that used the FMOD_NONBLOCKING flag.*/ - const char *dlsname; /* [w] Optional. Specify 0 to ignore. Filename for a DLS or SF2 sample set when loading a MIDI file. If not specified, on Windows it will attempt to open /windows/system32/drivers/gm.dls or /windows/system32/drivers/etc/gm.dls, on Mac it will attempt to load /System/Library/Components/CoreAudio.component/Contents/Resources/gs_instruments.dls, otherwise the MIDI will fail to open. Current DLS support is for level 1 of the specification. */ - const char *encryptionkey; /* [w] Optional. Specify 0 to ignore. Key for encrypted FSB file. Without this key an encrypted FSB file will not load. */ - int maxpolyphony; /* [w] Optional. Specify 0 to ignore. For sequenced formats with dynamic channel allocation such as .MID and .IT, this specifies the maximum voice count allowed while playing. .IT defaults to 64. .MID defaults to 32. */ - void *userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the sound during creation. Access via Sound::getUserData. Note: This is not passed to FMOD_FILE_OPENCALLBACK, that is a different userdata that is file specific. */ - FMOD_SOUND_TYPE suggestedsoundtype; /* [w] Optional. Specify 0 or FMOD_SOUND_TYPE_UNKNOWN to ignore. Instead of scanning all codec types, use this to speed up loading by making it jump straight to this codec. */ - FMOD_FILE_OPENCALLBACK useropen; /* [w] Optional. Specify 0 to ignore. Callback for opening this file. */ - FMOD_FILE_CLOSECALLBACK userclose; /* [w] Optional. Specify 0 to ignore. Callback for closing this file. */ - FMOD_FILE_READCALLBACK userread; /* [w] Optional. Specify 0 to ignore. Callback for reading from this file. */ - FMOD_FILE_SEEKCALLBACK userseek; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ - FMOD_FILE_ASYNCREADCALLBACK userasyncread; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ - FMOD_FILE_ASYNCCANCELCALLBACK userasynccancel; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ - FMOD_SPEAKERMAPTYPE speakermap; /* [w] Optional. Specify 0 to ignore. Use this to differ the way fmod maps multichannel sounds to speakers. See FMOD_SPEAKERMAPTYPE for more. */ - FMOD_SOUNDGROUP *initialsoundgroup; /* [w] Optional. Specify 0 to ignore. Specify a sound group if required, to put sound in as it is created. */ - unsigned int initialseekposition;/* [w] Optional. Specify 0 to ignore. For streams. Specify an initial position to seek the stream to. */ - FMOD_TIMEUNIT initialseekpostype; /* [w] Optional. Specify 0 to ignore. For streams. Specify the time unit for the position set in initialseekposition. */ - int ignoresetfilesystem;/* [w] Optional. Specify 0 to ignore. Set to 1 to use fmod's built in file system. Ignores setFileSystem callbacks and also FMOD_CREATESOUNEXINFO file callbacks. Useful for specific cases where you don't want to use your own file system but want to use fmod's file system (ie net streaming). */ - int cddaforceaspi; /* [w] Optional. Specify 0 to ignore. For CDDA sounds only - if non-zero use ASPI instead of NTSCSI to access the specified CD/DVD device. */ - unsigned int audioqueuepolicy; /* [w] Optional. Specify 0 or FMOD_AUDIOQUEUE_CODECPOLICY_DEFAULT to ignore. Policy used to determine whether hardware or software is used for decoding, see FMOD_AUDIOQUEUE_CODECPOLICY for options (iOS >= 3.0 required, otherwise only hardware is available) */ - unsigned int minmidigranularity; /* [w] Optional. Specify 0 to ignore. Allows you to set a minimum desired MIDI mixer granularity. Values smaller than 512 give greater than default accuracy at the cost of more CPU and vice versa. Specify 0 for default (512 samples). */ - int nonblockthreadid; /* [w] Optional. Specify 0 to ignore. Specifies a thread index to execute non blocking load on. Allows for up to 5 threads to be used for loading at once. This is to avoid one load blocking another. Maximum value = 4. */ -} FMOD_CREATESOUNDEXINFO; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining a reverb environment. - - [REMARKS] - Note the default reverb properties are the same as the FMOD_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are always linear. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - SUPPORTED next to each parameter means the platform the parameter can be set on. Some platforms support all parameters and some don't. - WII means Nintendo Wii hardware reverb (must use FMOD_HARDWARE). - PSP means Playstation Portable hardware reverb (must use FMOD_HARDWARE). - SFX means FMOD SFX software reverb. This works on any platform that uses FMOD_SOFTWARE for loading sounds. - --- means unsupported/deprecated. Will either be removed or supported by SFX in the future. - - Nintendo Wii Notes: - This structure supports only limited parameters, and maps them to the Wii hardware reverb as follows. - DecayTime = 'time' - ReverbDelay = 'predelay' - ModulationDepth = 'damping' - Reflections = 'coloration' - EnvDiffusion = 'crosstalk' - Room = 'mix' - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - Members marked with [r/w] are either read or write depending on if you are using System::setReverbProperties (w) or System::getReverbProperties (r). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setReverbProperties - System::getReverbProperties - FMOD_REVERB_PRESETS - FMOD_REVERB_FLAGS -] -*/ -typedef struct FMOD_REVERB_PROPERTIES -{ /* MIN MAX DEFAULT DESCRIPTION */ - int Instance; /* [w] 0 3 0 Environment Instance. (SUPPORTED:SFX(4 instances) and Wii (3 instances)) */ - int Environment; /* [r/w] -1 25 -1 Sets all listener properties. -1 = OFF. (SUPPORTED:SFX(-1 only)/PSP) */ - float EnvDiffusion; /* [r/w] 0.0 1.0 1.0 Environment diffusion (SUPPORTED:WII) */ - int Room; /* [r/w] -10000 0 -1000 Room effect level (at mid frequencies) (SUPPORTED:SFX/WII/PSP) */ - int RoomHF; /* [r/w] -10000 0 -100 Relative room effect level at high frequencies (SUPPORTED:SFX) */ - int RoomLF; /* [r/w] -10000 0 0 Relative room effect level at low frequencies (SUPPORTED:SFX) */ - float DecayTime; /* [r/w] 0.1 20.0 1.49 Reverberation decay time at mid frequencies (SUPPORTED:SFX/WII) */ - float DecayHFRatio; /* [r/w] 0.1 2.0 0.83 High-frequency to mid-frequency decay time ratio (SUPPORTED:SFX) */ - float DecayLFRatio; /* [r/w] 0.1 2.0 1.0 Low-frequency to mid-frequency decay time ratio (SUPPORTED:---) */ - int Reflections; /* [r/w] -10000 1000 -2602 Early reflections level relative to room effect (SUPPORTED:SFX/WII) */ - float ReflectionsDelay; /* [r/w] 0.0 0.3 0.007 Initial reflection delay time (SUPPORTED:SFX) */ - int Reverb; /* [r/w] -10000 2000 200 Late reverberation level relative to room effect (SUPPORTED:SFX) */ - float ReverbDelay; /* [r/w] 0.0 0.1 0.011 Late reverberation delay time relative to initial reflection (SUPPORTED:SFX/WII) */ - float ModulationTime; /* [r/w] 0.04 4.0 0.25 Modulation time (SUPPORTED:---) */ - float ModulationDepth; /* [r/w] 0.0 1.0 0.0 Modulation depth (SUPPORTED:WII) */ - float HFReference; /* [r/w] 20.0 20000.0 5000.0 Reference high frequency (hz) (SUPPORTED:SFX) */ - float LFReference; /* [r/w] 20.0 1000.0 250.0 Reference low frequency (hz) (SUPPORTED:SFX) */ - float Diffusion; /* [r/w] 0.0 100.0 100.0 Value that controls the echo density in the late reverberation decay. (SUPPORTED:SFX) */ - float Density; /* [r/w] 0.0 100.0 100.0 Value that controls the modal density in the late reverberation decay (SUPPORTED:SFX) */ - unsigned int Flags; /* [r/w] FMOD_REVERB_FLAGS - modifies the behavior of above properties (SUPPORTED:WII) */ -} FMOD_REVERB_PROPERTIES; - - -/* -[DEFINE] -[ - [NAME] - FMOD_REVERB_FLAGS - - [DESCRIPTION] - Values for the Flags member of the FMOD_REVERB_PROPERTIES structure. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_REVERB_PROPERTIES -] -*/ -#define FMOD_REVERB_FLAGS_HIGHQUALITYREVERB 0x00000400 /* Wii. Use high quality reverb */ -#define FMOD_REVERB_FLAGS_HIGHQUALITYDPL2REVERB 0x00000800 /* Wii. Use high quality DPL2 reverb */ -#define FMOD_REVERB_FLAGS_HARDWAREONLY 0x00001000 /* Don't create an SFX reverb for FMOD_SOFTWARE channels, hardware reverb only */ -#define FMOD_REVERB_FLAGS_DEFAULT 0x00000000 -/* [DEFINE_END] */ - - -/* -[DEFINE] -[ - [NAME] - FMOD_REVERB_PRESETS - - [DESCRIPTION] - A set of predefined environment PARAMETERS. - These are used to initialize an FMOD_REVERB_PROPERTIES structure statically. - i.e. - FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_GENERIC; - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setReverbProperties -] -*/ -/* Inst Env Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel Revb RevDel ModTm ModDp HFRef LFRef Diffus Densty FLAGS */ -#define FMOD_PRESET_OFF { 0, -1, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, 200, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 0.0f, 0.0f, 0x33f } -#define FMOD_PRESET_GENERIC { 0, 0, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, 200, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_PADDEDCELL { 0, 1, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, 207, 0.002f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_ROOM { 0, 2, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, 53, 0.003f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_BATHROOM { 0, 3, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, 1030, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 60.0f, 0x3f } -#define FMOD_PRESET_LIVINGROOM { 0, 4, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, -1104, 0.004f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_STONEROOM { 0, 5, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, 83, 0.017f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_AUDITORIUM { 0, 6, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, -289, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CONCERTHALL { 0, 7, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, -2, 0.029f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CAVE { 0, 8, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, -302, 0.022f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x1f } -#define FMOD_PRESET_ARENA { 0, 9, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, 16, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_HANGAR { 0, 10, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, 198, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CARPETTEDHALLWAY { 0, 11, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, -1630, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_HALLWAY { 0, 12, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, 441, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_STONECORRIDOR { 0, 13, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, 395, 0.020f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_ALLEY { 0, 14, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, -4, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_FOREST { 0, 15, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, -229, 0.088f, 0.25f, 0.000f, 5000.0f, 250.0f, 79.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CITY { 0, 16, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, -1691, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 50.0f, 100.0f, 0x3f } -#define FMOD_PRESET_MOUNTAINS { 0, 17, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, -1434, 0.100f, 0.25f, 0.000f, 5000.0f, 250.0f, 27.0f, 100.0f, 0x1f } -#define FMOD_PRESET_QUARRY { 0, 18, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, 500, 0.025f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_PLAIN { 0, 19, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, -1926, 0.100f, 0.25f, 0.000f, 5000.0f, 250.0f, 21.0f, 100.0f, 0x3f } -#define FMOD_PRESET_PARKINGLOT { 0, 20, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, -1153, 0.012f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x1f } -#define FMOD_PRESET_SEWERPIPE { 0, 21, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, 1023, 0.021f, 0.25f, 0.000f, 5000.0f, 250.0f, 80.0f, 60.0f, 0x3f } -#define FMOD_PRESET_UNDERWATER { 0, 22, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, 1700, 0.011f, 1.18f, 0.348f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } - -/* PlayStation Portable Only presets */ -#define FMOD_PRESET_PSP_ROOM { 0, 1, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_STUDIO_A { 0, 2, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_STUDIO_B { 0, 3, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_STUDIO_C { 0, 4, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_HALL { 0, 5, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_SPACE { 0, 6, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_ECHO { 0, 7, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_DELAY { 0, 8, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_PIPE { 0, 9, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining the properties for a reverb source, related to a FMOD channel. - - Note the default reverb properties are the same as the FMOD_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/wii). - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - [REMARKS] - SUPPORTED next to each parameter means the platform the parameter can be set on. Some platforms support all parameters and some don't. - WII means Nintendo Wii hardware reverb (must use FMOD_HARDWARE). - PSP means Playstation Portable hardware reverb (must use FMOD_HARDWARE). - SFX means FMOD SFX software reverb. This works on any platform that uses FMOD_SOFTWARE for loading sounds. - --- means unsupported/deprecated. Will either be removed or supported by SFX in the future. - - - 'ConnectionPoint' Parameter. This parameter is for the FMOD software reverb only (known as SFX in the list above). - By default the dsp network connection for a channel and its reverb is between the 'SFX Reverb' unit, and the channel's wavetable/resampler/dspcodec/oscillator unit (the unit below the channel DSP head). NULL can be used for this parameter to make it use this default behaviour. - This parameter allows the user to connect the SFX reverb to somewhere else internally, for example the channel DSP head, or a related channelgroup. The event system uses this so that it can have the output of an event going to the reverb, instead of just the output of the event's channels (thereby ignoring event effects/submixes etc). - Do not use if you are unaware of DSP network connection issues. Leave it at the default of NULL instead. - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - Members marked with [r/w] are either read or write depending on if you are using Channel::setReverbProperties (w) or Channel::getReverbProperties (r). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Channel::setReverbProperties - Channel::getReverbProperties - FMOD_REVERB_CHANNELFLAGS -] -*/ -typedef struct FMOD_REVERB_CHANNELPROPERTIES -{ /* MIN MAX DEFAULT DESCRIPTION */ - int Direct; /* [r/w] -10000 1000 0 Direct path level (SUPPORTED:SFX) */ - int Room; /* [r/w] -10000 1000 0 Room effect level (SUPPORTED:SFX) */ - unsigned int Flags; /* [r/w] FMOD_REVERB_CHANNELFLAGS - modifies the behavior of properties (SUPPORTED:SFX) */ - FMOD_DSP *ConnectionPoint; /* [r/w] See remarks. DSP network location to connect reverb for this channel. (SUPPORTED:SFX).*/ -} FMOD_REVERB_CHANNELPROPERTIES; - - -/* -[DEFINE] -[ - [NAME] - FMOD_REVERB_CHANNELFLAGS - - [DESCRIPTION] - Values for the Flags member of the FMOD_REVERB_CHANNELPROPERTIES structure. - - [REMARKS] - For SFX Reverb, there is support for multiple reverb environments. - Use FMOD_REVERB_CHANNELFLAGS_ENVIRONMENT0 to FMOD_REVERB_CHANNELFLAGS_ENVIRONMENT3 in the flags member - of FMOD_REVERB_CHANNELPROPERTIES to specify which environment instance(s) to target. - - If you do not specify any instance the first reverb instance will be used. - - If you specify more than one instance with getReverbProperties, the first instance will be used. - - If you specify more than one instance with setReverbProperties, it will set more than 1 instance at once. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_REVERB_CHANNELPROPERTIES -] -*/ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE0 0x00000010 /* SFX/Wii. Specify channel to target reverb instance 0. Default target. */ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE1 0x00000020 /* SFX/Wii. Specify channel to target reverb instance 1. */ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE2 0x00000040 /* SFX/Wii. Specify channel to target reverb instance 2. */ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE3 0x00000080 /* SFX. Specify channel to target reverb instance 3. */ - -#define FMOD_REVERB_CHANNELFLAGS_DEFAULT FMOD_REVERB_CHANNELFLAGS_INSTANCE0 -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Settings for advanced features like configuring memory and cpu usage for the FMOD_CREATECOMPRESSEDSAMPLE feature. - - [REMARKS] - maxMPEGcodecs / maxADPCMcodecs / maxXMAcodecs will determine the maximum cpu usage of playing realtime samples. Use this to lower potential excess cpu usage and also control memory usage. - - maxPCMcodecs is for use with PS3 only. It will determine the maximum number of PCM voices that can be played at once. This includes streams of any format and all sounds created - *without* the FMOD_CREATECOMPRESSEDSAMPLE flag. - - Memory will be allocated for codecs 'up front' (during System::init) if these values are specified as non zero. If any are zero, it allocates memory for the codec whenever a file of the type in question is loaded. So if maxMPEGcodecs is 0 for example, it will allocate memory for the mpeg codecs the first time an mp3 is loaded or an mp3 based .FSB file is loaded. - - Due to inefficient encoding techniques on certain .wav based ADPCM files, FMOD can can need an extra 29720 bytes per codec. This means for lowest memory consumption. Use FSB as it uses an optimal/small ADPCM block size. - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - Members marked with [r/w] are either read or write depending on if you are using System::setAdvancedSettings (w) or System::getAdvancedSettings (r). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setAdvancedSettings - System::getAdvancedSettings - System::init - FMOD_MODE -] -*/ -typedef struct FMOD_ADVANCEDSETTINGS -{ - int cbsize; /* [w] Size of this structure. Use sizeof(FMOD_ADVANCEDSETTINGS) NOTE: This must be set before calling System::getAdvancedSettings! */ - int maxMPEGcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. Mpeg codecs consume 21,684 bytes per instance and this number will determine how many mpeg channels can be played simultaneously. Default = 32. */ - int maxADPCMcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. ADPCM codecs consume 2,136 bytes per instance and this number will determine how many ADPCM channels can be played simultaneously. Default = 32. */ - int maxXMAcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. XMA codecs consume 14,836 bytes per instance and this number will determine how many XMA channels can be played simultaneously. Default = 32. */ - int maxCELTcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. CELT codecs consume 11,500 bytes per instance and this number will determine how many CELT channels can be played simultaneously. Default = 32. */ - int maxVORBIScodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. Vorbis codecs consume 12,000 bytes per instance and this number will determine how many Vorbis channels can be played simultaneously. Default = 32. */ - int maxPCMcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with PS3 only. PCM codecs consume 12,672 bytes per instance and this number will determine how many streams and PCM voices can be played simultaneously. Default = 16. */ - int ASIONumChannels; /* [r/w] Optional. Specify 0 to ignore. Number of channels available on the ASIO device. */ - char **ASIOChannelList; /* [r/w] Optional. Specify 0 to ignore. Pointer to an array of strings (number of entries defined by ASIONumChannels) with ASIO channel names. */ - FMOD_SPEAKER *ASIOSpeakerList; /* [r/w] Optional. Specify 0 to ignore. Pointer to a list of speakers that the ASIO channels map to. This can be called after System::init to remap ASIO output. */ - int max3DReverbDSPs; /* [r/w] Optional. Specify 0 to ignore. The max number of 3d reverb DSP's in the system. (NOTE: CURRENTLY DISABLED / UNUSED) */ - float HRTFMinAngle; /* [r/w] Optional. For use with FMOD_INIT_HRTF_LOWPASS. The angle range (0-360) of a 3D sound in relation to the listener, at which the HRTF function begins to have an effect. 0 = in front of the listener. 180 = from 90 degrees to the left of the listener to 90 degrees to the right. 360 = behind the listener. Default = 180.0. */ - float HRTFMaxAngle; /* [r/w] Optional. For use with FMOD_INIT_HRTF_LOWPASS. The angle range (0-360) of a 3D sound in relation to the listener, at which the HRTF function has maximum effect. 0 = front of the listener. 180 = from 90 degrees to the left of the listener to 90 degrees to the right. 360 = behind the listener. Default = 360.0. */ - float HRTFFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_HRTF_LOWPASS. The cutoff frequency of the HRTF's lowpass filter function when at maximum effect. (i.e. at HRTFMaxAngle). Default = 4000.0. */ - float vol0virtualvol; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_VOL0_BECOMES_VIRTUAL. If this flag is used, and the volume is 0.0, then the sound will become virtual. Use this value to raise the threshold to a different point where a sound goes virtual. */ - int eventqueuesize; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD Event system only. Specifies the number of slots available for simultaneous non blocking loads, across all threads. Default = 32. */ - unsigned int defaultDecodeBufferSize; /* [r/w] Optional. Specify 0 to ignore. For streams. This determines the default size of the double buffer (in milliseconds) that a stream uses. Default = 400ms */ - char *debugLogFilename; /* [r/w] Optional. Specify 0 to ignore. Gives fmod's logging system a path/filename. Normally the log is placed in the same directory as the executable and called fmod.log. When using System::getAdvancedSettings, provide at least 256 bytes of memory to copy into. */ - unsigned short profileport; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_ENABLE_PROFILE. Specify the port to listen on for connections by the profiler application. */ - unsigned int geometryMaxFadeTime; /* [r/w] Optional. Specify 0 to ignore. The maximum time in miliseconds it takes for a channel to fade to the new level when its occlusion changes. */ - unsigned int maxSpectrumWaveDataBuffers; /* [r/w] Optional. Specify 0 to ignore. Tells System::init to allocate a pool of wavedata/spectrum buffers to prevent memory fragmentation, any additional buffers will be allocated normally. */ - unsigned int musicSystemCacheDelay; /* [r/w] Optional. Specify 0 to ignore. The delay the music system should allow for loading a sample from disk (in milliseconds). Default = 400 ms. */ - float distanceFilterCenterFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_DISTANCE_FILTERING. The default center frequency in Hz for the distance filtering effect. Default = 1500.0. */ - unsigned int stackSizeStream; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD Stream thread in bytes. Useful for custom codecs that use excess stack. Default 49,152 (48kb) */ - unsigned int stackSizeNonBlocking; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD_NONBLOCKING loading thread. Useful for custom codecs that use excess stack. Default 65,536 (64kb) */ - unsigned int stackSizeMixer; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD mixer thread. Useful for custom dsps that use excess stack. Default 49,152 (48kb) */ -} FMOD_ADVANCEDSETTINGS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Special channel index values for FMOD functions. - - [REMARKS] - To get 'all' of the channels, use System::getMasterChannelGroup. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::playSound - System::playDSP - System::getChannel - System::getMasterChannelGroup -] -*/ -typedef enum -{ - FMOD_CHANNEL_FREE = -1, /* For a channel index, FMOD chooses a free voice using the priority system. */ - FMOD_CHANNEL_REUSE = -2 /* For a channel index, re-use the channel handle that was passed in. */ -} FMOD_CHANNELINDEX; - -#include "fmod_codec.h" -#include "fmod_dsp.h" -#include "fmod_memoryinfo.h" - -/* ========================================================================================== */ -/* FUNCTION PROTOTYPES */ -/* ========================================================================================== */ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* - FMOD global system functions (optional). -*/ - -FMOD_RESULT F_API FMOD_Memory_Initialize (void *poolmem, int poollen, FMOD_MEMORY_ALLOCCALLBACK useralloc, FMOD_MEMORY_REALLOCCALLBACK userrealloc, FMOD_MEMORY_FREECALLBACK userfree, FMOD_MEMORY_TYPE memtypeflags); -FMOD_RESULT F_API FMOD_Memory_GetStats (int *currentalloced, int *maxalloced, FMOD_BOOL blocking); -FMOD_RESULT F_API FMOD_Debug_SetLevel (FMOD_DEBUGLEVEL level); -FMOD_RESULT F_API FMOD_Debug_GetLevel (FMOD_DEBUGLEVEL *level); -FMOD_RESULT F_API FMOD_File_SetDiskBusy (int busy); -FMOD_RESULT F_API FMOD_File_GetDiskBusy (int *busy); - -/* - FMOD System factory functions. Use this to create an FMOD System Instance. below you will see FMOD_System_Init/Close to get started. -*/ - -FMOD_RESULT F_API FMOD_System_Create (FMOD_SYSTEM **system); -FMOD_RESULT F_API FMOD_System_Release (FMOD_SYSTEM *system); - - -/* - 'System' API -*/ - -/* - Pre-init functions. -*/ - -FMOD_RESULT F_API FMOD_System_SetOutput (FMOD_SYSTEM *system, FMOD_OUTPUTTYPE output); -FMOD_RESULT F_API FMOD_System_GetOutput (FMOD_SYSTEM *system, FMOD_OUTPUTTYPE *output); -FMOD_RESULT F_API FMOD_System_GetNumDrivers (FMOD_SYSTEM *system, int *numdrivers); -FMOD_RESULT F_API FMOD_System_GetDriverInfo (FMOD_SYSTEM *system, int id, char *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetDriverInfoW (FMOD_SYSTEM *system, int id, short *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetDriverCaps (FMOD_SYSTEM *system, int id, FMOD_CAPS *caps, int *controlpaneloutputrate, FMOD_SPEAKERMODE *controlpanelspeakermode); -FMOD_RESULT F_API FMOD_System_SetDriver (FMOD_SYSTEM *system, int driver); -FMOD_RESULT F_API FMOD_System_GetDriver (FMOD_SYSTEM *system, int *driver); -FMOD_RESULT F_API FMOD_System_SetHardwareChannels (FMOD_SYSTEM *system, int numhardwarechannels); -FMOD_RESULT F_API FMOD_System_SetSoftwareChannels (FMOD_SYSTEM *system, int numsoftwarechannels); -FMOD_RESULT F_API FMOD_System_GetSoftwareChannels (FMOD_SYSTEM *system, int *numsoftwarechannels); -FMOD_RESULT F_API FMOD_System_SetSoftwareFormat (FMOD_SYSTEM *system, int samplerate, FMOD_SOUND_FORMAT format, int numoutputchannels, int maxinputchannels, FMOD_DSP_RESAMPLER resamplemethod); -FMOD_RESULT F_API FMOD_System_GetSoftwareFormat (FMOD_SYSTEM *system, int *samplerate, FMOD_SOUND_FORMAT *format, int *numoutputchannels, int *maxinputchannels, FMOD_DSP_RESAMPLER *resamplemethod, int *bits); -FMOD_RESULT F_API FMOD_System_SetDSPBufferSize (FMOD_SYSTEM *system, unsigned int bufferlength, int numbuffers); -FMOD_RESULT F_API FMOD_System_GetDSPBufferSize (FMOD_SYSTEM *system, unsigned int *bufferlength, int *numbuffers); -FMOD_RESULT F_API FMOD_System_SetFileSystem (FMOD_SYSTEM *system, FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek, FMOD_FILE_ASYNCREADCALLBACK userasyncread, FMOD_FILE_ASYNCCANCELCALLBACK userasynccancel, int blockalign); -FMOD_RESULT F_API FMOD_System_AttachFileSystem (FMOD_SYSTEM *system, FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek); -FMOD_RESULT F_API FMOD_System_SetAdvancedSettings (FMOD_SYSTEM *system, FMOD_ADVANCEDSETTINGS *settings); -FMOD_RESULT F_API FMOD_System_GetAdvancedSettings (FMOD_SYSTEM *system, FMOD_ADVANCEDSETTINGS *settings); -FMOD_RESULT F_API FMOD_System_SetSpeakerMode (FMOD_SYSTEM *system, FMOD_SPEAKERMODE speakermode); -FMOD_RESULT F_API FMOD_System_GetSpeakerMode (FMOD_SYSTEM *system, FMOD_SPEAKERMODE *speakermode); -FMOD_RESULT F_API FMOD_System_SetCallback (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK callback); - -/* - Plug-in support -*/ - -FMOD_RESULT F_API FMOD_System_SetPluginPath (FMOD_SYSTEM *system, const char *path); -FMOD_RESULT F_API FMOD_System_LoadPlugin (FMOD_SYSTEM *system, const char *filename, unsigned int *handle, unsigned int priority); -FMOD_RESULT F_API FMOD_System_UnloadPlugin (FMOD_SYSTEM *system, unsigned int handle); -FMOD_RESULT F_API FMOD_System_GetNumPlugins (FMOD_SYSTEM *system, FMOD_PLUGINTYPE plugintype, int *numplugins); -FMOD_RESULT F_API FMOD_System_GetPluginHandle (FMOD_SYSTEM *system, FMOD_PLUGINTYPE plugintype, int index, unsigned int *handle); -FMOD_RESULT F_API FMOD_System_GetPluginInfo (FMOD_SYSTEM *system, unsigned int handle, FMOD_PLUGINTYPE *plugintype, char *name, int namelen, unsigned int *version); -FMOD_RESULT F_API FMOD_System_SetOutputByPlugin (FMOD_SYSTEM *system, unsigned int handle); -FMOD_RESULT F_API FMOD_System_GetOutputByPlugin (FMOD_SYSTEM *system, unsigned int *handle); -FMOD_RESULT F_API FMOD_System_CreateDSPByPlugin (FMOD_SYSTEM *system, unsigned int handle, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_RegisterCodec (FMOD_SYSTEM *system, FMOD_CODEC_DESCRIPTION *description, unsigned int *handle, unsigned int priority); -FMOD_RESULT F_API FMOD_System_RegisterDSP (FMOD_SYSTEM *system, FMOD_DSP_DESCRIPTION *description, unsigned int *handle); - -/* - Init/Close -*/ - -FMOD_RESULT F_API FMOD_System_Init (FMOD_SYSTEM *system, int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata); -FMOD_RESULT F_API FMOD_System_Close (FMOD_SYSTEM *system); - -/* - General post-init system functions -*/ - -FMOD_RESULT F_API FMOD_System_Update (FMOD_SYSTEM *system); - -FMOD_RESULT F_API FMOD_System_Set3DSettings (FMOD_SYSTEM *system, float dopplerscale, float distancefactor, float rolloffscale); -FMOD_RESULT F_API FMOD_System_Get3DSettings (FMOD_SYSTEM *system, float *dopplerscale, float *distancefactor, float *rolloffscale); -FMOD_RESULT F_API FMOD_System_Set3DNumListeners (FMOD_SYSTEM *system, int numlisteners); -FMOD_RESULT F_API FMOD_System_Get3DNumListeners (FMOD_SYSTEM *system, int *numlisteners); -FMOD_RESULT F_API FMOD_System_Set3DListenerAttributes(FMOD_SYSTEM *system, int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_System_Get3DListenerAttributes(FMOD_SYSTEM *system, int listener, FMOD_VECTOR *pos, FMOD_VECTOR *vel, FMOD_VECTOR *forward, FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_System_Set3DRolloffCallback (FMOD_SYSTEM *system, FMOD_3D_ROLLOFFCALLBACK callback); -FMOD_RESULT F_API FMOD_System_Set3DSpeakerPosition (FMOD_SYSTEM *system, FMOD_SPEAKER speaker, float x, float y, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_System_Get3DSpeakerPosition (FMOD_SYSTEM *system, FMOD_SPEAKER speaker, float *x, float *y, FMOD_BOOL *active); - -FMOD_RESULT F_API FMOD_System_SetStreamBufferSize (FMOD_SYSTEM *system, unsigned int filebuffersize, FMOD_TIMEUNIT filebuffersizetype); -FMOD_RESULT F_API FMOD_System_GetStreamBufferSize (FMOD_SYSTEM *system, unsigned int *filebuffersize, FMOD_TIMEUNIT *filebuffersizetype); - -/* - System information functions. -*/ - -FMOD_RESULT F_API FMOD_System_GetVersion (FMOD_SYSTEM *system, unsigned int *version); -FMOD_RESULT F_API FMOD_System_GetOutputHandle (FMOD_SYSTEM *system, void **handle); -FMOD_RESULT F_API FMOD_System_GetChannelsPlaying (FMOD_SYSTEM *system, int *channels); -FMOD_RESULT F_API FMOD_System_GetHardwareChannels (FMOD_SYSTEM *system, int *numhardwarechannels); -FMOD_RESULT F_API FMOD_System_GetCPUUsage (FMOD_SYSTEM *system, float *dsp, float *stream, float *geometry, float *update, float *total); -FMOD_RESULT F_API FMOD_System_GetSoundRAM (FMOD_SYSTEM *system, int *currentalloced, int *maxalloced, int *total); -FMOD_RESULT F_API FMOD_System_GetNumCDROMDrives (FMOD_SYSTEM *system, int *numdrives); -FMOD_RESULT F_API FMOD_System_GetCDROMDriveName (FMOD_SYSTEM *system, int drive, char *drivename, int drivenamelen, char *scsiname, int scsinamelen, char *devicename, int devicenamelen); -FMOD_RESULT F_API FMOD_System_GetSpectrum (FMOD_SYSTEM *system, float *spectrumarray, int numvalues, int channeloffset, FMOD_DSP_FFT_WINDOW windowtype); -FMOD_RESULT F_API FMOD_System_GetWaveData (FMOD_SYSTEM *system, float *wavearray, int numvalues, int channeloffset); - -/* - Sound/DSP/Channel/FX creation and retrieval. -*/ - -FMOD_RESULT F_API FMOD_System_CreateSound (FMOD_SYSTEM *system, const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_System_CreateStream (FMOD_SYSTEM *system, const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_System_CreateDSP (FMOD_SYSTEM *system, FMOD_DSP_DESCRIPTION *description, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_CreateDSPByType (FMOD_SYSTEM *system, FMOD_DSP_TYPE type, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_CreateChannelGroup (FMOD_SYSTEM *system, const char *name, FMOD_CHANNELGROUP **channelgroup); -FMOD_RESULT F_API FMOD_System_CreateSoundGroup (FMOD_SYSTEM *system, const char *name, FMOD_SOUNDGROUP **soundgroup); -FMOD_RESULT F_API FMOD_System_CreateReverb (FMOD_SYSTEM *system, FMOD_REVERB **reverb); - -FMOD_RESULT F_API FMOD_System_PlaySound (FMOD_SYSTEM *system, FMOD_CHANNELINDEX channelid, FMOD_SOUND *sound, FMOD_BOOL paused, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_System_PlayDSP (FMOD_SYSTEM *system, FMOD_CHANNELINDEX channelid, FMOD_DSP *dsp, FMOD_BOOL paused, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_System_GetChannel (FMOD_SYSTEM *system, int channelid, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_System_GetMasterChannelGroup (FMOD_SYSTEM *system, FMOD_CHANNELGROUP **channelgroup); -FMOD_RESULT F_API FMOD_System_GetMasterSoundGroup (FMOD_SYSTEM *system, FMOD_SOUNDGROUP **soundgroup); - -/* - Reverb API -*/ - -FMOD_RESULT F_API FMOD_System_SetReverbProperties (FMOD_SYSTEM *system, const FMOD_REVERB_PROPERTIES *prop); -FMOD_RESULT F_API FMOD_System_GetReverbProperties (FMOD_SYSTEM *system, FMOD_REVERB_PROPERTIES *prop); -FMOD_RESULT F_API FMOD_System_SetReverbAmbientProperties(FMOD_SYSTEM *system, FMOD_REVERB_PROPERTIES *prop); -FMOD_RESULT F_API FMOD_System_GetReverbAmbientProperties(FMOD_SYSTEM *system, FMOD_REVERB_PROPERTIES *prop); - -/* - System level DSP access. -*/ - -FMOD_RESULT F_API FMOD_System_GetDSPHead (FMOD_SYSTEM *system, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_AddDSP (FMOD_SYSTEM *system, FMOD_DSP *dsp, FMOD_DSPCONNECTION **connection); -FMOD_RESULT F_API FMOD_System_LockDSP (FMOD_SYSTEM *system); -FMOD_RESULT F_API FMOD_System_UnlockDSP (FMOD_SYSTEM *system); -FMOD_RESULT F_API FMOD_System_GetDSPClock (FMOD_SYSTEM *system, unsigned int *hi, unsigned int *lo); - -/* - Recording API. -*/ - -FMOD_RESULT F_API FMOD_System_GetRecordNumDrivers (FMOD_SYSTEM *system, int *numdrivers); -FMOD_RESULT F_API FMOD_System_GetRecordDriverInfo (FMOD_SYSTEM *system, int id, char *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetRecordDriverInfoW (FMOD_SYSTEM *system, int id, short *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetRecordDriverCaps (FMOD_SYSTEM *system, int id, FMOD_CAPS *caps, int *minfrequency, int *maxfrequency); -FMOD_RESULT F_API FMOD_System_GetRecordPosition (FMOD_SYSTEM *system, int id, unsigned int *position); - -FMOD_RESULT F_API FMOD_System_RecordStart (FMOD_SYSTEM *system, int id, FMOD_SOUND *sound, FMOD_BOOL loop); -FMOD_RESULT F_API FMOD_System_RecordStop (FMOD_SYSTEM *system, int id); -FMOD_RESULT F_API FMOD_System_IsRecording (FMOD_SYSTEM *system, int id, FMOD_BOOL *recording); - -/* - Geometry API. -*/ - -FMOD_RESULT F_API FMOD_System_CreateGeometry (FMOD_SYSTEM *system, int maxpolygons, int maxvertices, FMOD_GEOMETRY **geometry); -FMOD_RESULT F_API FMOD_System_SetGeometrySettings (FMOD_SYSTEM *system, float maxworldsize); -FMOD_RESULT F_API FMOD_System_GetGeometrySettings (FMOD_SYSTEM *system, float *maxworldsize); -FMOD_RESULT F_API FMOD_System_LoadGeometry (FMOD_SYSTEM *system, const void *data, int datasize, FMOD_GEOMETRY **geometry); -FMOD_RESULT F_API FMOD_System_GetGeometryOcclusion (FMOD_SYSTEM *system, const FMOD_VECTOR *listener, const FMOD_VECTOR *source, float *direct, float *reverb); - -/* - Network functions. -*/ - -FMOD_RESULT F_API FMOD_System_SetNetworkProxy (FMOD_SYSTEM *system, const char *proxy); -FMOD_RESULT F_API FMOD_System_GetNetworkProxy (FMOD_SYSTEM *system, char *proxy, int proxylen); -FMOD_RESULT F_API FMOD_System_SetNetworkTimeout (FMOD_SYSTEM *system, int timeout); -FMOD_RESULT F_API FMOD_System_GetNetworkTimeout (FMOD_SYSTEM *system, int *timeout); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_System_SetUserData (FMOD_SYSTEM *system, void *userdata); -FMOD_RESULT F_API FMOD_System_GetUserData (FMOD_SYSTEM *system, void **userdata); - -FMOD_RESULT F_API FMOD_System_GetMemoryInfo (FMOD_SYSTEM *system, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Sound' API -*/ - -FMOD_RESULT F_API FMOD_Sound_Release (FMOD_SOUND *sound); -FMOD_RESULT F_API FMOD_Sound_GetSystemObject (FMOD_SOUND *sound, FMOD_SYSTEM **system); - -/* - Standard sound manipulation functions. -*/ - -FMOD_RESULT F_API FMOD_Sound_Lock (FMOD_SOUND *sound, unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); -FMOD_RESULT F_API FMOD_Sound_Unlock (FMOD_SOUND *sound, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); -FMOD_RESULT F_API FMOD_Sound_SetDefaults (FMOD_SOUND *sound, float frequency, float volume, float pan, int priority); -FMOD_RESULT F_API FMOD_Sound_GetDefaults (FMOD_SOUND *sound, float *frequency, float *volume, float *pan, int *priority); -FMOD_RESULT F_API FMOD_Sound_SetVariations (FMOD_SOUND *sound, float frequencyvar, float volumevar, float panvar); -FMOD_RESULT F_API FMOD_Sound_GetVariations (FMOD_SOUND *sound, float *frequencyvar, float *volumevar, float *panvar); -FMOD_RESULT F_API FMOD_Sound_Set3DMinMaxDistance (FMOD_SOUND *sound, float min, float max); -FMOD_RESULT F_API FMOD_Sound_Get3DMinMaxDistance (FMOD_SOUND *sound, float *min, float *max); -FMOD_RESULT F_API FMOD_Sound_Set3DConeSettings (FMOD_SOUND *sound, float insideconeangle, float outsideconeangle, float outsidevolume); -FMOD_RESULT F_API FMOD_Sound_Get3DConeSettings (FMOD_SOUND *sound, float *insideconeangle, float *outsideconeangle, float *outsidevolume); -FMOD_RESULT F_API FMOD_Sound_Set3DCustomRolloff (FMOD_SOUND *sound, FMOD_VECTOR *points, int numpoints); -FMOD_RESULT F_API FMOD_Sound_Get3DCustomRolloff (FMOD_SOUND *sound, FMOD_VECTOR **points, int *numpoints); -FMOD_RESULT F_API FMOD_Sound_SetSubSound (FMOD_SOUND *sound, int index, FMOD_SOUND *subsound); -FMOD_RESULT F_API FMOD_Sound_GetSubSound (FMOD_SOUND *sound, int index, FMOD_SOUND **subsound); -FMOD_RESULT F_API FMOD_Sound_SetSubSoundSentence (FMOD_SOUND *sound, int *subsoundlist, int numsubsounds); -FMOD_RESULT F_API FMOD_Sound_GetName (FMOD_SOUND *sound, char *name, int namelen); -FMOD_RESULT F_API FMOD_Sound_GetLength (FMOD_SOUND *sound, unsigned int *length, FMOD_TIMEUNIT lengthtype); -FMOD_RESULT F_API FMOD_Sound_GetFormat (FMOD_SOUND *sound, FMOD_SOUND_TYPE *type, FMOD_SOUND_FORMAT *format, int *channels, int *bits); -FMOD_RESULT F_API FMOD_Sound_GetNumSubSounds (FMOD_SOUND *sound, int *numsubsounds); -FMOD_RESULT F_API FMOD_Sound_GetNumTags (FMOD_SOUND *sound, int *numtags, int *numtagsupdated); -FMOD_RESULT F_API FMOD_Sound_GetTag (FMOD_SOUND *sound, const char *name, int index, FMOD_TAG *tag); -FMOD_RESULT F_API FMOD_Sound_GetOpenState (FMOD_SOUND *sound, FMOD_OPENSTATE *openstate, unsigned int *percentbuffered, FMOD_BOOL *starving, FMOD_BOOL *diskbusy); -FMOD_RESULT F_API FMOD_Sound_ReadData (FMOD_SOUND *sound, void *buffer, unsigned int lenbytes, unsigned int *read); -FMOD_RESULT F_API FMOD_Sound_SeekData (FMOD_SOUND *sound, unsigned int pcm); - -FMOD_RESULT F_API FMOD_Sound_SetSoundGroup (FMOD_SOUND *sound, FMOD_SOUNDGROUP *soundgroup); -FMOD_RESULT F_API FMOD_Sound_GetSoundGroup (FMOD_SOUND *sound, FMOD_SOUNDGROUP **soundgroup); - -/* - Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks. -*/ - -FMOD_RESULT F_API FMOD_Sound_GetNumSyncPoints (FMOD_SOUND *sound, int *numsyncpoints); -FMOD_RESULT F_API FMOD_Sound_GetSyncPoint (FMOD_SOUND *sound, int index, FMOD_SYNCPOINT **point); -FMOD_RESULT F_API FMOD_Sound_GetSyncPointInfo (FMOD_SOUND *sound, FMOD_SYNCPOINT *point, char *name, int namelen, unsigned int *offset, FMOD_TIMEUNIT offsettype); -FMOD_RESULT F_API FMOD_Sound_AddSyncPoint (FMOD_SOUND *sound, unsigned int offset, FMOD_TIMEUNIT offsettype, const char *name, FMOD_SYNCPOINT **point); -FMOD_RESULT F_API FMOD_Sound_DeleteSyncPoint (FMOD_SOUND *sound, FMOD_SYNCPOINT *point); - -/* - Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time. -*/ - -FMOD_RESULT F_API FMOD_Sound_SetMode (FMOD_SOUND *sound, FMOD_MODE mode); -FMOD_RESULT F_API FMOD_Sound_GetMode (FMOD_SOUND *sound, FMOD_MODE *mode); -FMOD_RESULT F_API FMOD_Sound_SetLoopCount (FMOD_SOUND *sound, int loopcount); -FMOD_RESULT F_API FMOD_Sound_GetLoopCount (FMOD_SOUND *sound, int *loopcount); -FMOD_RESULT F_API FMOD_Sound_SetLoopPoints (FMOD_SOUND *sound, unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype); -FMOD_RESULT F_API FMOD_Sound_GetLoopPoints (FMOD_SOUND *sound, unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype); - -/* - For MOD/S3M/XM/IT/MID sequenced formats only. -*/ - -FMOD_RESULT F_API FMOD_Sound_GetMusicNumChannels (FMOD_SOUND *sound, int *numchannels); -FMOD_RESULT F_API FMOD_Sound_SetMusicChannelVolume (FMOD_SOUND *sound, int channel, float volume); -FMOD_RESULT F_API FMOD_Sound_GetMusicChannelVolume (FMOD_SOUND *sound, int channel, float *volume); -FMOD_RESULT F_API FMOD_Sound_SetMusicSpeed (FMOD_SOUND *sound, float speed); -FMOD_RESULT F_API FMOD_Sound_GetMusicSpeed (FMOD_SOUND *sound, float *speed); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Sound_SetUserData (FMOD_SOUND *sound, void *userdata); -FMOD_RESULT F_API FMOD_Sound_GetUserData (FMOD_SOUND *sound, void **userdata); - -FMOD_RESULT F_API FMOD_Sound_GetMemoryInfo (FMOD_SOUND *sound, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Channel' API -*/ - -FMOD_RESULT F_API FMOD_Channel_GetSystemObject (FMOD_CHANNEL *channel, FMOD_SYSTEM **system); - -FMOD_RESULT F_API FMOD_Channel_Stop (FMOD_CHANNEL *channel); -FMOD_RESULT F_API FMOD_Channel_SetPaused (FMOD_CHANNEL *channel, FMOD_BOOL paused); -FMOD_RESULT F_API FMOD_Channel_GetPaused (FMOD_CHANNEL *channel, FMOD_BOOL *paused); -FMOD_RESULT F_API FMOD_Channel_SetVolume (FMOD_CHANNEL *channel, float volume); -FMOD_RESULT F_API FMOD_Channel_GetVolume (FMOD_CHANNEL *channel, float *volume); -FMOD_RESULT F_API FMOD_Channel_SetFrequency (FMOD_CHANNEL *channel, float frequency); -FMOD_RESULT F_API FMOD_Channel_GetFrequency (FMOD_CHANNEL *channel, float *frequency); -FMOD_RESULT F_API FMOD_Channel_SetPan (FMOD_CHANNEL *channel, float pan); -FMOD_RESULT F_API FMOD_Channel_GetPan (FMOD_CHANNEL *channel, float *pan); -FMOD_RESULT F_API FMOD_Channel_SetDelay (FMOD_CHANNEL *channel, FMOD_DELAYTYPE delaytype, unsigned int delayhi, unsigned int delaylo); -FMOD_RESULT F_API FMOD_Channel_GetDelay (FMOD_CHANNEL *channel, FMOD_DELAYTYPE delaytype, unsigned int *delayhi, unsigned int *delaylo); -FMOD_RESULT F_API FMOD_Channel_SetSpeakerMix (FMOD_CHANNEL *channel, float frontleft, float frontright, float center, float lfe, float backleft, float backright, float sideleft, float sideright); -FMOD_RESULT F_API FMOD_Channel_GetSpeakerMix (FMOD_CHANNEL *channel, float *frontleft, float *frontright, float *center, float *lfe, float *backleft, float *backright, float *sideleft, float *sideright); -FMOD_RESULT F_API FMOD_Channel_SetSpeakerLevels (FMOD_CHANNEL *channel, FMOD_SPEAKER speaker, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_GetSpeakerLevels (FMOD_CHANNEL *channel, FMOD_SPEAKER speaker, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_SetInputChannelMix (FMOD_CHANNEL *channel, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_GetInputChannelMix (FMOD_CHANNEL *channel, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_SetMute (FMOD_CHANNEL *channel, FMOD_BOOL mute); -FMOD_RESULT F_API FMOD_Channel_GetMute (FMOD_CHANNEL *channel, FMOD_BOOL *mute); -FMOD_RESULT F_API FMOD_Channel_SetPriority (FMOD_CHANNEL *channel, int priority); -FMOD_RESULT F_API FMOD_Channel_GetPriority (FMOD_CHANNEL *channel, int *priority); -FMOD_RESULT F_API FMOD_Channel_SetPosition (FMOD_CHANNEL *channel, unsigned int position, FMOD_TIMEUNIT postype); -FMOD_RESULT F_API FMOD_Channel_GetPosition (FMOD_CHANNEL *channel, unsigned int *position, FMOD_TIMEUNIT postype); -FMOD_RESULT F_API FMOD_Channel_SetReverbProperties (FMOD_CHANNEL *channel, const FMOD_REVERB_CHANNELPROPERTIES *prop); -FMOD_RESULT F_API FMOD_Channel_GetReverbProperties (FMOD_CHANNEL *channel, FMOD_REVERB_CHANNELPROPERTIES *prop); -FMOD_RESULT F_API FMOD_Channel_SetLowPassGain (FMOD_CHANNEL *channel, float gain); -FMOD_RESULT F_API FMOD_Channel_GetLowPassGain (FMOD_CHANNEL *channel, float *gain); - -FMOD_RESULT F_API FMOD_Channel_SetChannelGroup (FMOD_CHANNEL *channel, FMOD_CHANNELGROUP *channelgroup); -FMOD_RESULT F_API FMOD_Channel_GetChannelGroup (FMOD_CHANNEL *channel, FMOD_CHANNELGROUP **channelgroup); -FMOD_RESULT F_API FMOD_Channel_SetCallback (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACK callback); - -/* - 3D functionality. -*/ - -FMOD_RESULT F_API FMOD_Channel_Set3DAttributes (FMOD_CHANNEL *channel, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel); -FMOD_RESULT F_API FMOD_Channel_Get3DAttributes (FMOD_CHANNEL *channel, FMOD_VECTOR *pos, FMOD_VECTOR *vel); -FMOD_RESULT F_API FMOD_Channel_Set3DMinMaxDistance (FMOD_CHANNEL *channel, float mindistance, float maxdistance); -FMOD_RESULT F_API FMOD_Channel_Get3DMinMaxDistance (FMOD_CHANNEL *channel, float *mindistance, float *maxdistance); -FMOD_RESULT F_API FMOD_Channel_Set3DConeSettings (FMOD_CHANNEL *channel, float insideconeangle, float outsideconeangle, float outsidevolume); -FMOD_RESULT F_API FMOD_Channel_Get3DConeSettings (FMOD_CHANNEL *channel, float *insideconeangle, float *outsideconeangle, float *outsidevolume); -FMOD_RESULT F_API FMOD_Channel_Set3DConeOrientation (FMOD_CHANNEL *channel, FMOD_VECTOR *orientation); -FMOD_RESULT F_API FMOD_Channel_Get3DConeOrientation (FMOD_CHANNEL *channel, FMOD_VECTOR *orientation); -FMOD_RESULT F_API FMOD_Channel_Set3DCustomRolloff (FMOD_CHANNEL *channel, FMOD_VECTOR *points, int numpoints); -FMOD_RESULT F_API FMOD_Channel_Get3DCustomRolloff (FMOD_CHANNEL *channel, FMOD_VECTOR **points, int *numpoints); -FMOD_RESULT F_API FMOD_Channel_Set3DOcclusion (FMOD_CHANNEL *channel, float directocclusion, float reverbocclusion); -FMOD_RESULT F_API FMOD_Channel_Get3DOcclusion (FMOD_CHANNEL *channel, float *directocclusion, float *reverbocclusion); -FMOD_RESULT F_API FMOD_Channel_Set3DSpread (FMOD_CHANNEL *channel, float angle); -FMOD_RESULT F_API FMOD_Channel_Get3DSpread (FMOD_CHANNEL *channel, float *angle); -FMOD_RESULT F_API FMOD_Channel_Set3DPanLevel (FMOD_CHANNEL *channel, float level); -FMOD_RESULT F_API FMOD_Channel_Get3DPanLevel (FMOD_CHANNEL *channel, float *level); -FMOD_RESULT F_API FMOD_Channel_Set3DDopplerLevel (FMOD_CHANNEL *channel, float level); -FMOD_RESULT F_API FMOD_Channel_Get3DDopplerLevel (FMOD_CHANNEL *channel, float *level); -FMOD_RESULT F_API FMOD_Channel_Set3DDistanceFilter (FMOD_CHANNEL *channel, FMOD_BOOL custom, float customLevel, float centerFreq); -FMOD_RESULT F_API FMOD_Channel_Get3DDistanceFilter (FMOD_CHANNEL *channel, FMOD_BOOL *custom, float *customLevel, float *centerFreq); - -/* - DSP functionality only for channels playing sounds created with FMOD_SOFTWARE. -*/ - -FMOD_RESULT F_API FMOD_Channel_GetDSPHead (FMOD_CHANNEL *channel, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_Channel_AddDSP (FMOD_CHANNEL *channel, FMOD_DSP *dsp, FMOD_DSPCONNECTION **connection); - -/* - Information only functions. -*/ - -FMOD_RESULT F_API FMOD_Channel_IsPlaying (FMOD_CHANNEL *channel, FMOD_BOOL *isplaying); -FMOD_RESULT F_API FMOD_Channel_IsVirtual (FMOD_CHANNEL *channel, FMOD_BOOL *isvirtual); -FMOD_RESULT F_API FMOD_Channel_GetAudibility (FMOD_CHANNEL *channel, float *audibility); -FMOD_RESULT F_API FMOD_Channel_GetCurrentSound (FMOD_CHANNEL *channel, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_Channel_GetSpectrum (FMOD_CHANNEL *channel, float *spectrumarray, int numvalues, int channeloffset, FMOD_DSP_FFT_WINDOW windowtype); -FMOD_RESULT F_API FMOD_Channel_GetWaveData (FMOD_CHANNEL *channel, float *wavearray, int numvalues, int channeloffset); -FMOD_RESULT F_API FMOD_Channel_GetIndex (FMOD_CHANNEL *channel, int *index); - -/* - Functions also found in Sound class but here they can be set per channel. -*/ - -FMOD_RESULT F_API FMOD_Channel_SetMode (FMOD_CHANNEL *channel, FMOD_MODE mode); -FMOD_RESULT F_API FMOD_Channel_GetMode (FMOD_CHANNEL *channel, FMOD_MODE *mode); -FMOD_RESULT F_API FMOD_Channel_SetLoopCount (FMOD_CHANNEL *channel, int loopcount); -FMOD_RESULT F_API FMOD_Channel_GetLoopCount (FMOD_CHANNEL *channel, int *loopcount); -FMOD_RESULT F_API FMOD_Channel_SetLoopPoints (FMOD_CHANNEL *channel, unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype); -FMOD_RESULT F_API FMOD_Channel_GetLoopPoints (FMOD_CHANNEL *channel, unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Channel_SetUserData (FMOD_CHANNEL *channel, void *userdata); -FMOD_RESULT F_API FMOD_Channel_GetUserData (FMOD_CHANNEL *channel, void **userdata); - -FMOD_RESULT F_API FMOD_Channel_GetMemoryInfo (FMOD_CHANNEL *channel, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'ChannelGroup' API -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_Release (FMOD_CHANNELGROUP *channelgroup); -FMOD_RESULT F_API FMOD_ChannelGroup_GetSystemObject (FMOD_CHANNELGROUP *channelgroup, FMOD_SYSTEM **system); - -/* - Channelgroup scale values. (changes attributes relative to the channels, doesn't overwrite them) -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_SetVolume (FMOD_CHANNELGROUP *channelgroup, float volume); -FMOD_RESULT F_API FMOD_ChannelGroup_GetVolume (FMOD_CHANNELGROUP *channelgroup, float *volume); -FMOD_RESULT F_API FMOD_ChannelGroup_SetPitch (FMOD_CHANNELGROUP *channelgroup, float pitch); -FMOD_RESULT F_API FMOD_ChannelGroup_GetPitch (FMOD_CHANNELGROUP *channelgroup, float *pitch); -FMOD_RESULT F_API FMOD_ChannelGroup_Set3DOcclusion (FMOD_CHANNELGROUP *channelgroup, float directocclusion, float reverbocclusion); -FMOD_RESULT F_API FMOD_ChannelGroup_Get3DOcclusion (FMOD_CHANNELGROUP *channelgroup, float *directocclusion, float *reverbocclusion); -FMOD_RESULT F_API FMOD_ChannelGroup_SetPaused (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL paused); -FMOD_RESULT F_API FMOD_ChannelGroup_GetPaused (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL *paused); -FMOD_RESULT F_API FMOD_ChannelGroup_SetMute (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL mute); -FMOD_RESULT F_API FMOD_ChannelGroup_GetMute (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL *mute); - -/* - Channelgroup override values. (recursively overwrites whatever settings the channels had) -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_Stop (FMOD_CHANNELGROUP *channelgroup); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideVolume (FMOD_CHANNELGROUP *channelgroup, float volume); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideFrequency(FMOD_CHANNELGROUP *channelgroup, float frequency); -FMOD_RESULT F_API FMOD_ChannelGroup_OverridePan (FMOD_CHANNELGROUP *channelgroup, float pan); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideReverbProperties(FMOD_CHANNELGROUP *channelgroup, const FMOD_REVERB_CHANNELPROPERTIES *prop); -FMOD_RESULT F_API FMOD_ChannelGroup_Override3DAttributes(FMOD_CHANNELGROUP *channelgroup, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideSpeakerMix(FMOD_CHANNELGROUP *channelgroup, float frontleft, float frontright, float center, float lfe, float backleft, float backright, float sideleft, float sideright); - -/* - Nested channel groups. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_AddGroup (FMOD_CHANNELGROUP *channelgroup, FMOD_CHANNELGROUP *group); -FMOD_RESULT F_API FMOD_ChannelGroup_GetNumGroups (FMOD_CHANNELGROUP *channelgroup, int *numgroups); -FMOD_RESULT F_API FMOD_ChannelGroup_GetGroup (FMOD_CHANNELGROUP *channelgroup, int index, FMOD_CHANNELGROUP **group); -FMOD_RESULT F_API FMOD_ChannelGroup_GetParentGroup (FMOD_CHANNELGROUP *channelgroup, FMOD_CHANNELGROUP **group); - -/* - DSP functionality only for channel groups playing sounds created with FMOD_SOFTWARE. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_GetDSPHead (FMOD_CHANNELGROUP *channelgroup, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_ChannelGroup_AddDSP (FMOD_CHANNELGROUP *channelgroup, FMOD_DSP *dsp, FMOD_DSPCONNECTION **connection); - -/* - Information only functions. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_GetName (FMOD_CHANNELGROUP *channelgroup, char *name, int namelen); -FMOD_RESULT F_API FMOD_ChannelGroup_GetNumChannels (FMOD_CHANNELGROUP *channelgroup, int *numchannels); -FMOD_RESULT F_API FMOD_ChannelGroup_GetChannel (FMOD_CHANNELGROUP *channelgroup, int index, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_ChannelGroup_GetSpectrum (FMOD_CHANNELGROUP *channelgroup, float *spectrumarray, int numvalues, int channeloffset, FMOD_DSP_FFT_WINDOW windowtype); -FMOD_RESULT F_API FMOD_ChannelGroup_GetWaveData (FMOD_CHANNELGROUP *channelgroup, float *wavearray, int numvalues, int channeloffset); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_SetUserData (FMOD_CHANNELGROUP *channelgroup, void *userdata); -FMOD_RESULT F_API FMOD_ChannelGroup_GetUserData (FMOD_CHANNELGROUP *channelgroup, void **userdata); - -FMOD_RESULT F_API FMOD_ChannelGroup_GetMemoryInfo (FMOD_CHANNELGROUP *channelgroup, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'SoundGroup' API -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_Release (FMOD_SOUNDGROUP *soundgroup); -FMOD_RESULT F_API FMOD_SoundGroup_GetSystemObject (FMOD_SOUNDGROUP *soundgroup, FMOD_SYSTEM **system); - -/* - SoundGroup control functions. -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_SetMaxAudible (FMOD_SOUNDGROUP *soundgroup, int maxaudible); -FMOD_RESULT F_API FMOD_SoundGroup_GetMaxAudible (FMOD_SOUNDGROUP *soundgroup, int *maxaudible); -FMOD_RESULT F_API FMOD_SoundGroup_SetMaxAudibleBehavior(FMOD_SOUNDGROUP *soundgroup, FMOD_SOUNDGROUP_BEHAVIOR behavior); -FMOD_RESULT F_API FMOD_SoundGroup_GetMaxAudibleBehavior(FMOD_SOUNDGROUP *soundgroup, FMOD_SOUNDGROUP_BEHAVIOR *behavior); -FMOD_RESULT F_API FMOD_SoundGroup_SetMuteFadeSpeed (FMOD_SOUNDGROUP *soundgroup, float speed); -FMOD_RESULT F_API FMOD_SoundGroup_GetMuteFadeSpeed (FMOD_SOUNDGROUP *soundgroup, float *speed); -FMOD_RESULT F_API FMOD_SoundGroup_SetVolume (FMOD_SOUNDGROUP *soundgroup, float volume); -FMOD_RESULT F_API FMOD_SoundGroup_GetVolume (FMOD_SOUNDGROUP *soundgroup, float *volume); -FMOD_RESULT F_API FMOD_SoundGroup_Stop (FMOD_SOUNDGROUP *soundgroup); - -/* - Information only functions. -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_GetName (FMOD_SOUNDGROUP *soundgroup, char *name, int namelen); -FMOD_RESULT F_API FMOD_SoundGroup_GetNumSounds (FMOD_SOUNDGROUP *soundgroup, int *numsounds); -FMOD_RESULT F_API FMOD_SoundGroup_GetSound (FMOD_SOUNDGROUP *soundgroup, int index, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_SoundGroup_GetNumPlaying (FMOD_SOUNDGROUP *soundgroup, int *numplaying); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_SetUserData (FMOD_SOUNDGROUP *soundgroup, void *userdata); -FMOD_RESULT F_API FMOD_SoundGroup_GetUserData (FMOD_SOUNDGROUP *soundgroup, void **userdata); - -FMOD_RESULT F_API FMOD_SoundGroup_GetMemoryInfo (FMOD_SOUNDGROUP *soundgroup, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'DSP' API -*/ - -FMOD_RESULT F_API FMOD_DSP_Release (FMOD_DSP *dsp); -FMOD_RESULT F_API FMOD_DSP_GetSystemObject (FMOD_DSP *dsp, FMOD_SYSTEM **system); - -/* - Connection / disconnection / input and output enumeration. -*/ - -FMOD_RESULT F_API FMOD_DSP_AddInput (FMOD_DSP *dsp, FMOD_DSP *target, FMOD_DSPCONNECTION **connection); -FMOD_RESULT F_API FMOD_DSP_DisconnectFrom (FMOD_DSP *dsp, FMOD_DSP *target); -FMOD_RESULT F_API FMOD_DSP_DisconnectAll (FMOD_DSP *dsp, FMOD_BOOL inputs, FMOD_BOOL outputs); -FMOD_RESULT F_API FMOD_DSP_Remove (FMOD_DSP *dsp); -FMOD_RESULT F_API FMOD_DSP_GetNumInputs (FMOD_DSP *dsp, int *numinputs); -FMOD_RESULT F_API FMOD_DSP_GetNumOutputs (FMOD_DSP *dsp, int *numoutputs); -FMOD_RESULT F_API FMOD_DSP_GetInput (FMOD_DSP *dsp, int index, FMOD_DSP **input, FMOD_DSPCONNECTION **inputconnection); -FMOD_RESULT F_API FMOD_DSP_GetOutput (FMOD_DSP *dsp, int index, FMOD_DSP **output, FMOD_DSPCONNECTION **outputconnection); - -/* - DSP unit control. -*/ - -FMOD_RESULT F_API FMOD_DSP_SetActive (FMOD_DSP *dsp, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_DSP_GetActive (FMOD_DSP *dsp, FMOD_BOOL *active); -FMOD_RESULT F_API FMOD_DSP_SetBypass (FMOD_DSP *dsp, FMOD_BOOL bypass); -FMOD_RESULT F_API FMOD_DSP_GetBypass (FMOD_DSP *dsp, FMOD_BOOL *bypass); -FMOD_RESULT F_API FMOD_DSP_SetSpeakerActive (FMOD_DSP *dsp, FMOD_SPEAKER speaker, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_DSP_GetSpeakerActive (FMOD_DSP *dsp, FMOD_SPEAKER speaker, FMOD_BOOL *active); -FMOD_RESULT F_API FMOD_DSP_Reset (FMOD_DSP *dsp); - -/* - DSP parameter control. -*/ - -FMOD_RESULT F_API FMOD_DSP_SetParameter (FMOD_DSP *dsp, int index, float value); -FMOD_RESULT F_API FMOD_DSP_GetParameter (FMOD_DSP *dsp, int index, float *value, char *valuestr, int valuestrlen); -FMOD_RESULT F_API FMOD_DSP_GetNumParameters (FMOD_DSP *dsp, int *numparams); -FMOD_RESULT F_API FMOD_DSP_GetParameterInfo (FMOD_DSP *dsp, int index, char *name, char *label, char *description, int descriptionlen, float *min, float *max); -FMOD_RESULT F_API FMOD_DSP_ShowConfigDialog (FMOD_DSP *dsp, void *hwnd, FMOD_BOOL show); - -/* - DSP attributes. -*/ - -FMOD_RESULT F_API FMOD_DSP_GetInfo (FMOD_DSP *dsp, char *name, unsigned int *version, int *channels, int *configwidth, int *configheight); -FMOD_RESULT F_API FMOD_DSP_GetType (FMOD_DSP *dsp, FMOD_DSP_TYPE *type); -FMOD_RESULT F_API FMOD_DSP_SetDefaults (FMOD_DSP *dsp, float frequency, float volume, float pan, int priority); -FMOD_RESULT F_API FMOD_DSP_GetDefaults (FMOD_DSP *dsp, float *frequency, float *volume, float *pan, int *priority); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_DSP_SetUserData (FMOD_DSP *dsp, void *userdata); -FMOD_RESULT F_API FMOD_DSP_GetUserData (FMOD_DSP *dsp, void **userdata); - -FMOD_RESULT F_API FMOD_DSP_GetMemoryInfo (FMOD_DSP *dsp, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'DSPConnection' API -*/ - -FMOD_RESULT F_API FMOD_DSPConnection_GetInput (FMOD_DSPCONNECTION *dspconnection, FMOD_DSP **input); -FMOD_RESULT F_API FMOD_DSPConnection_GetOutput (FMOD_DSPCONNECTION *dspconnection, FMOD_DSP **output); -FMOD_RESULT F_API FMOD_DSPConnection_SetMix (FMOD_DSPCONNECTION *dspconnection, float volume); -FMOD_RESULT F_API FMOD_DSPConnection_GetMix (FMOD_DSPCONNECTION *dspconnection, float *volume); -FMOD_RESULT F_API FMOD_DSPConnection_SetLevels (FMOD_DSPCONNECTION *dspconnection, FMOD_SPEAKER speaker, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_DSPConnection_GetLevels (FMOD_DSPCONNECTION *dspconnection, FMOD_SPEAKER speaker, float *levels, int numlevels); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_DSPConnection_SetUserData (FMOD_DSPCONNECTION *dspconnection, void *userdata); -FMOD_RESULT F_API FMOD_DSPConnection_GetUserData (FMOD_DSPCONNECTION *dspconnection, void **userdata); - -FMOD_RESULT F_API FMOD_DSPConnection_GetMemoryInfo (FMOD_DSPCONNECTION *dspconnection, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Geometry' API -*/ - -FMOD_RESULT F_API FMOD_Geometry_Release (FMOD_GEOMETRY *geometry); - -/* - Polygon manipulation. -*/ - -FMOD_RESULT F_API FMOD_Geometry_AddPolygon (FMOD_GEOMETRY *geometry, float directocclusion, float reverbocclusion, FMOD_BOOL doublesided, int numvertices, const FMOD_VECTOR *vertices, int *polygonindex); -FMOD_RESULT F_API FMOD_Geometry_GetNumPolygons (FMOD_GEOMETRY *geometry, int *numpolygons); -FMOD_RESULT F_API FMOD_Geometry_GetMaxPolygons (FMOD_GEOMETRY *geometry, int *maxpolygons, int *maxvertices); -FMOD_RESULT F_API FMOD_Geometry_GetPolygonNumVertices(FMOD_GEOMETRY *geometry, int index, int *numvertices); -FMOD_RESULT F_API FMOD_Geometry_SetPolygonVertex (FMOD_GEOMETRY *geometry, int index, int vertexindex, const FMOD_VECTOR *vertex); -FMOD_RESULT F_API FMOD_Geometry_GetPolygonVertex (FMOD_GEOMETRY *geometry, int index, int vertexindex, FMOD_VECTOR *vertex); -FMOD_RESULT F_API FMOD_Geometry_SetPolygonAttributes (FMOD_GEOMETRY *geometry, int index, float directocclusion, float reverbocclusion, FMOD_BOOL doublesided); -FMOD_RESULT F_API FMOD_Geometry_GetPolygonAttributes (FMOD_GEOMETRY *geometry, int index, float *directocclusion, float *reverbocclusion, FMOD_BOOL *doublesided); - -/* - Object manipulation. -*/ - -FMOD_RESULT F_API FMOD_Geometry_SetActive (FMOD_GEOMETRY *geometry, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_Geometry_GetActive (FMOD_GEOMETRY *geometry, FMOD_BOOL *active); -FMOD_RESULT F_API FMOD_Geometry_SetRotation (FMOD_GEOMETRY *geometry, const FMOD_VECTOR *forward, const FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_Geometry_GetRotation (FMOD_GEOMETRY *geometry, FMOD_VECTOR *forward, FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_Geometry_SetPosition (FMOD_GEOMETRY *geometry, const FMOD_VECTOR *position); -FMOD_RESULT F_API FMOD_Geometry_GetPosition (FMOD_GEOMETRY *geometry, FMOD_VECTOR *position); -FMOD_RESULT F_API FMOD_Geometry_SetScale (FMOD_GEOMETRY *geometry, const FMOD_VECTOR *scale); -FMOD_RESULT F_API FMOD_Geometry_GetScale (FMOD_GEOMETRY *geometry, FMOD_VECTOR *scale); -FMOD_RESULT F_API FMOD_Geometry_Save (FMOD_GEOMETRY *geometry, void *data, int *datasize); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Geometry_SetUserData (FMOD_GEOMETRY *geometry, void *userdata); -FMOD_RESULT F_API FMOD_Geometry_GetUserData (FMOD_GEOMETRY *geometry, void **userdata); - -FMOD_RESULT F_API FMOD_Geometry_GetMemoryInfo (FMOD_GEOMETRY *geometry, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Reverb' API -*/ - -FMOD_RESULT F_API FMOD_Reverb_Release (FMOD_REVERB *reverb); - -/* - Reverb manipulation. -*/ - -FMOD_RESULT F_API FMOD_Reverb_Set3DAttributes (FMOD_REVERB *reverb, const FMOD_VECTOR *position, float mindistance, float maxdistance); -FMOD_RESULT F_API FMOD_Reverb_Get3DAttributes (FMOD_REVERB *reverb, FMOD_VECTOR *position, float *mindistance, float *maxdistance); -FMOD_RESULT F_API FMOD_Reverb_SetProperties (FMOD_REVERB *reverb, const FMOD_REVERB_PROPERTIES *properties); -FMOD_RESULT F_API FMOD_Reverb_GetProperties (FMOD_REVERB *reverb, FMOD_REVERB_PROPERTIES *properties); -FMOD_RESULT F_API FMOD_Reverb_SetActive (FMOD_REVERB *reverb, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_Reverb_GetActive (FMOD_REVERB *reverb, FMOD_BOOL *active); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Reverb_SetUserData (FMOD_REVERB *reverb, void *userdata); -FMOD_RESULT F_API FMOD_Reverb_GetUserData (FMOD_REVERB *reverb, void **userdata); - -FMOD_RESULT F_API FMOD_Reverb_GetMemoryInfo (FMOD_REVERB *reverb, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/libs/fmodex/inc/fmod_codec.h b/libs/fmodex/inc/fmod_codec.h deleted file mode 100644 index 2e13eb69d..000000000 --- a/libs/fmodex/inc/fmod_codec.h +++ /dev/null @@ -1,159 +0,0 @@ -/* ==================================================================================================== */ -/* FMOD Ex - codec development header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you are wanting to develop your own file format plugin to use with */ -/* FMOD's codec system. With this header you can make your own fileformat plugin that FMOD */ -/* can register and use. See the documentation and examples on how to make a working plugin. */ -/* */ -/* ==================================================================================================== */ - -#ifndef _FMOD_CODEC_H -#define _FMOD_CODEC_H - -typedef struct FMOD_CODEC_STATE FMOD_CODEC_STATE; -typedef struct FMOD_CODEC_WAVEFORMAT FMOD_CODEC_WAVEFORMAT; - -/* - Codec callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_OPENCALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_MODE usermode, FMOD_CREATESOUNDEXINFO *userexinfo); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_CLOSECALLBACK) (FMOD_CODEC_STATE *codec_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_READCALLBACK) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int sizebytes, unsigned int *bytesread); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETLENGTHCALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *length, FMOD_TIMEUNIT lengthtype); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SETPOSITIONCALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, unsigned int position, FMOD_TIMEUNIT postype); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETPOSITIONCALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *position, FMOD_TIMEUNIT postype); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SOUNDCREATECALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, FMOD_SOUND *sound); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_METADATACALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETWAVEFORMAT) (FMOD_CODEC_STATE *codec_state, int index, FMOD_CODEC_WAVEFORMAT *waveformat); - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - When creating a codec, declare one of these and provide the relevant callbacks and name for FMOD to use when it opens and reads a file. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_CODEC_STATE -] -*/ -typedef struct FMOD_CODEC_DESCRIPTION -{ - const char *name; /* [in] Name of the codec. */ - unsigned int version; /* [in] Plugin writer's version number. */ - int defaultasstream; /* [in] Tells FMOD to open the file as a stream when calling System::createSound, and not a static sample. Should normally be 0 (FALSE), because generally the user wants to decode the file into memory when using System::createSound. Mainly used for formats that decode for a very long time, or could use large amounts of memory when decoded. Usually sequenced formats such as mod/s3m/xm/it/midi fall into this category. It is mainly to stop users that don't know what they're doing from getting FMOD_ERR_MEMORY returned from createSound when they should have in fact called System::createStream or used FMOD_CREATESTREAM in System::createSound. */ - FMOD_TIMEUNIT timeunits; /* [in] When setposition codec is called, only these time formats will be passed to the codec. Use bitwise OR to accumulate different types. */ - FMOD_CODEC_OPENCALLBACK open; /* [in] Open callback for the codec for when FMOD tries to open a sound using this codec. */ - FMOD_CODEC_CLOSECALLBACK close; /* [in] Close callback for the codec for when FMOD tries to close a sound using this codec. */ - FMOD_CODEC_READCALLBACK read; /* [in] Read callback for the codec for when FMOD tries to read some data from the file to the destination format (specified in the open callback). */ - FMOD_CODEC_GETLENGTHCALLBACK getlength; /* [in] Callback to return the length of the song in whatever format required when Sound::getLength is called. */ - FMOD_CODEC_SETPOSITIONCALLBACK setposition; /* [in] Seek callback for the codec for when FMOD tries to seek within the file with Channel::setPosition. */ - FMOD_CODEC_GETPOSITIONCALLBACK getposition; /* [in] Tell callback for the codec for when FMOD tries to get the current position within the with Channel::getPosition. */ - FMOD_CODEC_SOUNDCREATECALLBACK soundcreate; /* [in] Sound creation callback for the codec when FMOD finishes creating the sound. (So the codec can set more parameters for the related created sound, ie loop points/mode or 3D attributes etc). */ - FMOD_CODEC_GETWAVEFORMAT getwaveformat; /* [in] Callback to tell FMOD about the waveformat of a particular subsound. This is to save memory, rather than saving 1000 FMOD_CODEC_WAVEFORMAT structures in the codec, the codec might have a more optimal way of storing this information. */ -} FMOD_CODEC_DESCRIPTION; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Set these values marked 'in' to tell fmod what sort of sound to create. - The format, channels and frequency tell FMOD what sort of hardware buffer to create when you initialize your code. So if you wrote an MP3 codec that decoded to stereo 16bit integer PCM, you would specify FMOD_SOUND_FORMAT_PCM16, and channels would be equal to 2. - Members marked as 'out' are set by fmod. Do not modify these. Simply specify 0 for these values when declaring the structure, FMOD will fill in the values for you after creation with the correct function pointers. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - An FMOD file might be from disk, memory or network, however the file may be opened by the user. - - 'numsubsounds' should be 0 if the file is a normal single sound stream or sound. Examples of this would be .WAV, .WMA, .MP3, .AIFF. - 'numsubsounds' should be 1+ if the file is a container format, and does not contain wav data itself. Examples of these types would be CDDA (multiple CD tracks), FSB (contains multiple sounds), MIDI/MOD/S3M/XM/IT (contain instruments). - The arrays of format, channel, frequency, length and blockalign should point to arrays of information based on how many subsounds are in the format. If the number of subsounds is 0 then it should point to 1 of each attribute, the same as if the number of subsounds was 1. If subsounds was 100 for example, each pointer should point to an array of 100 of each attribute. - When a sound has 1 or more subsounds, you must play the individual sounds specified by first obtaining the subsound with Sound::getSubSound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_SOUND_FORMAT - FMOD_FILE_READCALLBACK - FMOD_FILE_SEEKCALLBACK - FMOD_CODEC_METADATACALLBACK - Sound::getSubSound - Sound::getNumSubSounds -] -*/ -struct FMOD_CODEC_WAVEFORMAT -{ - char name[256]; /* [in] Name of sound.*/ - FMOD_SOUND_FORMAT format; /* [in] Format for (decompressed) codec output, ie FMOD_SOUND_FORMAT_PCM8, FMOD_SOUND_FORMAT_PCM16.*/ - int channels; /* [in] Number of channels used by codec, ie mono = 1, stereo = 2. */ - int frequency; /* [in] Default frequency in hz of the codec, ie 44100. */ - unsigned int lengthbytes; /* [in] Length in bytes of the source data. */ - unsigned int lengthpcm; /* [in] Length in decompressed, PCM samples of the file, ie length in seconds * frequency. Used for Sound::getLength and for memory allocation of static decompressed sample data. */ - int blockalign; /* [in] Blockalign in decompressed, PCM samples of the optimal decode chunk size for this format. The codec read callback will be called in multiples of this value. */ - int loopstart; /* [in] Loopstart in decompressed, PCM samples of file. */ - int loopend; /* [in] Loopend in decompressed, PCM samples of file. */ - FMOD_MODE mode; /* [in] Mode to determine whether the sound should by default load as looping, non looping, 2d or 3d. */ - unsigned int channelmask; /* [in] Microsoft speaker channel mask, as defined for WAVEFORMATEXTENSIBLE and is found in ksmedia.h. Leave at 0 to play in natural speaker order. */ -}; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Codec plugin structure that is passed into each callback. - - Set these numsubsounds and waveformat members when called in FMOD_CODEC_OPENCALLBACK to tell fmod what sort of sound to create. - - The format, channels and frequency tell FMOD what sort of hardware buffer to create when you initialize your code. So if you wrote an MP3 codec that decoded to stereo 16bit integer PCM, you would specify FMOD_SOUND_FORMAT_PCM16, and channels would be equal to 2. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - An FMOD file might be from disk, memory or internet, however the file may be opened by the user. - - 'numsubsounds' should be 0 if the file is a normal single sound stream or sound. Examples of this would be .WAV, .WMA, .MP3, .AIFF. - 'numsubsounds' should be 1+ if the file is a container format, and does not contain wav data itself. Examples of these types would be CDDA (multiple CD tracks), FSB (contains multiple sounds), DLS (contain instruments). - The arrays of format, channel, frequency, length and blockalign should point to arrays of information based on how many subsounds are in the format. If the number of subsounds is 0 then it should point to 1 of each attribute, the same as if the number of subsounds was 1. If subsounds was 100 for example, each pointer should point to an array of 100 of each attribute. - When a sound has 1 or more subsounds, you must play the individual sounds specified by first obtaining the subsound with Sound::getSubSound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_SOUND_FORMAT - FMOD_FILE_READCALLBACK - FMOD_FILE_SEEKCALLBACK - FMOD_CODEC_METADATACALLBACK - Sound::getSubSound - Sound::getNumSubSounds -] -*/ -struct FMOD_CODEC_STATE -{ - int numsubsounds; /* [in] Number of 'subsounds' in this sound. Anything other than 0 makes it a 'container' format (ie CDDA/DLS/FSB etc which contain 1 or more su bsounds). For most normal, single sound codec such as WAV/AIFF/MP3, this should be 0 as they are not a container for subsounds, they are the sound by itself. */ - FMOD_CODEC_WAVEFORMAT *waveformat; /* [in] Pointer to an array of format structures containing information about each sample. Can be 0 or NULL if FMOD_CODEC_GETWAVEFORMAT callback is preferred. The number of entries here must equal the number of subsounds defined in the subsound parameter. If numsubsounds = 0 then there should be 1 instance of this structure. */ - void *plugindata; /* [in] Plugin writer created data the codec author wants to attach to this object. */ - - void *filehandle; /* [out] This will return an internal FMOD file handle to use with the callbacks provided. */ - unsigned int filesize; /* [out] This will contain the size of the file in bytes. */ - FMOD_FILE_READCALLBACK fileread; /* [out] This will return a callable FMOD file function to use from codec. */ - FMOD_FILE_SEEKCALLBACK fileseek; /* [out] This will return a callable FMOD file function to use from codec. */ - FMOD_CODEC_METADATACALLBACK metadata; /* [out] This will return a callable FMOD metadata function to use from codec. */ -}; - -#endif - - diff --git a/libs/fmodex/inc/fmod_dsp.h b/libs/fmodex/inc/fmod_dsp.h deleted file mode 100644 index 1c5e2a62b..000000000 --- a/libs/fmodex/inc/fmod_dsp.h +++ /dev/null @@ -1,743 +0,0 @@ -/* ========================================================================================== */ -/* FMOD Ex - DSP header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you are interested in delving deeper into the FMOD software mixing / */ -/* DSP engine. In this header you can find parameter structures for FMOD system reigstered */ -/* DSP effects and generators. */ -/* Also use this header if you are wanting to develop your own DSP plugin to use with FMOD's */ -/* dsp system. With this header you can make your own DSP plugin that FMOD can */ -/* register and use. See the documentation and examples on how to make a working plugin. */ -/* */ -/* ========================================================================================== */ - -#ifndef _FMOD_DSP_H -#define _FMOD_DSP_H - -typedef struct FMOD_DSP_STATE FMOD_DSP_STATE; - -/* - DSP callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_CREATECALLBACK) (FMOD_DSP_STATE *dsp_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_RELEASECALLBACK) (FMOD_DSP_STATE *dsp_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_RESETCALLBACK) (FMOD_DSP_STATE *dsp_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_READCALLBACK) (FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_SETPOSITIONCALLBACK)(FMOD_DSP_STATE *dsp_state, unsigned int pos); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_SETPARAMCALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float value); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_GETPARAMCALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float *value, char *valuestr); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_DIALOGCALLBACK) (FMOD_DSP_STATE *dsp_state, void *hwnd, int show); - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions can be used for creating FMOD defined special effects or DSP units. - - [REMARKS] - To get them to be active, first create the unit, then add it somewhere into the DSP network, either at the front of the network near the soundcard unit to affect the global output (by using System::getDSPHead), or on a single channel (using Channel::getDSPHead). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createDSPByType -] -*/ -typedef enum -{ - FMOD_DSP_TYPE_UNKNOWN, /* This unit was created via a non FMOD plugin so has an unknown purpose. */ - FMOD_DSP_TYPE_MIXER, /* This unit does nothing but take inputs and mix them together then feed the result to the soundcard unit. */ - FMOD_DSP_TYPE_OSCILLATOR, /* This unit generates sine/square/saw/triangle or noise tones. */ - FMOD_DSP_TYPE_LOWPASS, /* This unit filters sound using a high quality, resonant lowpass filter algorithm but consumes more CPU time. */ - FMOD_DSP_TYPE_ITLOWPASS, /* This unit filters sound using a resonant lowpass filter algorithm that is used in Impulse Tracker, but with limited cutoff range (0 to 8060hz). */ - FMOD_DSP_TYPE_HIGHPASS, /* This unit filters sound using a resonant highpass filter algorithm. */ - FMOD_DSP_TYPE_ECHO, /* This unit produces an echo on the sound and fades out at the desired rate. */ - FMOD_DSP_TYPE_FLANGE, /* This unit produces a flange effect on the sound. */ - FMOD_DSP_TYPE_DISTORTION, /* This unit distorts the sound. */ - FMOD_DSP_TYPE_NORMALIZE, /* This unit normalizes or amplifies the sound to a certain level. */ - FMOD_DSP_TYPE_PARAMEQ, /* This unit attenuates or amplifies a selected frequency range. */ - FMOD_DSP_TYPE_PITCHSHIFT, /* This unit bends the pitch of a sound without changing the speed of playback. */ - FMOD_DSP_TYPE_CHORUS, /* This unit produces a chorus effect on the sound. */ - FMOD_DSP_TYPE_VSTPLUGIN, /* This unit allows the use of Steinberg VST plugins */ - FMOD_DSP_TYPE_WINAMPPLUGIN, /* This unit allows the use of Nullsoft Winamp plugins */ - FMOD_DSP_TYPE_ITECHO, /* This unit produces an echo on the sound and fades out at the desired rate as is used in Impulse Tracker. */ - FMOD_DSP_TYPE_COMPRESSOR, /* This unit implements dynamic compression (linked multichannel, wideband) */ - FMOD_DSP_TYPE_SFXREVERB, /* This unit implements SFX reverb */ - FMOD_DSP_TYPE_LOWPASS_SIMPLE, /* This unit filters sound using a simple lowpass with no resonance, but has flexible cutoff and is fast. */ - FMOD_DSP_TYPE_DELAY, /* This unit produces different delays on individual channels of the sound. */ - FMOD_DSP_TYPE_TREMOLO, /* This unit produces a tremolo / chopper effect on the sound. */ - FMOD_DSP_TYPE_LADSPAPLUGIN, /* This unit allows the use of LADSPA standard plugins. */ - FMOD_DSP_TYPE_HIGHPASS_SIMPLE, /* This unit filters sound using a simple highpass with no resonance, but has flexible cutoff and is fast. */ - FMOD_DSP_TYPE_HARDWARE = 1000, /* Offset that platform specific FMOD_HARDWARE DSPs will start at. */ - FMOD_DSP_TYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DSP_TYPE; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure to define a parameter for a DSP unit. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createDSP - DSP::setParameter -] -*/ -typedef struct FMOD_DSP_PARAMETERDESC -{ - float min; /* [w] Minimum value of the parameter (ie 100.0). */ - float max; /* [w] Maximum value of the parameter (ie 22050.0). */ - float defaultval; /* [w] Default value of parameter. */ - char name[16]; /* [w] Name of the parameter to be displayed (ie "Cutoff frequency"). */ - char label[16]; /* [w] Short string to be put next to value to denote the unit type (ie "hz"). */ - const char *description; /* [w] Description of the parameter to be displayed as a help item / tooltip for this parameter. */ -} FMOD_DSP_PARAMETERDESC; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - When creating a DSP unit, declare one of these and provide the relevant callbacks and name for FMOD to use when it creates and uses a DSP unit of this type. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - There are 2 different ways to change a parameter in this architecture. - One is to use DSP::setParameter / DSP::getParameter. This is platform independant and is dynamic, so new unknown plugins can have their parameters enumerated and used. - The other is to use DSP::showConfigDialog. This is platform specific and requires a GUI, and will display a dialog box to configure the plugin. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createDSP - FMOD_DSP_STATE -] -*/ -typedef struct FMOD_DSP_DESCRIPTION -{ - char name[32]; /* [w] Name of the unit to be displayed in the network. */ - unsigned int version; /* [w] Plugin writer's version number. */ - int channels; /* [w] Number of channels. Use 0 to process whatever number of channels is currently in the network. >0 would be mostly used if the unit is a unit that only generates sound. */ - FMOD_DSP_CREATECALLBACK create; /* [w] Create callback. This is called when DSP unit is created. Can be null. */ - FMOD_DSP_RELEASECALLBACK release; /* [w] Release callback. This is called just before the unit is freed so the user can do any cleanup needed for the unit. Can be null. */ - FMOD_DSP_RESETCALLBACK reset; /* [w] Reset callback. This is called by the user to reset any history buffers that may need resetting for a filter, when it is to be used or re-used for the first time to its initial clean state. Use to avoid clicks or artifacts. */ - FMOD_DSP_READCALLBACK read; /* [w] Read callback. Processing is done here. Can be null. */ - FMOD_DSP_SETPOSITIONCALLBACK setposition; /* [w] Set position callback. This is called if the unit wants to update its position info but not process data, or reset a cursor position internally if it is reading data from a certain source. Can be null. */ - - int numparameters; /* [w] Number of parameters used in this filter. The user finds this with DSP::getNumParameters */ - FMOD_DSP_PARAMETERDESC *paramdesc; /* [w] Variable number of parameter structures. */ - FMOD_DSP_SETPARAMCALLBACK setparameter; /* [w] This is called when the user calls DSP::setParameter. Can be null. */ - FMOD_DSP_GETPARAMCALLBACK getparameter; /* [w] This is called when the user calls DSP::getParameter. Can be null. */ - FMOD_DSP_DIALOGCALLBACK config; /* [w] This is called when the user calls DSP::showConfigDialog. Can be used to display a dialog to configure the filter. Can be null. */ - int configwidth; /* [w] Width of config dialog graphic if there is one. 0 otherwise.*/ - int configheight; /* [w] Height of config dialog graphic if there is one. 0 otherwise.*/ - void *userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the DSP unit during creation. Access via DSP::getUserData. */ -} FMOD_DSP_DESCRIPTION; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - DSP plugin structure that is passed into each callback. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_DSP_DESCRIPTION -] -*/ -struct FMOD_DSP_STATE -{ - FMOD_DSP *instance; /* [r] Handle to the DSP hand the user created. Not to be modified. C++ users cast to FMOD::DSP to use. */ - void *plugindata; /* [w] Plugin writer created data the output author wants to attach to this object. */ - unsigned short speakermask; /* [w] Specifies which speakers the DSP effect is active on */ -}; - - -/* - =================================================================================================== - - FMOD built in effect parameters. - Use DSP::setParameter with these enums for the 'index' parameter. - - =================================================================================================== -*/ - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_OSCILLATOR filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_OSCILLATOR_TYPE, /* Waveform type. 0 = sine. 1 = square. 2 = sawup. 3 = sawdown. 4 = triangle. 5 = noise. */ - FMOD_DSP_OSCILLATOR_RATE /* Frequency of the sinewave in hz. 1.0 to 22000.0. Default = 220.0. */ -} FMOD_DSP_OSCILLATOR; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_LOWPASS filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_LOWPASS_CUTOFF, /* Lowpass cutoff frequency in hz. 10.0 to 22000.0. Default = 5000.0. */ - FMOD_DSP_LOWPASS_RESONANCE /* Lowpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ -} FMOD_DSP_LOWPASS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_ITLOWPASS filter. - This is different to the default FMOD_DSP_TYPE_ITLOWPASS filter in that it uses a different quality algorithm and is - the filter used to produce the correct sounding playback in .IT files. - FMOD Ex's .IT playback uses this filter. - - [REMARKS] - Note! This filter actually has a limited cutoff frequency below the specified maximum, due to its limited design, - so for a more open range filter use FMOD_DSP_LOWPASS or if you don't mind not having resonance, - FMOD_DSP_LOWPASS_SIMPLE. - The effective maximum cutoff is about 8060hz. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_ITLOWPASS_CUTOFF, /* Lowpass cutoff frequency in hz. 1.0 to 22000.0. Default = 5000.0/ */ - FMOD_DSP_ITLOWPASS_RESONANCE /* Lowpass resonance Q value. 0.0 to 127.0. Default = 1.0. */ -} FMOD_DSP_ITLOWPASS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_HIGHPASS filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_HIGHPASS_CUTOFF, /* Highpass cutoff frequency in hz. 1.0 to output 22000.0. Default = 5000.0. */ - FMOD_DSP_HIGHPASS_RESONANCE /* Highpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ -} FMOD_DSP_HIGHPASS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_ECHO filter. - - [REMARKS] - Note. Every time the delay is changed, the plugin re-allocates the echo buffer. This means the echo will dissapear at that time while it refills its new buffer. - Larger echo delays result in larger amounts of memory allocated. - - 'maxchannels' also dictates the amount of memory allocated. By default, the maxchannels value is 0. If FMOD is set to stereo, the echo unit will allocate enough memory for 2 channels. If it is 5.1, it will allocate enough memory for a 6 channel echo, etc. - If the echo effect is only ever applied to the global mix (ie it was added with System::addDSP), then 0 is the value to set as it will be enough to handle all speaker modes. - When the echo is added to a channel (ie Channel::addDSP) then the channel count that comes in could be anything from 1 to 8 possibly. It is only in this case where you might want to increase the channel count above the output's channel count. - If a channel echo is set to a lower number than the sound's channel count that is coming in, it will not echo the sound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_ECHO_DELAY, /* Echo delay in ms. 10 to 5000. Default = 500. */ - FMOD_DSP_ECHO_DECAYRATIO, /* Echo decay per delay. 0 to 1. 1.0 = No decay, 0.0 = total decay (ie simple 1 line delay). Default = 0.5. */ - FMOD_DSP_ECHO_MAXCHANNELS, /* Maximum channels supported. 0 to 16. 0 = same as fmod's default output polyphony, 1 = mono, 2 = stereo etc. See remarks for more. Default = 0. It is suggested to leave at 0! */ - FMOD_DSP_ECHO_DRYMIX, /* Volume of original signal to pass to output. 0.0 to 1.0. Default = 1.0. */ - FMOD_DSP_ECHO_WETMIX /* Volume of echo signal to pass to output. 0.0 to 1.0. Default = 1.0. */ -} FMOD_DSP_ECHO; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_DELAY filter. - - [REMARKS] - Note. Every time MaxDelay is changed, the plugin re-allocates the delay buffer. This means the delay will dissapear at that time while it refills its new buffer. - A larger MaxDelay results in larger amounts of memory allocated. - Channel delays above MaxDelay will be clipped to MaxDelay and the delay buffer will not be resized. - - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_DELAY_CH0, /* Channel #0 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH1, /* Channel #1 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH2, /* Channel #2 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH3, /* Channel #3 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH4, /* Channel #4 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH5, /* Channel #5 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH6, /* Channel #6 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH7, /* Channel #7 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH8, /* Channel #8 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH9, /* Channel #9 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH10, /* Channel #10 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH11, /* Channel #11 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH12, /* Channel #12 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH13, /* Channel #13 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH14, /* Channel #14 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH15, /* Channel #15 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_MAXDELAY /* Maximum delay in ms. 0 to 10000. Default = 10. */ -} FMOD_DSP_DELAY; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_FLANGE filter. - - [REMARKS] - Flange is an effect where the signal is played twice at the same time, and one copy slides back and forth creating a whooshing or flanging effect. - As there are 2 copies of the same signal, by default each signal is given 50% mix, so that the total is not louder than the original unaffected signal. - - Flange depth is a percentage of a 10ms shift from the original signal. Anything above 10ms is not considered flange because to the ear it begins to 'echo' so 10ms is the highest value possible. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_FLANGE_DRYMIX, /* Volume of original signal to pass to output. 0.0 to 1.0. Default = 0.45. */ - FMOD_DSP_FLANGE_WETMIX, /* Volume of flange signal to pass to output. 0.0 to 1.0. Default = 0.55. */ - FMOD_DSP_FLANGE_DEPTH, /* Flange depth (percentage of 40ms delay). 0.01 to 1.0. Default = 1.0. */ - FMOD_DSP_FLANGE_RATE /* Flange speed in hz. 0.0 to 20.0. Default = 0.1. */ -} FMOD_DSP_FLANGE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_TREMOLO filter. - - [REMARKS] - The tremolo effect varies the amplitude of a sound. Depending on the settings, this unit can produce a tremolo, chopper or auto-pan effect. - - The shape of the LFO (low freq. oscillator) can morphed between sine, triangle and sawtooth waves using the FMOD_DSP_TREMOLO_SHAPE and FMOD_DSP_TREMOLO_SKEW parameters. - FMOD_DSP_TREMOLO_DUTY and FMOD_DSP_TREMOLO_SQUARE are useful for a chopper-type effect where the first controls the on-time duration and second controls the flatness of the envelope. - FMOD_DSP_TREMOLO_SPREAD varies the LFO phase between channels to get an auto-pan effect. This works best with a sine shape LFO. - The LFO can be synchronized using the FMOD_DSP_TREMOLO_PHASE parameter which sets its instantaneous phase. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_TREMOLO_FREQUENCY, /* LFO frequency in Hz. 0.1 to 20. Default = 4. */ - FMOD_DSP_TREMOLO_DEPTH, /* Tremolo depth. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_SHAPE, /* LFO shape morph between triangle and sine. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_SKEW, /* Time-skewing of LFO cycle. -1 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_DUTY, /* LFO on-time. 0 to 1. Default = 0.5. */ - FMOD_DSP_TREMOLO_SQUARE, /* Flatness of the LFO shape. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_PHASE, /* Instantaneous LFO phase. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_SPREAD /* Rotation / auto-pan effect. -1 to 1. Default = 0. */ -} FMOD_DSP_TREMOLO; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_DISTORTION filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_DISTORTION_LEVEL /* Distortion value. 0.0 to 1.0. Default = 0.5. */ -} FMOD_DSP_DISTORTION; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_NORMALIZE filter. - - [REMARKS] - Normalize amplifies the sound based on the maximum peaks within the signal. - For example if the maximum peaks in the signal were 50% of the bandwidth, it would scale the whole sound by 2. - The lower threshold value makes the normalizer ignores peaks below a certain point, to avoid over-amplification if a loud signal suddenly came in, and also to avoid amplifying to maximum things like background hiss. - - Because FMOD is a realtime audio processor, it doesn't have the luxury of knowing the peak for the whole sound (ie it can't see into the future), so it has to process data as it comes in. - To avoid very sudden changes in volume level based on small samples of new data, fmod fades towards the desired amplification which makes for smooth gain control. The fadetime parameter can control this. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_NORMALIZE_FADETIME, /* Time to ramp the silence to full in ms. 0.0 to 20000.0. Default = 5000.0. */ - FMOD_DSP_NORMALIZE_THRESHHOLD, /* Lower volume range threshold to ignore. 0.0 to 1.0. Default = 0.1. Raise higher to stop amplification of very quiet signals. */ - FMOD_DSP_NORMALIZE_MAXAMP /* Maximum amplification allowed. 1.0 to 100000.0. Default = 20.0. 1.0 = no amplifaction, higher values allow more boost. */ -} FMOD_DSP_NORMALIZE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_PARAMEQ filter. - - [REMARKS] - Parametric EQ is a bandpass filter that attenuates or amplifies a selected frequency and its neighbouring frequencies. - - To create a multi-band EQ create multiple FMOD_DSP_TYPE_PARAMEQ units and set each unit to different frequencies, for example 1000hz, 2000hz, 4000hz, 8000hz, 16000hz with a range of 1 octave each. - - When a frequency has its gain set to 1.0, the sound will be unaffected and represents the original signal exactly. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_PARAMEQ_CENTER, /* Frequency center. 20.0 to 22000.0. Default = 8000.0. */ - FMOD_DSP_PARAMEQ_BANDWIDTH, /* Octave range around the center frequency to filter. 0.2 to 5.0. Default = 1.0. */ - FMOD_DSP_PARAMEQ_GAIN /* Frequency Gain. 0.05 to 3.0. Default = 1.0. */ -} FMOD_DSP_PARAMEQ; - - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_PITCHSHIFT filter. - - [REMARKS] - This pitch shifting unit can be used to change the pitch of a sound without speeding it up or slowing it down. - It can also be used for time stretching or scaling, for example if the pitch was doubled, and the frequency of the sound was halved, the pitch of the sound would sound correct but it would be twice as slow. - - Warning! This filter is very computationally expensive! Similar to a vocoder, it requires several overlapping FFT and IFFT's to produce smooth output, and can require around 440mhz for 1 stereo 48khz signal using the default settings. - Reducing the signal to mono will half the cpu usage. - Reducing this will lower audio quality, but what settings to use are largely dependant on the sound being played. A noisy polyphonic signal will need higher fft size compared to a speaking voice for example. - - This pitch shifter is based on the pitch shifter code at http://www.dspdimension.com, written by Stephan M. Bernsee. - The original code is COPYRIGHT 1999-2003 Stephan M. Bernsee . - - 'maxchannels' dictates the amount of memory allocated. By default, the maxchannels value is 0. If FMOD is set to stereo, the pitch shift unit will allocate enough memory for 2 channels. If it is 5.1, it will allocate enough memory for a 6 channel pitch shift, etc. - If the pitch shift effect is only ever applied to the global mix (ie it was added with System::addDSP), then 0 is the value to set as it will be enough to handle all speaker modes. - When the pitch shift is added to a channel (ie Channel::addDSP) then the channel count that comes in could be anything from 1 to 8 possibly. It is only in this case where you might want to increase the channel count above the output's channel count. - If a channel pitch shift is set to a lower number than the sound's channel count that is coming in, it will not pitch shift the sound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_PITCHSHIFT_PITCH, /* Pitch value. 0.5 to 2.0. Default = 1.0. 0.5 = one octave down, 2.0 = one octave up. 1.0 does not change the pitch. */ - FMOD_DSP_PITCHSHIFT_FFTSIZE, /* FFT window size. 256, 512, 1024, 2048, 4096. Default = 1024. Increase this to reduce 'smearing'. This effect is a warbling sound similar to when an mp3 is encoded at very low bitrates. */ - FMOD_DSP_PITCHSHIFT_OVERLAP, /* Removed. Do not use. FMOD now uses 4 overlaps and cannot be changed. */ - FMOD_DSP_PITCHSHIFT_MAXCHANNELS /* Maximum channels supported. 0 to 16. 0 = same as fmod's default output polyphony, 1 = mono, 2 = stereo etc. See remarks for more. Default = 0. It is suggested to leave at 0! */ -} FMOD_DSP_PITCHSHIFT; - - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_CHORUS filter. - - [REMARKS] - Chrous is an effect where the sound is more 'spacious' due to 1 to 3 versions of the sound being played along side the original signal but with the pitch of each copy modulating on a sine wave. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_CHORUS_DRYMIX, /* Volume of original signal to pass to output. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_WETMIX1, /* Volume of 1st chorus tap. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_WETMIX2, /* Volume of 2nd chorus tap. This tap is 90 degrees out of phase of the first tap. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_WETMIX3, /* Volume of 3rd chorus tap. This tap is 90 degrees out of phase of the second tap. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_DELAY, /* Chorus delay in ms. 0.1 to 100.0. Default = 40.0 ms. */ - FMOD_DSP_CHORUS_RATE, /* Chorus modulation rate in hz. 0.0 to 20.0. Default = 0.8 hz. */ - FMOD_DSP_CHORUS_DEPTH /* Chorus modulation depth. 0.0 to 1.0. Default = 0.03. */ -} FMOD_DSP_CHORUS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_ITECHO filter. - This is effectively a software based echo filter that emulates the DirectX DMO echo effect. Impulse tracker files can support this, and FMOD will produce the effect on ANY platform, not just those that support DirectX effects! - - [REMARKS] - Note. Every time the delay is changed, the plugin re-allocates the echo buffer. This means the echo will dissapear at that time while it refills its new buffer. - Larger echo delays result in larger amounts of memory allocated. - - As this is a stereo filter made mainly for IT playback, it is targeted for stereo signals. - With mono signals only the FMOD_DSP_ITECHO_LEFTDELAY is used. - For multichannel signals (>2) there will be no echo on those channels. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::SetParameter - DSP::GetParameter - FMOD_DSP_TYPE - System::addDSP -] -*/ -typedef enum -{ - FMOD_DSP_ITECHO_WETDRYMIX, /* Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0.0 through 100.0 (all wet). The default value is 50. */ - FMOD_DSP_ITECHO_FEEDBACK, /* Percentage of output fed back into input, in the range from 0.0 through 100.0. The default value is 50. */ - FMOD_DSP_ITECHO_LEFTDELAY, /* Delay for left channel, in milliseconds, in the range from 1.0 through 2000.0. The default value is 500 ms. */ - FMOD_DSP_ITECHO_RIGHTDELAY, /* Delay for right channel, in milliseconds, in the range from 1.0 through 2000.0. The default value is 500 ms. */ - FMOD_DSP_ITECHO_PANDELAY /* Value that specifies whether to swap left and right delays with each successive echo. The default value is zero, meaning no swap. Possible values are defined as 0.0 (equivalent to FALSE) and 1.0 (equivalent to TRUE). CURRENTLY NOT SUPPORTED. */ -} FMOD_DSP_ITECHO; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_COMPRESSOR unit. - This is a simple linked multichannel software limiter that is uniform across the whole spectrum. - - [REMARKS] - The limiter is not guaranteed to catch every peak above the threshold level, - because it cannot apply gain reduction instantaneously - the time delay is - determined by the attack time. However setting the attack time too short will - distort the sound, so it is a compromise. High level peaks can be avoided by - using a short attack time - but not too short, and setting the threshold a few - decibels below the critical level. - - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::SetParameter - DSP::GetParameter - FMOD_DSP_TYPE - System::addDSP -] -*/ -typedef enum -{ - FMOD_DSP_COMPRESSOR_THRESHOLD, /* Threshold level (dB) in the range from -60 through 0. The default value is 0. */ - FMOD_DSP_COMPRESSOR_ATTACK, /* Gain reduction attack time (milliseconds), in the range from 10 through 200. The default value is 50. */ - FMOD_DSP_COMPRESSOR_RELEASE, /* Gain reduction release time (milliseconds), in the range from 20 through 1000. The default value is 50. */ - FMOD_DSP_COMPRESSOR_GAINMAKEUP /* Make-up gain (dB) applied after limiting, in the range from 0 through 30. The default value is 0. */ -} FMOD_DSP_COMPRESSOR; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_SFXREVERB unit. - - [REMARKS] - This is a high quality I3DL2 based reverb. - On top of the I3DL2 property set, "Dry Level" is also included to allow the dry mix to be changed. - - These properties can be set with presets in FMOD_REVERB_PRESETS. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::SetParameter - DSP::GetParameter - FMOD_DSP_TYPE - System::addDSP - FMOD_REVERB_PRESETS -] -*/ -typedef enum -{ - FMOD_DSP_SFXREVERB_DRYLEVEL, /* Dry Level : Mix level of dry signal in output in mB. Ranges from -10000.0 to 0.0. Default is 0. */ - FMOD_DSP_SFXREVERB_ROOM, /* Room : Room effect level at low frequencies in mB. Ranges from -10000.0 to 0.0. Default is -10000.0. */ - FMOD_DSP_SFXREVERB_ROOMHF, /* Room HF : Room effect high-frequency level re. low frequency level in mB. Ranges from -10000.0 to 0.0. Default is 0.0. */ - FMOD_DSP_SFXREVERB_DECAYTIME, /* Decay Time : Reverberation decay time at low-frequencies in seconds. Ranges from 0.1 to 20.0. Default is 1.0. */ - FMOD_DSP_SFXREVERB_DECAYHFRATIO, /* Decay HF Ratio : High-frequency to low-frequency decay time ratio. Ranges from 0.1 to 2.0. Default is 0.5. */ - FMOD_DSP_SFXREVERB_REFLECTIONSLEVEL, /* Reflections : Early reflections level relative to room effect in mB. Ranges from -10000.0 to 1000.0. Default is -10000.0. */ - FMOD_DSP_SFXREVERB_REFLECTIONSDELAY, /* Reflect Delay : Delay time of first reflection in seconds. Ranges from 0.0 to 0.3. Default is 0.02. */ - FMOD_DSP_SFXREVERB_REVERBLEVEL, /* Reverb : Late reverberation level relative to room effect in mB. Ranges from -10000.0 to 2000.0. Default is 0.0. */ - FMOD_DSP_SFXREVERB_REVERBDELAY, /* Reverb Delay : Late reverberation delay time relative to first reflection in seconds. Ranges from 0.0 to 0.1. Default is 0.04. */ - FMOD_DSP_SFXREVERB_DIFFUSION, /* Diffusion : Reverberation diffusion (echo density) in percent. Ranges from 0.0 to 100.0. Default is 100.0. */ - FMOD_DSP_SFXREVERB_DENSITY, /* Density : Reverberation density (modal density) in percent. Ranges from 0.0 to 100.0. Default is 100.0. */ - FMOD_DSP_SFXREVERB_HFREFERENCE, /* HF Reference : Reference high frequency in Hz. Ranges from 20.0 to 20000.0. Default is 5000.0. */ - FMOD_DSP_SFXREVERB_ROOMLF, /* Room LF : Room effect low-frequency level in mB. Ranges from -10000.0 to 0.0. Default is 0.0. */ - FMOD_DSP_SFXREVERB_LFREFERENCE /* LF Reference : Reference low-frequency in Hz. Ranges from 20.0 to 1000.0. Default is 250.0. */ -} FMOD_DSP_SFXREVERB; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_LOWPASS_SIMPLE filter. - This is a very simple low pass filter, based on two single-pole RC time-constant modules. - The emphasis is on speed rather than accuracy, so this should not be used for task requiring critical filtering. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_LOWPASS_SIMPLE_CUTOFF /* Lowpass cutoff frequency in hz. 10.0 to 22000.0. Default = 5000.0 */ -} FMOD_DSP_LOWPASS_SIMPLE; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_HIGHPASS_SIMPLE filter. - This is a very simple single-order high pass filter. - The emphasis is on speed rather than accuracy, so this should not be used for task requiring critical filtering. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_HIGHPASS_SIMPLE_CUTOFF /* Highpass cutoff frequency in hz. 10.0 to 22000.0. Default = 1000.0 */ -} FMOD_DSP_HIGHPASS_SIMPLE; - -#endif - diff --git a/libs/fmodex/inc/fmod_errors.h b/libs/fmodex/inc/fmod_errors.h deleted file mode 100644 index fdb85984b..000000000 --- a/libs/fmodex/inc/fmod_errors.h +++ /dev/null @@ -1,123 +0,0 @@ - -/* ============================================================================================== */ -/* FMOD Ex - Error string header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you want to store or display a string version / english explanation of */ -/* the FMOD error codes. */ -/* */ -/* ============================================================================================== */ - -#ifndef _FMOD_ERRORS_H -#define _FMOD_ERRORS_H - -#include "fmod.h" - -#ifdef __GNUC__ -static const char *FMOD_ErrorString(FMOD_RESULT errcode) __attribute__((unused)); -#endif - -static const char *FMOD_ErrorString(FMOD_RESULT errcode) -{ - switch (errcode) - { - case FMOD_ERR_ALREADYLOCKED: return "Tried to call lock a second time before unlock was called. "; - case FMOD_ERR_BADCOMMAND: return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound). "; - case FMOD_ERR_CDDA_DRIVERS: return "Neither NTSCSI nor ASPI could be initialised. "; - case FMOD_ERR_CDDA_INIT: return "An error occurred while initialising the CDDA subsystem. "; - case FMOD_ERR_CDDA_INVALID_DEVICE: return "Couldn't find the specified device. "; - case FMOD_ERR_CDDA_NOAUDIO: return "No audio tracks on the specified disc. "; - case FMOD_ERR_CDDA_NODEVICES: return "No CD/DVD devices were found. "; - case FMOD_ERR_CDDA_NODISC: return "No disc present in the specified drive. "; - case FMOD_ERR_CDDA_READ: return "A CDDA read error occurred. "; - case FMOD_ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel. "; - case FMOD_ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound. "; - case FMOD_ERR_COM: return "A Win32 COM related error occured. COM failed to initialize or a QueryInterface failed meaning a Windows codec or driver was not installed properly. "; - case FMOD_ERR_DMA: return "DMA Failure. See debug output for more information. "; - case FMOD_ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependancy. Or tried to connect a tree too many units deep (more than 128). "; - case FMOD_ERR_DSP_FORMAT: return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format. "; - case FMOD_ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified. "; - case FMOD_ERR_DSP_RUNNING: return "DSP error. Cannot perform this operation while the network is in the middle of running. This will most likely happen if a connection or disconnection is attempted in a DSP callback. "; - case FMOD_ERR_DSP_TOOMANYCONNECTIONS: return "DSP connection error. The unit being connected to or disconnected should only have 1 input or output. "; - case FMOD_ERR_EVENT_ALREADY_LOADED: return "The specified project or bank has already been loaded. Having multiple copies of the same project loaded simultaneously is forbidden. "; - case FMOD_ERR_EVENT_FAILED: return "An Event failed to be retrieved, most likely due to 'just fail' being specified as the max playbacks behavior. "; - case FMOD_ERR_EVENT_GUIDCONFLICT: return "An event with the same GUID already exists. "; - case FMOD_ERR_EVENT_INFOONLY: return "Can't execute this command on an EVENT_INFOONLY event. "; - case FMOD_ERR_EVENT_INTERNAL: return "An error occured that wasn't supposed to. See debug log for reason. "; - case FMOD_ERR_EVENT_MAXSTREAMS: return "Event failed because 'Max streams' was hit when FMOD_EVENT_INIT_FAIL_ON_MAXSTREAMS was specified. "; - case FMOD_ERR_EVENT_MISMATCH: return "FSB mismatches the FEV it was compiled with, the stream/sample mode it was meant to be created with was different, or the FEV was built for a different platform. "; - case FMOD_ERR_EVENT_NAMECONFLICT: return "A category with the same name already exists. "; - case FMOD_ERR_EVENT_NEEDSSIMPLE: return "Tried to call a function on a complex event that's only supported by simple events. "; - case FMOD_ERR_EVENT_NOTFOUND: return "The requested event, event group, event category or event property could not be found. "; - case FMOD_ERR_FILE_BAD: return "Error loading file. "; - case FMOD_ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format. "; - case FMOD_ERR_FILE_DISKEJECTED: return "Media was ejected while reading. "; - case FMOD_ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated data?). "; - case FMOD_ERR_FILE_NOTFOUND: return "File not found. "; - case FMOD_ERR_FILE_UNWANTED: return "Unwanted file access occured. "; - case FMOD_ERR_FORMAT: return "Unsupported file or audio format. "; - case FMOD_ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere. "; - case FMOD_ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden. "; - case FMOD_ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource. "; - case FMOD_ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred. "; - case FMOD_ERR_HTTP_TIMEOUT: return "The HTTP request timed out. "; - case FMOD_ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function. "; - case FMOD_ERR_INITIALIZED: return "Cannot call this command after System::init. "; - case FMOD_ERR_INTERNAL: return "An error occured that wasn't supposed to. Contact support. "; - case FMOD_ERR_INVALID_ADDRESS: return "On Xbox 360, this memory address passed to FMOD must be physical, (ie allocated with XPhysicalAlloc.) "; - case FMOD_ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float. "; - case FMOD_ERR_INVALID_HANDLE: return "An invalid object handle was used. "; - case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function. "; - case FMOD_ERR_INVALID_POSITION: return "An invalid seek position was passed to this function. "; - case FMOD_ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode. "; - case FMOD_ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle. "; - case FMOD_ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular. "; - case FMOD_ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup. "; - case FMOD_ERR_MEMORY: return "Not enough memory or resources. "; - case FMOD_ERR_MEMORY_CANTPOINT: return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used. "; - case FMOD_ERR_MEMORY_SRAM: return "Not enough memory or resources on console sound ram. "; - case FMOD_ERR_MUSIC_NOCALLBACK: return "The music callback is required, but it has not been set. "; - case FMOD_ERR_MUSIC_NOTFOUND: return "The requested music entity could not be found. "; - case FMOD_ERR_MUSIC_UNINITIALIZED: return "Music system is not initialized probably because no music data is loaded. "; - case FMOD_ERR_NEEDS2D: return "Tried to call a command on a 3d sound when the command was meant for 2d sound. "; - case FMOD_ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound. "; - case FMOD_ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support. (ie trying to play a GCADPCM compressed sound in software on Wii). "; - case FMOD_ERR_NEEDSSOFTWARE: return "Tried to use a feature that requires the software engine. Software engine has either been turned off, or command was executed on a hardware channel which does not support this feature. "; - case FMOD_ERR_NET_CONNECT: return "Couldn't connect to the specified host. "; - case FMOD_ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere. "; - case FMOD_ERR_NET_URL: return "The specified URL couldn't be resolved. "; - case FMOD_ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately. "; - case FMOD_ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready. "; - case FMOD_ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused. "; - case FMOD_ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer. "; - case FMOD_ERR_OUTPUT_DRIVERCALL: return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted. "; - case FMOD_ERR_OUTPUT_ENUMERATION: return "Error enumerating the available driver list. List may be inconsistent due to a recent device addition or removal. "; - case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the minimum features needed for this soundsystem (16bit stereo output). "; - case FMOD_ERR_OUTPUT_INIT: return "Error initializing output device. "; - case FMOD_ERR_OUTPUT_NOHARDWARE: return "FMOD_HARDWARE was specified but the sound card does not have the resources necessary to play it. "; - case FMOD_ERR_OUTPUT_NOSOFTWARE: return "Attempted to create a software sound but no software channels were specified in System::init. "; - case FMOD_ERR_PAN: return "Panning only works with mono or stereo sound sources. "; - case FMOD_ERR_PLUGIN: return "An unspecified error has been returned from a 3rd party plugin. "; - case FMOD_ERR_PLUGIN_INSTANCES: return "The number of allowed instances of a plugin has been exceeded. "; - case FMOD_ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available. "; - case FMOD_ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback or other DLLs that it needs to load) "; - case FMOD_ERR_PRELOADED: return "The specified sound is still in use by the event system, call EventSystem::unloadFSB before trying to release it. "; - case FMOD_ERR_PROGRAMMERSOUND: return "The specified sound is still in use by the event system, wait for the event which is using it finish with it. "; - case FMOD_ERR_RECORD: return "An error occured trying to initialize the recording device. "; - case FMOD_ERR_REVERB_INSTANCE: return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesnt exist. "; - case FMOD_ERR_SUBSOUNDS: return "The error occured because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound, or a parent sound was played without setting up a sentence first. "; - case FMOD_ERR_SUBSOUND_ALLOCATED: return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first. "; - case FMOD_ERR_SUBSOUND_CANTMOVE: return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file. "; - case FMOD_ERR_SUBSOUND_MODE: return "The subsound's mode bits do not match with the parent sound's mode bits. See documentation for function that it was called with. "; - case FMOD_ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags. "; - case FMOD_ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the maxinputchannels parameter in System::setSoftwareFormat. "; - case FMOD_ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be! contact support! "; - case FMOD_ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called. "; - case FMOD_ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. "; - case FMOD_ERR_UPDATE: return "An error caused by System::update occured. "; - case FMOD_ERR_VERSION: return "The version number of this file format is not supported. "; - case FMOD_OK: return "No errors."; - default : return "Unknown error."; - }; -} - -#endif diff --git a/libs/fmodex/inc/fmod_memoryinfo.h b/libs/fmodex/inc/fmod_memoryinfo.h deleted file mode 100644 index 6db9de3b8..000000000 --- a/libs/fmodex/inc/fmod_memoryinfo.h +++ /dev/null @@ -1,201 +0,0 @@ -/* ============================================================================================= */ -/* FMOD Ex - Memory info header file. Copyright (c), Firelight Technologies Pty, Ltd. 2008-2011. */ -/* */ -/* Use this header if you are interested in getting detailed information on FMOD's memory */ -/* usage. See the documentation for more details. */ -/* */ -/* ============================================================================================= */ - -#ifndef _FMOD_MEMORYINFO_H -#define _FMOD_MEMORYINFO_H - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure to be filled with detailed memory usage information of an FMOD object - - [REMARKS] - Every public FMOD class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question. - On return from getMemoryInfo, each member of this structure will hold the amount of memory used for its type in bytes. - - Members marked with [in] mean the user sets the value before passing it to the function. - Members marked with [out] mean FMOD sets the value to be used after the function exits. - - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getMemoryInfo - EventSystem::getMemoryInfo - FMOD_MEMBITS - FMOD_EVENT_MEMBITS -] -*/ -typedef struct FMOD_MEMORY_USAGE_DETAILS -{ - unsigned int other; /* [out] Memory not accounted for by other types */ - unsigned int string; /* [out] String data */ - unsigned int system; /* [out] System object and various internals */ - unsigned int plugins; /* [out] Plugin objects and internals */ - unsigned int output; /* [out] Output module object and internals */ - unsigned int channel; /* [out] Channel related memory */ - unsigned int channelgroup; /* [out] ChannelGroup objects and internals */ - unsigned int codec; /* [out] Codecs allocated for streaming */ - unsigned int file; /* [out] File buffers and structures */ - unsigned int sound; /* [out] Sound objects and internals */ - unsigned int secondaryram; /* [out] Sound data stored in secondary RAM */ - unsigned int soundgroup; /* [out] SoundGroup objects and internals */ - unsigned int streambuffer; /* [out] Stream buffer memory */ - unsigned int dspconnection; /* [out] DSPConnection objects and internals */ - unsigned int dsp; /* [out] DSP implementation objects */ - unsigned int dspcodec; /* [out] Realtime file format decoding DSP objects */ - unsigned int profile; /* [out] Profiler memory footprint. */ - unsigned int recordbuffer; /* [out] Buffer used to store recorded data from microphone */ - unsigned int reverb; /* [out] Reverb implementation objects */ - unsigned int reverbchannelprops; /* [out] Reverb channel properties structs */ - unsigned int geometry; /* [out] Geometry objects and internals */ - unsigned int syncpoint; /* [out] Sync point memory. */ - unsigned int eventsystem; /* [out] EventSystem and various internals */ - unsigned int musicsystem; /* [out] MusicSystem and various internals */ - unsigned int fev; /* [out] Definition of objects contained in all loaded projects e.g. events, groups, categories */ - unsigned int memoryfsb; /* [out] Data loaded with preloadFSB */ - unsigned int eventproject; /* [out] EventProject objects and internals */ - unsigned int eventgroupi; /* [out] EventGroup objects and internals */ - unsigned int soundbankclass; /* [out] Objects used to manage wave banks */ - unsigned int soundbanklist; /* [out] Data used to manage lists of wave bank usage */ - unsigned int streaminstance; /* [out] Stream objects and internals */ - unsigned int sounddefclass; /* [out] Sound definition objects */ - unsigned int sounddefdefclass; /* [out] Sound definition static data objects */ - unsigned int sounddefpool; /* [out] Sound definition pool data */ - unsigned int reverbdef; /* [out] Reverb definition objects */ - unsigned int eventreverb; /* [out] Reverb objects */ - unsigned int userproperty; /* [out] User property objects */ - unsigned int eventinstance; /* [out] Event instance base objects */ - unsigned int eventinstance_complex; /* [out] Complex event instance objects */ - unsigned int eventinstance_simple; /* [out] Simple event instance objects */ - unsigned int eventinstance_layer; /* [out] Event layer instance objects */ - unsigned int eventinstance_sound; /* [out] Event sound instance objects */ - unsigned int eventenvelope; /* [out] Event envelope objects */ - unsigned int eventenvelopedef; /* [out] Event envelope definition objects */ - unsigned int eventparameter; /* [out] Event parameter objects */ - unsigned int eventcategory; /* [out] Event category objects */ - unsigned int eventenvelopepoint; /* [out] Event envelope point objects */ - unsigned int eventinstancepool; /* [out] Event instance pool memory */ -} FMOD_MEMORY_USAGE_DETAILS; - - -/* -[DEFINE] -[ - [NAME] - FMOD_MEMBITS - - [DESCRIPTION] - Bitfield used to request specific memory usage information from the getMemoryInfo function of every public FMOD Ex class. - Use with the "memorybits" parameter of getMemoryInfo to get information on FMOD Ex memory usage. - - [REMARKS] - Every public FMOD class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question. - The FMOD_MEMBITS defines can be OR'd together to specify precisely what memory usage you'd like to get information on. See System::getMemoryInfo for an example. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_EVENT_MEMBITS - System::getMemoryInfo -] -*/ -#define FMOD_MEMBITS_OTHER 0x00000001 /* Memory not accounted for by other types */ -#define FMOD_MEMBITS_STRING 0x00000002 /* String data */ - -#define FMOD_MEMBITS_SYSTEM 0x00000004 /* System object and various internals */ -#define FMOD_MEMBITS_PLUGINS 0x00000008 /* Plugin objects and internals */ -#define FMOD_MEMBITS_OUTPUT 0x00000010 /* Output module object and internals */ -#define FMOD_MEMBITS_CHANNEL 0x00000020 /* Channel related memory */ -#define FMOD_MEMBITS_CHANNELGROUP 0x00000040 /* ChannelGroup objects and internals */ -#define FMOD_MEMBITS_CODEC 0x00000080 /* Codecs allocated for streaming */ -#define FMOD_MEMBITS_FILE 0x00000100 /* Codecs allocated for streaming */ -#define FMOD_MEMBITS_SOUND 0x00000200 /* Sound objects and internals */ -#define FMOD_MEMBITS_SOUND_SECONDARYRAM 0x00000400 /* Sound data stored in secondary RAM */ -#define FMOD_MEMBITS_SOUNDGROUP 0x00000800 /* SoundGroup objects and internals */ -#define FMOD_MEMBITS_STREAMBUFFER 0x00001000 /* Stream buffer memory */ -#define FMOD_MEMBITS_DSPCONNECTION 0x00002000 /* DSPConnection objects and internals */ -#define FMOD_MEMBITS_DSP 0x00004000 /* DSP implementation objects */ -#define FMOD_MEMBITS_DSPCODEC 0x00008000 /* Realtime file format decoding DSP objects */ -#define FMOD_MEMBITS_PROFILE 0x00010000 /* Profiler memory footprint. */ -#define FMOD_MEMBITS_RECORDBUFFER 0x00020000 /* Buffer used to store recorded data from microphone */ -#define FMOD_MEMBITS_REVERB 0x00040000 /* Reverb implementation objects */ -#define FMOD_MEMBITS_REVERBCHANNELPROPS 0x00080000 /* Reverb channel properties structs */ -#define FMOD_MEMBITS_GEOMETRY 0x00100000 /* Geometry objects and internals */ -#define FMOD_MEMBITS_SYNCPOINT 0x00200000 /* Sync point memory. */ -#define FMOD_MEMBITS_ALL 0xffffffff /* All memory used by FMOD Ex */ -/* [DEFINE_END] */ - - -/* -[DEFINE] -[ - [NAME] - FMOD_EVENT_MEMBITS - - [DESCRIPTION] - Bitfield used to request specific memory usage information from the getMemoryInfo function of every public FMOD Event System class. - Use with the "event_memorybits" parameter of getMemoryInfo to get information on FMOD Event System memory usage. - - [REMARKS] - Every public FMOD Event System class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question. - The FMOD_EVENT_MEMBITS defines can be OR'd together to specify precisely what memory usage you'd like to get information on. See EventSystem::getMemoryInfo for an example. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_MEMBITS - System::getMemoryInfo -] -*/ -#define FMOD_EVENT_MEMBITS_EVENTSYSTEM 0x00000001 /* EventSystem and various internals */ -#define FMOD_EVENT_MEMBITS_MUSICSYSTEM 0x00000002 /* MusicSystem and various internals */ -#define FMOD_EVENT_MEMBITS_FEV 0x00000004 /* Definition of objects contained in all loaded projects e.g. events, groups, categories */ -#define FMOD_EVENT_MEMBITS_MEMORYFSB 0x00000008 /* Data loaded with preloadFSB */ -#define FMOD_EVENT_MEMBITS_EVENTPROJECT 0x00000010 /* EventProject objects and internals */ -#define FMOD_EVENT_MEMBITS_EVENTGROUPI 0x00000020 /* EventGroup objects and internals */ -#define FMOD_EVENT_MEMBITS_SOUNDBANKCLASS 0x00000040 /* Objects used to manage wave banks */ -#define FMOD_EVENT_MEMBITS_SOUNDBANKLIST 0x00000080 /* Data used to manage lists of wave bank usage */ -#define FMOD_EVENT_MEMBITS_STREAMINSTANCE 0x00000100 /* Stream objects and internals */ -#define FMOD_EVENT_MEMBITS_SOUNDDEFCLASS 0x00000200 /* Sound definition objects */ -#define FMOD_EVENT_MEMBITS_SOUNDDEFDEFCLASS 0x00000400 /* Sound definition static data objects */ -#define FMOD_EVENT_MEMBITS_SOUNDDEFPOOL 0x00000800 /* Sound definition pool data */ -#define FMOD_EVENT_MEMBITS_REVERBDEF 0x00001000 /* Reverb definition objects */ -#define FMOD_EVENT_MEMBITS_EVENTREVERB 0x00002000 /* Reverb objects */ -#define FMOD_EVENT_MEMBITS_USERPROPERTY 0x00004000 /* User property objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE 0x00008000 /* Event instance base objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_COMPLEX 0x00010000 /* Complex event instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_SIMPLE 0x00020000 /* Simple event instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_LAYER 0x00040000 /* Event layer instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_SOUND 0x00080000 /* Event sound instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTENVELOPE 0x00100000 /* Event envelope objects */ -#define FMOD_EVENT_MEMBITS_EVENTENVELOPEDEF 0x00200000 /* Event envelope definition objects */ -#define FMOD_EVENT_MEMBITS_EVENTPARAMETER 0x00400000 /* Event parameter objects */ -#define FMOD_EVENT_MEMBITS_EVENTCATEGORY 0x00800000 /* Event category objects */ -#define FMOD_EVENT_MEMBITS_EVENTENVELOPEPOINT 0x01000000 /* Event envelope point object+s */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCEPOOL 0x02000000 /* Event instance pool data */ -#define FMOD_EVENT_MEMBITS_ALL 0xffffffff /* All memory used by FMOD Event System */ - -/* All event instance memory */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_GROUP (FMOD_EVENT_MEMBITS_EVENTINSTANCE | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_COMPLEX | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_SIMPLE | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_LAYER | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_SOUND) - -/* All sound definition memory */ -#define FMOD_EVENT_MEMBITS_SOUNDDEF_GROUP (FMOD_EVENT_MEMBITS_SOUNDDEFCLASS | \ - FMOD_EVENT_MEMBITS_SOUNDDEFDEFCLASS | \ - FMOD_EVENT_MEMBITS_SOUNDDEFPOOL) -/* [DEFINE_END] */ - -#endif diff --git a/libs/fmodex/inc/fmod_output.h b/libs/fmodex/inc/fmod_output.h deleted file mode 100644 index 2ffb867bd..000000000 --- a/libs/fmodex/inc/fmod_output.h +++ /dev/null @@ -1,93 +0,0 @@ -/* ==================================================================================================== */ -/* FMOD Ex - output development header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you are wanting to develop your own output plugin to use with */ -/* FMOD's output system. With this header you can make your own output plugin that FMOD */ -/* can register and use. See the documentation and examples on how to make a working plugin. */ -/* */ -/* ==================================================================================================== */ - -#ifndef _FMOD_OUTPUT_H -#define _FMOD_OUTPUT_H - -#include "fmod.h" - -typedef struct FMOD_OUTPUT_STATE FMOD_OUTPUT_STATE; - -/* - Output callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETNUMDRIVERSCALLBACK)(FMOD_OUTPUT_STATE *output_state, int *numdrivers); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETDRIVERNAMECALLBACK)(FMOD_OUTPUT_STATE *output_state, int id, char *name, int namelen); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETDRIVERCAPSCALLBACK)(FMOD_OUTPUT_STATE *output_state, int id, FMOD_CAPS *caps); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_INITCALLBACK) (FMOD_OUTPUT_STATE *output_state, int selecteddriver, FMOD_INITFLAGS flags, int *outputrate, int outputchannels, FMOD_SOUND_FORMAT *outputformat, int dspbufferlength, int dspnumbuffers, void *extradriverdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_CLOSECALLBACK) (FMOD_OUTPUT_STATE *output_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_UPDATECALLBACK) (FMOD_OUTPUT_STATE *output_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETHANDLECALLBACK) (FMOD_OUTPUT_STATE *output_state, void **handle); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETPOSITIONCALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int *pcm); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_LOCKCALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_UNLOCKCALLBACK) (FMOD_OUTPUT_STATE *output_state, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_READFROMMIXER) (FMOD_OUTPUT_STATE *output_state, void *buffer, unsigned int length); - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - When creating an output, declare one of these and provide the relevant callbacks and name for FMOD to use when it opens and reads a file of this type. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_OUTPUT_STATE -] -*/ -typedef struct FMOD_OUTPUT_DESCRIPTION -{ - const char *name; /* [in] Name of the output. */ - unsigned int version; /* [in] Plugin writer's version number. */ - int polling; /* [in] If TRUE (non zero), this tells FMOD to start a thread and call getposition / lock / unlock for feeding data. If 0, the output is probably callback based, so all the plugin needs to do is call readfrommixer to the appropriate pointer. */ - FMOD_OUTPUT_GETNUMDRIVERSCALLBACK getnumdrivers; /* [in] For sound device enumeration. This callback is to give System::getNumDrivers somthing to return. */ - FMOD_OUTPUT_GETDRIVERNAMECALLBACK getdrivername; /* [in] For sound device enumeration. This callback is to give System::getDriverName somthing to return. */ - FMOD_OUTPUT_GETDRIVERCAPSCALLBACK getdrivercaps; /* [in] For sound device enumeration. This callback is to give System::getDriverCaps somthing to return. */ - FMOD_OUTPUT_INITCALLBACK init; /* [in] Initialization function for the output device. This is called from System::init. */ - FMOD_OUTPUT_CLOSECALLBACK close; /* [in] Cleanup / close down function for the output device. This is called from System::close. */ - FMOD_OUTPUT_UPDATECALLBACK update; /* [in] Update function that is called once a frame by the user. This is called from System::update. */ - FMOD_OUTPUT_GETHANDLECALLBACK gethandle; /* [in] This is called from System::getOutputHandle. This is just to return a pointer to the internal system device object that the system may be using.*/ - FMOD_OUTPUT_GETPOSITIONCALLBACK getposition; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This returns a position value in samples so that FMOD knows where and when to fill its buffer. */ - FMOD_OUTPUT_LOCKCALLBACK lock; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This function provides a pointer to data that FMOD can write to when software mixing. */ - FMOD_OUTPUT_UNLOCKCALLBACK unlock; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This optional function accepts the data that has been mixed and copies it or does whatever it needs to before sending it to the hardware. */ -} FMOD_OUTPUT_DESCRIPTION; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Output plugin structure that is passed into each callback. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_OUTPUT_DESCRIPTION -] -*/ -struct FMOD_OUTPUT_STATE -{ - void *plugindata; /* [in] Plugin writer created data the output author wants to attach to this object. */ - FMOD_OUTPUT_READFROMMIXER readfrommixer; /* [out] Function to update mixer and write the result to the provided pointer. Used from callback based output only. Polling based output uses lock/unlock/getposition. */ -}; - -#endif - - diff --git a/libs/fmodex/lib/fmodex64_vc.lib b/libs/fmodex/lib/fmodex64_vc.lib deleted file mode 100644 index 77a761d34..000000000 Binary files a/libs/fmodex/lib/fmodex64_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL64_vc.lib b/libs/fmodex/lib/fmodexL64_vc.lib deleted file mode 100644 index 6c008895c..000000000 Binary files a/libs/fmodex/lib/fmodexL64_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL_bc.lib b/libs/fmodex/lib/fmodexL_bc.lib deleted file mode 100644 index 0ae81171b..000000000 Binary files a/libs/fmodex/lib/fmodexL_bc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL_lcc.lib b/libs/fmodex/lib/fmodexL_lcc.lib deleted file mode 100644 index 0c0e22918..000000000 Binary files a/libs/fmodex/lib/fmodexL_lcc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL_vc.lib b/libs/fmodex/lib/fmodexL_vc.lib deleted file mode 100644 index 63b6ee4fa..000000000 Binary files a/libs/fmodex/lib/fmodexL_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodex_bc.lib b/libs/fmodex/lib/fmodex_bc.lib deleted file mode 100644 index 1f5c98ca3..000000000 Binary files a/libs/fmodex/lib/fmodex_bc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodex_lcc.lib b/libs/fmodex/lib/fmodex_lcc.lib deleted file mode 100644 index 235fe165c..000000000 Binary files a/libs/fmodex/lib/fmodex_lcc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodex_vc.lib b/libs/fmodex/lib/fmodex_vc.lib deleted file mode 100644 index ec169885f..000000000 Binary files a/libs/fmodex/lib/fmodex_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/libfmodex.a b/libs/fmodex/lib/libfmodex.a deleted file mode 100644 index 6c49195aa..000000000 Binary files a/libs/fmodex/lib/libfmodex.a and /dev/null differ diff --git a/libs/fmodex/lib/libfmodexL.a b/libs/fmodex/lib/libfmodexL.a deleted file mode 100644 index fe253aaf6..000000000 Binary files a/libs/fmodex/lib/libfmodexL.a and /dev/null differ diff --git a/libs/fmodex/lib/which library do I use.txt b/libs/fmodex/lib/which library do I use.txt deleted file mode 100644 index 12738bed0..000000000 --- a/libs/fmodex/lib/which library do I use.txt +++ /dev/null @@ -1,28 +0,0 @@ -Which library do I link? ------------------------- - -If you want to use fmodex.dll: - -Visual Studio users - fmodex_vc.lib. -Metrowerks Codewarrior users - fmodex_vc.lib. -Borland users - fmodex_bc.lib. -LCC-Win32 users - fmodex_lcc.lib. -Dev-C++, MinGW and CygWin users - libfmodex.a. - -If you want to use fmodexL.dll: (same as fmodex.dll but with debug logging enabled) - -Visual Studio users - fmodexL_vc.lib. -Metrowerks Codewarrior users - fmodexL_vc.lib. -Borland users - fmodexL_bc.lib. -LCC-Win32 users - fmodexL_lcc.lib. -Dev-C++, MinGW and CygWin users - libfmodexL.a. - -If you want to use fmodex64.dll: (same as fmodex.dll but for 64bit machines) - -Visual Studio users - fmodex64_vc.lib. - -If you want to use fmodexL64.dll: (same as fmodex64.dll but with debug logging enabled) - -Visual Studio users - fmodexL64_vc.lib. - -No other compilers are supported for 64bit libraries. \ No newline at end of file diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e765656ca..a003163db 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1306,7 +1306,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before - if (!R_ThingIsFullBright(spr->mobj)) + if (R_ThingIsFullDark(spr->mobj)) + lightlevel = 0; + else if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (*sector->lightlist[light].lightlevel>>1); + else if (!R_ThingIsFullBright(spr->mobj)) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; if (*sector->lightlist[light].extra_colormap) @@ -1314,7 +1318,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } else { - if (!R_ThingIsFullBright(spr->mobj)) + if (R_ThingIsFullDark(spr->mobj)) + lightlevel = 0; + else if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (sector->lightlevel>>1); + else if (!R_ThingIsFullBright(spr->mobj)) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) diff --git a/src/p_mobj.c b/src/p_mobj.c index a1961e37f..3cc3dc338 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1456,7 +1456,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if ((rover->fofflags & (FOF_SWIMMABLE|FOF_GOOWATER)) == (FOF_SWIMMABLE|FOF_GOOWATER)) goopgravity = true; - gravfactor = P_GetSectorGravityFactor(mo->subsector->sector); + gravfactor = P_GetSectorGravityFactor(rover->master->frontsector); if (gravfactor == FRACUNIT) continue; diff --git a/src/p_setup.c b/src/p_setup.c index bef35b5ca..6d3a5486a 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4323,6 +4323,8 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[0] = tag; lines[i].args[1] = lines[i].special - 66; lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] *= -1; lines[i].special = 66; break; case 76: //Make FOF bouncy diff --git a/src/p_spec.c b/src/p_spec.c index e8c9869a8..d29167a88 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2396,6 +2396,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) default: Tag_SectorFSet(secnum, newtag); break; + case TMT_TRIGGERTAG: + sectors[secnum].triggertag = newtag; + break; } } break; @@ -2418,6 +2421,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) default: Tag_SectorFSet(secnum, newtag); break; + case TMT_TRIGGERTAG: + sectors[secnum].triggertag = newtag; + break; } break; } diff --git a/src/p_spec.h b/src/p_spec.h index 07cf0717f..69c629c47 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -306,6 +306,7 @@ typedef enum TMT_ADD = 0, TMT_REMOVE = 1, TMT_REPLACEFIRST = 2, + TMT_TRIGGERTAG = 3, } textmaptagoptions_t; typedef enum diff --git a/src/p_user.c b/src/p_user.c index f32cf1044..fa42568ca 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11915,7 +11915,7 @@ void P_PlayerThink(player_t *player) if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... acceleration = FixedMul(acceleration<mo->movefactor)>>FRACBITS; - P_Thrust(player->mo, moveAngle, -acceleration); + P_Thrust(player->mo, moveAngle, FixedMul(-acceleration, player->mo->scale)); } if (!(player->pflags & PF_AUTOBRAKE) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 4f19d93df..d369d11c0 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -87,39 +87,40 @@ if(${SDL2_FOUND}) endif() if(${CMAKE_SYSTEM} MATCHES Darwin) - find_library(CORE_LIB CoreFoundation) + find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation") target_link_libraries(SRB2SDL2 PRIVATE - ${CORE_LIB} - SDL2 - SDL2_mixer - ${GME_LIBRARIES} - ${OPENMPT_LIBRARIES} - ${MIXERX_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} + ${CORE_FOUNDATION_LIBRARY} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") - else() - target_link_libraries(SRB2SDL2 PRIVATE - ${SDL2_LIBRARIES} - ${SDL2_MIXER_LIBRARIES} - ${GME_LIBRARIES} - ${OPENMPT_LIBRARIES} - ${MIXERX_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} - ) - if(${CMAKE_SYSTEM} MATCHES Linux) - target_link_libraries(SRB2SDL2 PRIVATE - m - rt - ) - endif() + # Configure the app bundle icon and plist properties + target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns") + set_target_properties(SRB2SDL2 PROPERTIES + MACOSX_BUNDLE_ICON_FILE "Srb2mac" + MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2" + MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION} + + RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns" + ) + endif() + + target_link_libraries(SRB2SDL2 PRIVATE + ${SDL2_LIBRARIES} + ${SDL2_MIXER_LIBRARIES} + ${GME_LIBRARIES} + ${OPENMPT_LIBRARIES} + ${MIXERX_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${OPENGL_LIBRARIES} + ${CURL_LIBRARIES} + ) + + if(${CMAKE_SYSTEM} MATCHES Linux) + target_link_libraries(SRB2SDL2 PRIVATE + m + rt + ) endif() #target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) @@ -136,8 +137,6 @@ if(${SDL2_FOUND}) endif() endif() - set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION}) - if(${CMAKE_SYSTEM} MATCHES Windows) target_link_libraries(SRB2SDL2 PRIVATE ws2_32 @@ -188,6 +187,7 @@ if(${SDL2_FOUND}) install(TARGETS SRB2SDL2 BUNDLE DESTINATION . ) + set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON) else() install(TARGETS SRB2SDL2 SRB2SDL2 RUNTIME DESTINATION . diff --git a/src/taglist.c b/src/taglist.c index 9bc6021b0..305b05f04 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -14,6 +14,7 @@ #include "taglist.h" #include "z_zone.h" #include "r_data.h" +#include "p_spec.h" // Bit array of whether a tag exists for sectors/lines/things. bitarray_t tags_available[BIT_ARRAY_SIZE (MAXTAGS)]; @@ -454,6 +455,11 @@ void Tag_SectorFSet (const size_t id, const mtag_t tag) Taggroup_Remove(tags_sectors, curtag, id); Taggroup_Add(tags_sectors, tag, id); Tag_FSet(&sec->tags, tag); + + // Sectors with linedef trigger effects need to have their trigger tag updated too + // This is a bit of a hack... + if (!udmf && GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 7) + sec->triggertag = tag; } mtag_t Tag_NextUnused(mtag_t start) diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt deleted file mode 100644 index 39b01588b..000000000 --- a/src/win32/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -file(GLOB SRB2_WIN_SOURCES *.c *.h *.rc) - -if(${SRB2_CONFIG_HWRENDER}) - set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS}) - set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS}) -endif() - -add_executable(SRB2DD EXCLUDE_FROM_ALL WIN32 - ${SRB2_WIN_SOURCES} -) - -target_compile_definitions(SRB2DD PRIVATE - -D_WINDOWS -) - -set_target_properties(SRB2DD PROPERTIES OUTPUT_NAME ${SRB2_WIN_EXE_NAME}) - -target_link_libraries(SRB2DD PRIVATE SRB2Core) diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj deleted file mode 100644 index 3e8af3b0e..000000000 --- a/src/win32/Srb2win-vc10.vcxproj +++ /dev/null @@ -1,517 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - Srb2DD - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE} - Win32Proj - Srb2win - 10.0.17763.0 - - - - v140 - true - - - true - true - v141 - - - v140 - false - true - - - false - true - true - v141 - - - v140 - true - - - true - true - v141 - - - v140 - false - true - - - false - true - true - v141 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - false - - - - true - gdi32.lib;%(AdditionalDependencies) - - - ProgramDatabase - false - - - - - true - gdi32.lib;%(AdditionalDependencies) - - - - - ProgramDatabase - false - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - true - - - true - - - - - - - - - - - - - - - - - - - - true - - - true - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {72b01aca-7a1a-4f7b-acef-2607299cf052} - - - {73a5729c-7323-41d4-ab48-8a03c9f81603} - - - - - - - Document - - - Document - - - Document - - - - - - diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters deleted file mode 100644 index 7279368f1..000000000 --- a/src/win32/Srb2win-vc10.vcxproj.filters +++ /dev/null @@ -1,943 +0,0 @@ - - - - - {20cba664-c3ef-48f1-85dd-42aafd5345cc} - - - {d3817a65-82f5-4989-9217-e5a7f43380a0} - - - {9c3ed4ae-dbed-4d00-a164-b8bb7fc1710c} - - - {4b8a8fb6-7c84-48c2-85d1-0583e6b8cacd} - - - {1907eee5-0ebf-4325-a2fa-793f089ed2e3} - - - {b9e78a3f-3e2b-4f89-9817-b77c7a26d2aa} - - - {3f336df5-a1d7-4610-9728-4525e42c0abc} - - - {b5090aa0-6645-4091-aa1a-ffc3bf4dc422} - - - {d59e82c9-68e5-44bf-827e-f7bb1676cd6c} - - - {29e746a2-3d91-4b69-af6e-5e03895516b7} - - - {b295d364-61c3-4ebb-9b68-7d6c0bb891be} - - - {ba258ec5-13d7-4083-98bd-c2ee58700b66} - - - {6163f1e5-da5d-4af2-b92c-753452f9e1d0} - - - {077b0966-1151-4afa-a533-120a4c931322} - - - {bded90bc-8019-42b1-ba19-32166743d3e3} - - - {c0ddfdb5-7494-4cca-b2ad-cb048be9cbdf} - - - {d5157f99-43ef-49cc-ad76-658a1168fc0d} - - - {2cedf139-53a1-40ea-b4de-19e9f4505a1f} - - - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - G_Game - - - G_Game - - - F_Frame - - - F_Frame - - - I_Interface - - - I_Interface - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - H_Hud - - - B_Bots - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - S_Sounds - - - W_Wad - - - W_Wad - - - S_Sounds - - - O_Other - - - H_Hud - - - H_Hud - - - I_Interface - - - H_Hud - - - P_Play - - - I_Interface - - - H_Hud - - - R_Rend - - - R_Rend - - - H_Hud - - - D_Doom - - - M_Misc - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - G_Game - - - G_Game - - - G_Game - - - F_Frame - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - LUA - - - LUA - - - LUA - - - LUA - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - H_Hud - - - B_Bots - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - P_Play - - - S_Sounds - - - W_Wad - - - W_Wad - - - I_Interface - - - S_Sounds - - - O_Other - - - I_Interface - - - H_Hud - - - H_Hud - - - I_Interface - - - I_Interface - - - H_Hud - - - P_Play - - - I_Interface - - - A_Asm - - - H_Hud - - - R_Rend - - - R_Rend - - - H_Hud - - - D_Doom - - - O_Other - - - Hw_Hardware - - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - - - Win32app - - - - - Win32app - - - - - A_Asm - - - O_Other - - - - - A_Asm - - - A_Asm - - - A_Asm - - - diff --git a/src/win32/Srb2win-vc9.vcproj b/src/win32/Srb2win-vc9.vcproj deleted file mode 100644 index c1c6b5bc4..000000000 --- a/src/win32/Srb2win-vc9.vcproj +++ /dev/null @@ -1,4914 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/win32/Srb2win.dsp b/src/win32/Srb2win.dsp deleted file mode 100644 index 661f3eaf9..000000000 --- a/src/win32/Srb2win.dsp +++ /dev/null @@ -1,1008 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Srb2win" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=Srb2win - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Srb2win.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Srb2win.mak" CFG="Srb2win - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Srb2win - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "Srb2win - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "..\..\objs\Release" -# PROP BASE Intermediate_Dir "..\..\objs\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\bin\VC\Release\Win32" -# PROP Intermediate_Dir "..\..\objs\VC\Release\Win32" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /Gy /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "_WINDOWS" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /Gs /GF /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /o "NUL" /win32 -# SUBTRACT MTL /mktyplib203 -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo /o"..\..\objs\Release\Srb2win.bsc" -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 dxguid.lib user32.lib gdi32.lib winmm.lib advapi32.lib ws2_32.lib dinput.lib /nologo /subsystem:windows /pdb:"C:\srb2demo2\srb2.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2win.exe" -# SUBTRACT LINK32 /profile /pdb:none /incremental:yes /nodefaultlib - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "..\..\objs\Debug" -# PROP BASE Intermediate_Dir "..\..\objs\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\bin\VC\Debug\Win32" -# PROP Intermediate_Dir "..\..\objs\VC\Debug\Win32" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /W4 /Gm /GX /ZI /Od /Op /Oy /I "libs\libpng-src" /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "_WINDOWS" /D "USEASM" /D "HAVE_PNG" /FAcs /FR /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 dxguid.lib user32.lib gdi32.lib winmm.lib advapi32.lib ws2_32.lib dinput.lib /nologo /subsystem:windows /profile /debug /machine:I386 /out:"C:\srb2demo2\srb2debug.exe" -# SUBTRACT LINK32 /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "Srb2win - Win32 Release" -# Name "Srb2win - Win32 Debug" -# Begin Group "Win32app" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\afxres.h -# End Source File -# Begin Source File - -SOURCE=.\dx_error.c -# End Source File -# Begin Source File - -SOURCE=.\dx_error.h -# End Source File -# Begin Source File - -SOURCE=.\fabdxlib.c -# End Source File -# Begin Source File - -SOURCE=.\fabdxlib.h -# End Source File -# Begin Source File - -SOURCE=..\filesrch.c -# End Source File -# Begin Source File - -SOURCE=..\filesrch.h -# End Source File -# Begin Source File - -SOURCE=.\mid2strm.c -# End Source File -# Begin Source File - -SOURCE=.\mid2strm.h -# End Source File -# Begin Source File - -SOURCE=.\midstuff.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\Srb2win.rc - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# ADD BASE RSC /l 0x40c /i "win32" -# ADD RSC /l 0x409 /i "win32" - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\win_cd.c -# End Source File -# Begin Source File - -SOURCE=.\win_dbg.c -# End Source File -# Begin Source File - -SOURCE=.\win_dbg.h -# End Source File -# Begin Source File - -SOURCE=.\win_dll.c -# End Source File -# Begin Source File - -SOURCE=.\win_dll.h -# End Source File -# Begin Source File - -SOURCE=.\win_main.c -# End Source File -# Begin Source File - -SOURCE=.\win_main.h -# End Source File -# Begin Source File - -SOURCE=.\win_net.c -# End Source File -# Begin Source File - -SOURCE=.\win_snd.c -# End Source File -# Begin Source File - -SOURCE=.\win_sys.c -# End Source File -# Begin Source File - -SOURCE=.\win_vid.c -# End Source File -# End Group -# Begin Group "A_Asm" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\p5prof.h -# End Source File -# Begin Source File - -SOURCE=..\tmap.nas - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\Win32 -InputPath=..\tmap.nas -InputName=tmap - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\Win32 -InputPath=..\tmap.nas -InputName=tmap - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\tmap_mmx.nas - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\Win32 -InputPath=..\tmap_mmx.nas -InputName=tmap_mmx - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\Win32 -InputPath=..\tmap_mmx.nas -InputName=tmap_mmx - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\tmap_vc.nas - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\Win32 -InputPath=..\tmap_vc.nas -InputName=tmap_vc - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\Win32 -InputPath=..\tmap_vc.nas -InputName=tmap_vc - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "D_Doom" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\comptime.c -# End Source File -# Begin Source File - -SOURCE=..\d_clisrv.c -# End Source File -# Begin Source File - -SOURCE=..\d_clisrv.h -# End Source File -# Begin Source File - -SOURCE=..\d_event.h -# End Source File -# Begin Source File - -SOURCE=..\d_main.c -# End Source File -# Begin Source File - -SOURCE=..\d_main.h -# End Source File -# Begin Source File - -SOURCE=..\d_net.c -# End Source File -# Begin Source File - -SOURCE=..\d_net.h -# End Source File -# Begin Source File - -SOURCE=..\d_netcmd.c -# End Source File -# Begin Source File - -SOURCE=..\d_netcmd.h -# End Source File -# Begin Source File - -SOURCE=..\d_netfil.c -# End Source File -# Begin Source File - -SOURCE=..\d_netfil.h -# End Source File -# Begin Source File - -SOURCE=..\d_player.h -# End Source File -# Begin Source File - -SOURCE=..\d_think.h -# End Source File -# Begin Source File - -SOURCE=..\d_ticcmd.h -# End Source File -# Begin Source File - -SOURCE=..\dehacked.c -# End Source File -# Begin Source File - -SOURCE=..\dehacked.h -# End Source File -# Begin Source File - -SOURCE=..\doomdata.h -# End Source File -# Begin Source File - -SOURCE=..\doomdef.h -# End Source File -# Begin Source File - -SOURCE=..\doomstat.h -# End Source File -# Begin Source File - -SOURCE=..\doomtype.h -# End Source File -# Begin Source File - -SOURCE=..\z_zone.c -# End Source File -# Begin Source File - -SOURCE=..\z_zone.h -# End Source File -# End Group -# Begin Group "F_Frame" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\f_finale.c -# End Source File -# Begin Source File - -SOURCE=..\f_finale.h -# End Source File -# Begin Source File - -SOURCE=..\f_wipe.c -# End Source File -# End Group -# Begin Group "G_Game" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\g_game.c -# End Source File -# Begin Source File - -SOURCE=..\g_game.h -# End Source File -# Begin Source File - -SOURCE=..\g_input.c -# End Source File -# Begin Source File - -SOURCE=..\g_input.h -# End Source File -# Begin Source File - -SOURCE=..\g_state.h -# End Source File -# End Group -# Begin Group "H_Hud" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\am_map.c -# End Source File -# Begin Source File - -SOURCE=..\am_map.h -# End Source File -# Begin Source File - -SOURCE=..\command.c -# End Source File -# Begin Source File - -SOURCE=..\command.h -# End Source File -# Begin Source File - -SOURCE=..\console.c -# End Source File -# Begin Source File - -SOURCE=..\console.h -# End Source File -# Begin Source File - -SOURCE=..\hu_stuff.c -# End Source File -# Begin Source File - -SOURCE=..\hu_stuff.h -# End Source File -# Begin Source File - -SOURCE=..\st_stuff.c -# End Source File -# Begin Source File - -SOURCE=..\st_stuff.h -# End Source File -# Begin Source File - -SOURCE=..\y_inter.c -# End Source File -# Begin Source File - -SOURCE=..\y_inter.h -# End Source File -# End Group -# Begin Group "Hw_Hardware" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\hardware\hw3dsdrv.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw3sound.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw3sound.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_bsp.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_cache.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_data.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_defs.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_dll.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_draw.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_drv.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_glob.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_light.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_light.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_main.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_main.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_md2.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_md2.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hws_data.h -# End Source File -# End Group -# Begin Group "I_Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\byteptr.h -# End Source File -# Begin Source File - -SOURCE=..\i_joy.h -# End Source File -# Begin Source File - -SOURCE=..\i_net.h -# End Source File -# Begin Source File - -SOURCE=..\i_sound.h -# End Source File -# Begin Source File - -SOURCE=..\i_system.h -# End Source File -# Begin Source File - -SOURCE=..\i_tcp.c -# End Source File -# Begin Source File - -SOURCE=..\i_tcp.h -# End Source File -# Begin Source File - -SOURCE=..\i_video.h -# End Source File -# Begin Source File - -SOURCE=..\keys.h -# End Source File -# Begin Source File - -SOURCE=..\mserv.c -# End Source File -# Begin Source File - -SOURCE=..\mserv.h -# End Source File -# End Group -# Begin Group "M_Misc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\m_argv.c -# End Source File -# Begin Source File - -SOURCE=..\m_argv.h -# End Source File -# Begin Source File - -SOURCE=..\m_bbox.c -# End Source File -# Begin Source File - -SOURCE=..\m_bbox.h -# End Source File -# Begin Source File - -SOURCE=..\m_cheat.c -# End Source File -# Begin Source File - -SOURCE=..\m_cheat.h -# End Source File -# Begin Source File - -SOURCE=..\m_dllist.h -# End Source File -# Begin Source File - -SOURCE=..\m_fixed.c -# End Source File -# Begin Source File - -SOURCE=..\m_fixed.h -# End Source File -# Begin Source File - -SOURCE=..\m_menu.c -# End Source File -# Begin Source File - -SOURCE=..\m_menu.h -# End Source File -# Begin Source File - -SOURCE=..\m_misc.c -# End Source File -# Begin Source File - -SOURCE=..\m_misc.h -# End Source File -# Begin Source File - -SOURCE=..\m_queue.c -# End Source File -# Begin Source File - -SOURCE=..\m_queue.h -# End Source File -# Begin Source File - -SOURCE=..\m_random.c -# End Source File -# Begin Source File - -SOURCE=..\m_random.h -# End Source File -# Begin Source File - -SOURCE=..\m_swap.h -# End Source File -# Begin Source File - -SOURCE=..\string.c -# End Source File -# End Group -# Begin Group "P_Play" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\info.c -# End Source File -# Begin Source File - -SOURCE=..\info.h -# End Source File -# Begin Source File - -SOURCE=..\p_ceilng.c -# End Source File -# Begin Source File - -SOURCE=..\p_enemy.c -# End Source File -# Begin Source File - -SOURCE=..\p_fab.c -# End Source File -# Begin Source File - -SOURCE=..\p_floor.c -# End Source File -# Begin Source File - -SOURCE=..\p_inter.c -# End Source File -# Begin Source File - -SOURCE=..\p_lights.c -# End Source File -# Begin Source File - -SOURCE=..\p_local.h -# End Source File -# Begin Source File - -SOURCE=..\p_map.c -# End Source File -# Begin Source File - -SOURCE=..\p_maputl.c -# End Source File -# Begin Source File - -SOURCE=..\p_maputl.h -# End Source File -# Begin Source File - -SOURCE=..\p_mobj.c -# End Source File -# Begin Source File - -SOURCE=..\p_mobj.h -# End Source File -# Begin Source File - -SOURCE=..\p_polyobj.c -# End Source File -# Begin Source File - -SOURCE=..\p_polyobj.h -# End Source File -# Begin Source File - -SOURCE=..\p_pspr.h -# End Source File -# Begin Source File - -SOURCE=..\p_saveg.c -# End Source File -# Begin Source File - -SOURCE=..\p_saveg.h -# End Source File -# Begin Source File - -SOURCE=..\p_setup.c -# End Source File -# Begin Source File - -SOURCE=..\p_setup.h -# End Source File -# Begin Source File - -SOURCE=..\p_sight.c -# End Source File -# Begin Source File - -SOURCE=..\p_spec.c -# End Source File -# Begin Source File - -SOURCE=..\p_spec.h -# End Source File -# Begin Source File - -SOURCE=..\p_telept.c -# End Source File -# Begin Source File - -SOURCE=..\p_tick.c -# End Source File -# Begin Source File - -SOURCE=..\p_tick.h -# End Source File -# Begin Source File - -SOURCE=..\p_user.c -# End Source File -# Begin Source File - -SOURCE=..\tables.c -# End Source File -# Begin Source File - -SOURCE=..\tables.h -# End Source File -# End Group -# Begin Group "R_Rend" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\r_bsp.c -# End Source File -# Begin Source File - -SOURCE=..\r_bsp.h -# End Source File -# Begin Source File - -SOURCE=..\r_data.c -# End Source File -# Begin Source File - -SOURCE=..\r_data.h -# End Source File -# Begin Source File - -SOURCE=..\r_defs.h -# End Source File -# Begin Source File - -SOURCE=..\r_draw.c -# End Source File -# Begin Source File - -SOURCE=..\r_draw.h -# End Source File -# Begin Source File - -SOURCE=..\r_draw16.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\r_draw8.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\r_local.h -# End Source File -# Begin Source File - -SOURCE=..\r_main.c -# End Source File -# Begin Source File - -SOURCE=..\r_main.h -# End Source File -# Begin Source File - -SOURCE=..\r_plane.c -# End Source File -# Begin Source File - -SOURCE=..\r_plane.h -# End Source File -# Begin Source File - -SOURCE=..\r_segs.c -# End Source File -# Begin Source File - -SOURCE=..\r_segs.h -# End Source File -# Begin Source File - -SOURCE=..\r_sky.c -# End Source File -# Begin Source File - -SOURCE=..\r_sky.h -# End Source File -# Begin Source File - -SOURCE=..\r_splats.c -# End Source File -# Begin Source File - -SOURCE=..\r_splats.h -# End Source File -# Begin Source File - -SOURCE=..\r_state.h -# End Source File -# Begin Source File - -SOURCE=..\r_things.c -# End Source File -# Begin Source File - -SOURCE=..\r_things.h -# End Source File -# Begin Source File - -SOURCE=..\screen.c -# End Source File -# Begin Source File - -SOURCE=..\screen.h -# End Source File -# Begin Source File - -SOURCE=..\v_video.c -# End Source File -# Begin Source File - -SOURCE=..\v_video.h -# End Source File -# End Group -# Begin Group "S_Sounds" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\s_sound.c -# End Source File -# Begin Source File - -SOURCE=..\s_sound.h -# End Source File -# Begin Source File - -SOURCE=..\sounds.c -# End Source File -# Begin Source File - -SOURCE=..\sounds.h -# End Source File -# End Group -# Begin Group "W_Wad" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\lzf.c -# End Source File -# Begin Source File - -SOURCE=..\lzf.h -# End Source File -# Begin Source File - -SOURCE=..\md5.c -# End Source File -# Begin Source File - -SOURCE=..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\w_wad.c -# End Source File -# Begin Source File - -SOURCE=..\w_wad.h -# End Source File -# End Group -# Begin Group "Docs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\doc\copying -# End Source File -# Begin Source File - -SOURCE=..\..\doc\faq.txt -# End Source File -# Begin Source File - -SOURCE=..\..\readme.txt -# End Source File -# Begin Source File - -SOURCE=..\..\doc\source.txt -# End Source File -# End Group -# Begin Source File - -SOURCE=.\Srb2win.ico -# End Source File -# End Target -# End Project diff --git a/src/win32/Srb2win.dsw b/src/win32/Srb2win.dsw deleted file mode 100644 index f20998142..000000000 --- a/src/win32/Srb2win.dsw +++ /dev/null @@ -1,77 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Srb2win"=.\Srb2win.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libpng - End Project Dependency - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "libpng"="..\..\libs\libpng-src\projects\visualc6\libpng.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "r_opengl"=..\hardware\r_opengl\r_opengl.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Srb2win - End Project Dependency -}}} - -############################################################################### - -Project: "zlib"=..\..\libs\zlib\projects\visualc6\zlib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/win32/Srb2win.props b/src/win32/Srb2win.props deleted file mode 100644 index fa152f0c9..000000000 --- a/src/win32/Srb2win.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - HAVE_ZLIB;HAVE_LIBGME;_WINDOWS;%(PreprocessorDefinitions) - - _WINDOWS;%(PreprocessorDefinitions) - - - - dxguid.lib;winmm.lib;dinput8.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/src/win32/dx_error.c b/src/win32/dx_error.c deleted file mode 100644 index 8e14539a3..000000000 --- a/src/win32/dx_error.c +++ /dev/null @@ -1,276 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief DirectX error messages -/// adapted from DirectX6 sample code - -#include - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#define DIRECTSOUND_VERSION 0x0600 /* version 6.0 */ -#define DXVERSION_NTCOMPATIBLE 0x0300 -#ifdef _MSC_VER -#pragma warning(disable : 4201) -#endif -#include -#include -#include - -#include "dx_error.h" - -// ----------------- -// DXErrorMessageBox -// Displays a message box containing the given formatted string. -// ----------------- -/* -VOID DXErrorMessageBox (HRESULT error) LPSTR fmt, ...) -{ - char buff[256]; - va_list args; - - va_start(args, fmt); - wvsprintf(buff, fmt, args); - va_end(args); - - lstrcat(buff, "\r\n"); - MessageBoxA(NULL, buff, "DirectX Error:", MB_ICONEXCLAMATION + MB_OK); -}*/ - - -// --------------- -// DXErrorToString -// Returns a pointer to a string describing the given DD, D3D or D3DRM error code. -// --------------- -LPCSTR DXErrorToString (HRESULT error) -{ - switch (error) { - case DD_OK: - /* Also includes D3D_OK and D3DRM_OK */ - return "No error."; - case DDERR_ALREADYINITIALIZED: - return "This object is already initialized."; - case DDERR_BLTFASTCANTCLIP: - return "Return if a clipper object is attached to the source surface passed into a BltFast call."; - case DDERR_CANNOTATTACHSURFACE: - return "This surface can not be attached to the requested surface."; - case DDERR_CANNOTDETACHSURFACE: - return "This surface can not be detached from the requested surface."; - case DDERR_CANTCREATEDC: - return "Windows can not create any more DCs."; - case DDERR_CANTDUPLICATE: - return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created."; - case DDERR_CLIPPERISUSINGHWND: - return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd."; - case DDERR_COLORKEYNOTSET: - return "No src color key specified for this operation."; - case DDERR_CURRENTLYNOTAVAIL: - return "Support is currently not available."; - case DDERR_DIRECTDRAWALREADYCREATED: - return "A DirectDraw object representing this driver has already been created for this process."; - case DDERR_EXCEPTION: - return "An exception was encountered while performing the requested operation."; - case DDERR_EXCLUSIVEMODEALREADYSET: - return "An attempt was made to set the cooperative level when it was already set to exclusive."; - case DDERR_GENERIC: - return "Generic failure."; - case DDERR_HEIGHTALIGN: - return "Height of rectangle provided is not a multiple of reqd alignment."; - case DDERR_HWNDALREADYSET: - return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created."; - case DDERR_HWNDSUBCLASSED: - return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state."; - case DDERR_IMPLICITLYCREATED: - return "This surface can not be restored because it is an implicitly created surface."; - case DDERR_INCOMPATIBLEPRIMARY: - return "Unable to match primary surface creation request with existing primary surface."; - case DDERR_INVALIDCAPS: - return "One or more of the caps bits passed to the callback are incorrect."; - case DDERR_INVALIDCLIPLIST: - return "DirectDraw does not support the provided cliplist."; - case DDERR_INVALIDDIRECTDRAWGUID: - return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier."; - case DDERR_INVALIDMODE: - return "DirectDraw does not support the requested mode."; - case DDERR_INVALIDOBJECT: - return "DirectDraw received a pointer that was an invalid DIRECTDRAW object."; - case DDERR_INVALIDPARAMS: - return "One or more of the parameters passed to the function are incorrect."; - case DDERR_INVALIDPIXELFORMAT: - return "The pixel format was invalid as specified."; - case DDERR_INVALIDPOSITION: - return "Returned when the position of the overlay on the destination is no longer legal for that destination."; - case DDERR_INVALIDRECT: - return "Rectangle provided was invalid."; - case DDERR_LOCKEDSURFACES: - return "Operation could not be carried out because one or more surfaces are locked."; - case DDERR_NO3D: - return "There is no 3D present."; - case DDERR_NOALPHAHW: - return "Operation could not be carried out because there is no alpha accleration hardware present or available."; - case DDERR_NOBLTHW: - return "No blitter hardware present."; - case DDERR_NOCLIPLIST: - return "No cliplist available."; - case DDERR_NOCLIPPERATTACHED: - return "No clipper object attached to surface object."; - case DDERR_NOCOLORCONVHW: - return "Operation could not be carried out because there is no color conversion hardware present or available."; - case DDERR_NOCOLORKEY: - return "Surface doesn't currently have a color key"; - case DDERR_NOCOLORKEYHW: - return "Operation could not be carried out because there is no hardware support of the destination color key."; - case DDERR_NOCOOPERATIVELEVELSET: - return "Create function called without DirectDraw object method SetCooperativeLevel being called."; - case DDERR_NODC: - return "No DC was ever created for this surface."; - case DDERR_NODDROPSHW: - return "No DirectDraw ROP hardware."; - case DDERR_NODIRECTDRAWHW: - return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware."; - case DDERR_NOEMULATION: - return "Software emulation not available."; - case DDERR_NOEXCLUSIVEMODE: - return "Operation requires the application to have exclusive mode but the application does not have exclusive mode."; - case DDERR_NOFLIPHW: - return "Flipping visible surfaces is not supported."; - case DDERR_NOGDI: - return "There is no GDI present."; - case DDERR_NOHWND: - return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND."; - case DDERR_NOMIRRORHW: - return "Operation could not be carried out because there is no hardware present or available."; - case DDERR_NOOVERLAYDEST: - return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination."; - case DDERR_NOOVERLAYHW: - return "Operation could not be carried out because there is no overlay hardware present or available."; - case DDERR_NOPALETTEATTACHED: - return "No palette object attached to this surface."; - case DDERR_NOPALETTEHW: - return "No hardware support for 16 or 256 color palettes."; - case DDERR_NORASTEROPHW: - return "Operation could not be carried out because there is no appropriate raster op hardware present or available."; - case DDERR_NOROTATIONHW: - return "Operation could not be carried out because there is no rotation hardware present or available."; - case DDERR_NOSTRETCHHW: - return "Operation could not be carried out because there is no hardware support for stretching."; - case DDERR_NOT4BITCOLOR: - return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette."; - case DDERR_NOT4BITCOLORINDEX: - return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette."; - case DDERR_NOT8BITCOLOR: - return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color."; - case DDERR_NOTAOVERLAYSURFACE: - return "Returned when an overlay member is called for a non-overlay surface."; - case DDERR_NOTEXTUREHW: - return "Operation could not be carried out because there is no texture mapping hardware present or available."; - case DDERR_NOTFLIPPABLE: - return "An attempt has been made to flip a surface that is not flippable."; - case DDERR_NOTFOUND: - return "Requested item was not found."; - case DDERR_NOTLOCKED: - return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted."; - case DDERR_NOTPALETTIZED: - return "The surface being used is not a palette-based surface."; - case DDERR_NOVSYNCHW: - return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations."; - case DDERR_NOZBUFFERHW: - return "Operation could not be carried out because there is no hardware support for zbuffer blitting."; - case DDERR_NOZOVERLAYHW: - return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays."; - case DDERR_OUTOFCAPS: - return "The hardware needed for the requested operation has already been allocated."; - case DDERR_OUTOFMEMORY: - return "There is not enough memory to perform the operation."; - case DDERR_OUTOFVIDEOMEMORY: - return "DirectDraw does not have enough memory to perform the operation."; - case DDERR_OVERLAYCANTCLIP: - return "The hardware does not support clipped overlays."; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: - return "Can only have ony color key active at one time for overlays."; - case DDERR_OVERLAYNOTVISIBLE: - return "Returned when GetOverlayPosition is called on a hidden overlay."; - case DDERR_PALETTEBUSY: - return "Access to this palette is being refused because the palette is already locked by another thread."; - case DDERR_PRIMARYSURFACEALREADYEXISTS: - return "This process already has created a primary surface."; - case DDERR_REGIONTOOSMALL: - return "Region passed to Clipper::GetClipList is too small."; - case DDERR_SURFACEALREADYATTACHED: - return "This surface is already attached to the surface it is being attached to."; - case DDERR_SURFACEALREADYDEPENDENT: - return "This surface is already a dependency of the surface it is being made a dependency of."; - case DDERR_SURFACEBUSY: - return "Access to this surface is being refused because the surface is already locked by another thread."; - case DDERR_SURFACEISOBSCURED: - return "Access to surface refused because the surface is obscured."; - case DDERR_SURFACELOST: - return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it."; - case DDERR_SURFACENOTATTACHED: - return "The requested surface is not attached."; - case DDERR_TOOBIGHEIGHT: - return "Height requested by DirectDraw is too large."; - case DDERR_TOOBIGSIZE: - return "Size requested by DirectDraw is too large, but the individual height and width are OK."; - case DDERR_TOOBIGWIDTH: - return "Width requested by DirectDraw is too large."; - case DDERR_UNSUPPORTED: - return "Function call not supported."; - case DDERR_UNSUPPORTEDFORMAT: - return "FOURCC format requested is unsupported by DirectDraw."; - case DDERR_UNSUPPORTEDMASK: - return "Bitmask in the pixel format requested is unsupported by DirectDraw."; - case DDERR_VERTICALBLANKINPROGRESS: - return "Vertical blank is in progress."; - case DDERR_WASSTILLDRAWING: - return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete."; - case DDERR_WRONGMODE: - return "This surface can not be restored because it was created in a different mode."; - case DDERR_XALIGN: - return "Rectangle provided was not horizontally aligned on required boundary."; - - // - // DirectSound errors - // - case DSERR_ALLOCATED: - return "The request failed because resources, such as a priority level, were already in use by another caller."; - case DSERR_ALREADYINITIALIZED: - return "The object is already initialized."; - case DSERR_BADFORMAT: - return "The specified wave format is not supported."; - case DSERR_BUFFERLOST: - return "The buffer memory has been lost and must be restored."; - case DSERR_CONTROLUNAVAIL: - return "The control (volume, pan, and so forth) requested by the caller is not available."; - case DSERR_INVALIDCALL: - return "This function is not valid for the current state of this object."; - case DSERR_NOAGGREGATION: - return "The object does not support aggregation."; - case DSERR_NODRIVER: - return "No sound driver is available for use."; - case DSERR_NOINTERFACE: - return "The requested COM interface is not available."; - case DSERR_OTHERAPPHASPRIO: - return "Another application has a higher priority level, preventing this call from succeeding"; - case DSERR_PRIOLEVELNEEDED: - return "The caller does not have the priority level required for the function to succeed."; - case DSERR_UNINITIALIZED: - return "The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called."; - default: - return "Unrecognized error value."; - } -} diff --git a/src/win32/dx_error.h b/src/win32/dx_error.h deleted file mode 100644 index 3af4220de..000000000 --- a/src/win32/dx_error.h +++ /dev/null @@ -1,39 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief transform an unreadable DirectX error code -/// into a meaningful error message. - -#ifndef __DX_ERROR_H__ -#define __DX_ERROR_H__ - -//#define WIN32_LEAN_AND_MEAN -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// Displays a message box containing the given formatted string. -//VOID DXErrorMessageBox (LPSTR fmt, ...); - -// Returns a pointer to a string describing the given DD, D3D or D3DRM error code. -LPCSTR DXErrorToString (HRESULT error); - -#ifdef __cplusplus -}; -#endif -#endif // __DX_ERROR_H__ diff --git a/src/win32/fabdxlib.c b/src/win32/fabdxlib.c deleted file mode 100644 index 45ec5d0d3..000000000 --- a/src/win32/fabdxlib.c +++ /dev/null @@ -1,677 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -//----------------------------------------------------------------------------- -/// \file -/// \brief faB's DirectX library v1.0 -/// - converted to C for Doom Legacy - -#include "../doomdef.h" - -#ifdef _WINDOWS - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#include -#include "../i_system.h" -#include "dx_error.h" - -#include "fabdxlib.h" - -#define NT4COMPAT //always defined, always compatible - - -// globals - -IDirectDraw2* DDr2 = NULL; -IDirectDrawSurface* ScreenReal = NULL; // DirectDraw primary surface -IDirectDrawSurface* ScreenVirtual = NULL; // DirectDraw back surface -IDirectDrawPalette* DDPalette = NULL; // The primary surface palette -static IDirectDrawClipper *windclip = NULL; // clipper for windowed mode - -BOOL bAppFullScreen; // true for fullscreen exclusive mode, - -int windowPosX = 0; // current position in windowed mode -int windowPosY = 0; - -int ScreenWidth; -int ScreenHeight; -BOOL ScreenLocked; // Screen surface is being locked -int ScreenPitch; // offset from one line to the next -LPBYTE ScreenPtr; // memory of the surface - - -// -// CreateNewSurface -// -static inline IDirectDrawSurface* CreateNewSurface(int dwWidth, - int dwHeight, - int dwSurfaceCaps) -{ - DDSURFACEDESC ddsd; - HRESULT hr; - LPDIRECTDRAWSURFACE psurf; - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; - - ddsd.ddsCaps.dwCaps = dwSurfaceCaps; - - ddsd.dwHeight = dwHeight; - ddsd.dwWidth = dwWidth; - - hr = IDirectDraw2_CreateSurface (DDr2, &ddsd, &psurf, NULL); - - if (hr == DD_OK) - { - //DDCOLORKEY ddck; - IDirectDrawSurface_Restore(psurf); - - //hr = IDirectDrawSurface_GetColorKey(DDCKEY_SRCBLT, &ddck); - //psurf->SetColorKey(DDCKEY_SRCBLT, &ddck); - } - else - psurf = NULL; - - return psurf; -} - -// -// wow! from 320x200x8 up to 1600x1200x32 thanks Banshee! :) -// -static HRESULT WINAPI myEnumModesCallback (LPDDSURFACEDESC surf, LPVOID lpContext) -{ - APPENUMMODESCALLBACK pfnContext = lpContext; - - if (pfnContext) pfnContext(surf->dwWidth, - surf->dwHeight,surf->ddpfPixelFormat. -#ifdef DUMMYUNIONNAMEN - DUMMYUNIONNAMEN(1). -#endif - dwRGBBitCount - ); - - /*I_OutputMsg("%dx%dx%d bpp %d refresh\n", - surf->dwWidth, - surf->dwHeight, - surf->ddpfPixelFormat.dwRGBBitCount, - surf->dwRefreshRate);*/ - - return DDENUMRET_OK; -} - - -// -// Application call here to enumerate display modes -// -BOOL EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc) -{ - LPVOID lpappFunc = appFunc; - - if (DDr2 == NULL) - return FALSE; - - // enumerate display modes - // Carl: DirectX 3.x apparently does not support VGA modes. Who cares. :) - // faB: removed DDEDM_REFRESHRATES, detects too many modes, plus we don't care of refresh rate. - if (bDX0300) - IDirectDraw2_EnumDisplayModes (DDr2, 0 /*| DDEDM_REFRESHRATES*/, - NULL, lpappFunc, myEnumModesCallback); - else - IDirectDraw2_EnumDisplayModes (DDr2, DDEDM_STANDARDVGAMODES /*| DDEDM_REFRESHRATES*/, - NULL, lpappFunc, myEnumModesCallback); - return TRUE; -} - -static HINSTANCE DDrawDLL = NULL; -typedef HRESULT(WINAPI *DDCreate)(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter); -static DDCreate pfnDirectDrawCreate = NULL; - -static inline BOOL LoadDirectDraw(VOID) -{ - // load ddraw.dll - DDrawDLL = LoadLibraryA("DDRAW.DLL"); - if (DDrawDLL == NULL) - return false; - pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate"); - if (pfnDirectDrawCreate == NULL) - return false; - return true; -} - -static inline VOID UnLoadDirectDraw(VOID) -{ - if (!DDrawDLL) - return; - FreeLibrary(DDrawDLL); - pfnDirectDrawCreate = NULL; - DDrawDLL = NULL; -} - -// -// Create the DirectDraw object for later -// -BOOL CreateDirectDrawInstance (VOID) -{ - HRESULT hr; - IDirectDraw* DDr; - IDirectDraw** rp = &DDr; - IDirectDraw2** rp2 = &DDr2; - LPVOID *tp = (LPVOID *)rp2; - - if (!LoadDirectDraw()) - return FALSE; - // - // create an instance of DirectDraw object - // - if (FAILED(hr = pfnDirectDrawCreate(NULL, rp, NULL))) - I_Error("DirectDrawCreate FAILED: %s", DXErrorToString(hr)); - - // change interface to IDirectDraw2 - if (FAILED(hr = IDirectDraw_QueryInterface(DDr, &IID_IDirectDraw2, tp))) - I_Error("Failed to query DirectDraw2 interface: %s", DXErrorToString(hr)); - - // release the interface we don't need - IDirectDraw_Release (DDr); - return TRUE; -} - - -// -// - returns true if DirectDraw was initialized properly -// -int InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr) -{ - DDSURFACEDESC ddsd; // DirectDraw surface description for allocating - DDSCAPS ddscaps; - HRESULT ddrval; - - DWORD dwStyle; - RECT rect; - - // enumerate directdraw devices - //if (FAILED(DirectDrawEnumerate (myEnumDDDevicesCallback, NULL))) - // I_Error("Error with DirectDrawEnumerate"); - - if (!DDr2) - CreateDirectDrawInstance(); - - // remember what screen mode we are in - bAppFullScreen = fullScr; - ScreenHeight = height; - ScreenWidth = width; - - if (bAppFullScreen) - { - // Change window attributes - dwStyle = WS_POPUP | WS_VISIBLE; - SetWindowLong (appWin, GWL_STYLE, dwStyle); - SetWindowPos(appWin, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); - - // Get exclusive mode - ddrval = IDirectDraw2_SetCooperativeLevel(DDr2, appWin, DDSCL_EXCLUSIVE | - DDSCL_FULLSCREEN | - DDSCL_ALLOWREBOOT); - if (ddrval != DD_OK) - I_Error("SetCooperativeLevel FAILED: %s\n", DXErrorToString(ddrval)); - - // Switch from windows desktop to fullscreen - -#ifdef NT4COMPAT - ddrval = IDirectDraw2_SetDisplayMode(DDr2, width, height, bpp, 0, 0); -#else - ddrval = IDirectDraw2_SetDisplayMode(DDr2, width, height, bpp, 0, DDSDM_STANDARDVGAMODE); -#endif - if (ddrval != DD_OK) - I_Error("SetDisplayMode FAILED: %s\n", DXErrorToString(ddrval)); - - // This is not really needed, except in certain cases. One case - // is while using MFC. When the desktop is initally at 16bpp, a mode - // switch to 8bpp somehow causes the MFC window to not fully initialize - // and a CreateSurface will fail with DDERR_NOEXCLUSIVEMODE. This will - // ensure that the window is initialized properly after a mode switch. - - ShowWindow(appWin, SW_SHOW); - - // Create the primary surface with 1 back buffer. Always zero the - // DDSURFACEDESC structure and set the dwSize member! - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - - // for fullscreen we use page flipping, for windowed mode, we blit the hidden surface to - // the visible surface, in both cases we have a visible (or 'real') surface, and a hidden - // (or 'virtual', or 'backbuffer') surface. - ddsd.dwBackBufferCount = 2; - - ddrval = IDirectDraw2_CreateSurface(DDr2,&ddsd, &ScreenReal, NULL); - if (ddrval != DD_OK) - I_Error("CreateSurface Primary Screen FAILED"); - - // Get a pointer to the back buffer - - ddscaps.dwCaps = DDSCAPS_BACKBUFFER; - ddrval = IDirectDrawSurface_GetAttachedSurface(ScreenReal,&ddscaps, &ScreenVirtual); - if (ddrval != DD_OK) - I_Error("GetAttachedSurface FAILED"); - } - else - { - rect.top = 0; - rect.left = 0; - rect.bottom = height; - rect.right = width; - - // Change window attributes - - dwStyle = GetWindowStyle(appWin); - dwStyle &= ~WS_POPUP; - dwStyle |= WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION; - - SetWindowLong(appWin, GWL_STYLE, dwStyle); - - // Resize the window so that the client area is the requested width/height - - AdjustWindowRectEx(&rect, GetWindowStyle(appWin), GetMenu(appWin) != NULL, - GetWindowExStyle(appWin)); - - // Just in case the window was moved off the visible area of the - // screen. - - SetWindowPos(appWin, NULL, 0, 0, rect.right-rect.left, - rect.bottom-rect.top, SWP_NOMOVE | SWP_NOZORDER | - SWP_NOACTIVATE); - - SetWindowPos(appWin, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); - - // Exclusive mode is normal since it's in windowed mode and needs - // to cooperate with GDI - - ddrval = IDirectDraw2_SetCooperativeLevel(DDr2,appWin, DDSCL_NORMAL); - if (ddrval != DD_OK) - I_Error("SetCooperativeLevel FAILED"); - - // Always zero the DDSURFACEDESC structure and set the dwSize member! - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - // Create the primary surface - - ddrval = IDirectDraw2_CreateSurface(DDr2,&ddsd, &ScreenReal, NULL); - if (ddrval != DD_OK) - I_Error("CreateSurface Primary Screen FAILED"); - - // Create a back buffer for offscreen rendering, this will be used to - // blt to the primary - - ScreenVirtual = CreateNewSurface(width, height, DDSCAPS_OFFSCREENPLAIN | - DDSCAPS_SYSTEMMEMORY); - if (ScreenVirtual == NULL) - I_Error("CreateSurface Secondary Screen FAILED"); - - /// \todo get the desktop bit depth, and build a lookup table - /// for quick conversions of 8bit color indexes 0-255 to desktop colors - /// eg: 256 entries of equivalent of palette colors 0-255 in 15,16,24,32 bit format - /// when blit virtual to real, convert pixels through lookup table.. - - // Use a clipper object for clipping when in windowed mode - // (make sure our drawing doesn't affect other windows) - - ddrval = IDirectDraw2_CreateClipper (DDr2, 0, &windclip, 0); - if (ddrval != DD_OK) - I_Error("CreateClipper FAILED"); - - // Associate the clipper with the window. - ddrval = IDirectDrawClipper_SetHWnd (windclip,0, appWin); - if (ddrval != DD_OK) - I_Error("Clipper -> SetHWnd FAILED"); - - // Attach the clipper to the surface. - ddrval = IDirectDrawSurface_SetClipper (ScreenReal,windclip); - if (ddrval != DD_OK) - I_Error("PrimaryScreen -> SetClipperClipper FAILED"); - } - - return TRUE; -} - - -// -// Free all memory -// -VOID CloseDirectDraw (VOID) -{ - ReleaseChtuff(); - if (DDr2) - { - IDirectDraw2_Release(DDr2); - DDr2 = NULL; - } - UnLoadDirectDraw(); -} - - -// -// Release DirectDraw stuff before display mode change -// -VOID ReleaseChtuff (VOID) -{ - if (!DDr2) - return; - if (windclip) - { - IDirectDrawClipper_Release(windclip); - windclip = NULL; - } - if (DDPalette) - { - IDirectDrawPalette_Release(DDPalette); - DDPalette = NULL; - } - // If the app is fullscreen, the back buffer is attached to the - // primary. Releasing the primary buffer will also release any - // attached buffers, so explicitly releasing the back buffer is not - // necessary. - - if (!bAppFullScreen && ScreenVirtual) - { - IDirectDrawSurface_Release(ScreenVirtual); // release hidden surface - ScreenVirtual = NULL; - } - if (ScreenReal) - { - IDirectDrawSurface_Release(ScreenReal); // and attached backbuffers for bAppFullScreen mode - ScreenReal = NULL; - } -} - - -// -// Clear the surface to color -// -VOID ClearSurface(IDirectDrawSurface* surface, int color) -{ - DDBLTFX ddbltfx; - - // Use the blter to do a color fill to clear the back buffer - ddbltfx.dwSize = sizeof (ddbltfx); - ddbltfx. -#ifdef DUMMYUNIONNAMEN - DUMMYUNIONNAMEN(5). -#endif - dwFillColor = color; - IDirectDrawSurface_Blt(surface,NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); - -} - -// -// Flip the real page with virtual page -// - in bAppFullScreen mode, do page flipping -// - in windowed mode, copy the hidden surface to the visible surface -// -// waitflip : if not 0, wait for page flip to end -BOOL ScreenFlip(int waitflip) -{ - HRESULT hr; - RECT rect; - - if (bAppFullScreen) - { - //hr = IDirectDrawSurface_GetFlipStatus (ScreenReal, DDGFS_); - - // In full-screen exclusive mode, do a hardware flip. - hr = IDirectDrawSurface_Flip(ScreenReal, NULL, DDFLIP_WAIT | (waitflip ? 0 : DDFLIP_NOVSYNC)); //return immediately - - // If the surface was lost, restore it. - if (hr == DDERR_SURFACELOST) - { - IDirectDrawSurface_Restore(ScreenReal); - - // The restore worked, so try the flip again. - hr = IDirectDrawSurface_Flip(ScreenReal, 0, DDFLIP_WAIT | (waitflip ? 0 : DDFLIP_NOVSYNC)); - } - } - else - { - rect.left = windowPosX; - rect.top = windowPosY; - rect.right = windowPosX + ScreenWidth - 1; - rect.bottom = windowPosY + ScreenHeight - 1; - - // Copy the back buffer to front. - hr = IDirectDrawSurface_Blt(ScreenReal, &rect, ScreenVirtual, 0, DDBLT_WAIT, 0); - - if (hr != DD_OK) - { - // If the surfaces were lost, restore them. - if (IDirectDrawSurface_IsLost(ScreenReal) == DDERR_SURFACELOST) - IDirectDrawSurface_Restore(ScreenReal); - - if (IDirectDrawSurface_IsLost(ScreenVirtual) == DDERR_SURFACELOST) - IDirectDrawSurface_Restore(ScreenVirtual); - - // Retry the copy. - hr = IDirectDrawSurface_Blt(ScreenReal,&rect, ScreenVirtual, 0, DDBLT_WAIT, 0); - } - } - - if (hr != DD_OK) - I_Error("ScreenFlip() : couldn't Flip surfaces because %s", DXErrorToString(hr)); - - return FALSE; -} - -// -// Print a text to the surface -// -VOID TextPrint(int x, int y, LPCSTR message) -{ - HRESULT hr; - HDC hdc = NULL; - - // Get the device context handle. - hr = IDirectDrawSurface_GetDC(ScreenVirtual,&hdc); - if (hr != DD_OK) - return; - - // Write the message. - SetBkMode(hdc, TRANSPARENT); - SetTextColor(hdc, RGB(255, 255, 255)); - TextOutA(hdc, x, y, message, (int)strlen(message)); - - // Release the device context. - hr = IDirectDrawSurface_ReleaseDC(ScreenVirtual,hdc); -} - -// -// Lock surface before multiple drawings by hand, for speed -// -boolean LockScreen(VOID) -{ - DDSURFACEDESC ddsd; - HRESULT ddrval; - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - - // attempt to Lock the surface - ddrval = IDirectDrawSurface_Lock(ScreenVirtual, NULL, &ddsd, DDLOCK_WAIT, NULL); - - // Always, always check for errors with DirectX! - // If the surface was lost, restore it. - if (ddrval == DDERR_SURFACELOST) - { - ddrval = IDirectDrawSurface_Restore(ScreenReal); - - // now retry to get the lock - ddrval = IDirectDrawSurface_Lock(ScreenVirtual, NULL, &ddsd, DDLOCK_WAIT, NULL); - } - - if (ddrval == DD_OK) - { - ScreenLocked = TRUE; - ScreenPtr = (LPBYTE)ddsd.lpSurface; - ScreenPitch = ddsd. -#ifdef DUMMYUNIONNAMEN - DUMMYUNIONNAMEN(1). -#endif - lPitch; - } - else - { - ScreenLocked = FALSE; - ScreenPtr = NULL; - ScreenPitch = 0; - //I_Error("LockScreen() : couldn't restore the surface."); - return false; - } - return true; -} - -// -// Unlock surface -// -VOID UnlockScreen(VOID) -{ - if (DD_OK != IDirectDrawSurface_Unlock(ScreenVirtual,NULL)) - I_Error("Couldn't UnLock the renderer!"); - - ScreenLocked = FALSE; - ScreenPtr = NULL; - ScreenPitch = 0; -} - -// Blit virtual screen to real screen -//faB: note: testing 14/03/1999, see if it is faster than memcopy of virtual to -/* -static LPDIRECTDRAWSURFACE lpDDS = NULL; -VOID BlitScreen(VOID) -{ - HRESULT hr; - - if (!lpDDS) - I_Error("lpDDS NULL"); - - hr = IDirectDrawSurface_BltFast(ScreenVirtual, - 0, 0, // Upper left xy of destination - lpDDS, // Source surface - NULL, // Source rectangle = entire surface - DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY); - if (FAILED(hr)) - I_Error("BltFast FAILED"); -} - -VOID MakeScreen(int width, int height, BYTE* lpSurface) -{ - HRESULT hr; - DDSURFACEDESC ddsd; - - // Initialize the surface description. - ZeroMemory (&ddsd, sizeof ddsd); - ZeroMemory (&ddsd.ddpfPixelFormat, sizeof (DDPIXELFORMAT)); - ddsd.dwSize = sizeof ddsd; - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | //DDSD_LPSURFACE | - DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_CAPS; - ddsd.dwWidth = width; - ddsd.dwHeight= height; - ddsd.lPitch = width; - ddsd.lpSurface = lpSurface; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; - - // Set up the pixel format for 8-bit - ddsd.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags= DDPF_RGB | DDPF_PALETTEINDEXED8; - ddsd.ddpfPixelFormat.dwRGBBitCount = 8; - - // - ddsd.ddpfPixelFormat.dwRGBBitCount = (DWORD)DEPTH*8; - ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF; - - // Create the surface - hr = IDirectDraw2_CreateSurface(DDr2, &ddsd, &lpDDS, NULL); - if (FAILED(hr)) - I_Error("MakeScreen FAILED: %s",DDError(hr)); - //ddsd.lpSurface = lpSurface; -} -*/ - -// -// Create a palette object -// -VOID CreateDDPalette (PALETTEENTRY* colorTable) -{ - HRESULT ddrval; - ddrval = IDirectDraw2_CreatePalette(DDr2,DDPCAPS_8BIT|DDPCAPS_ALLOW256, colorTable, &DDPalette, NULL); - if (ddrval != DD_OK) - I_Error("couldn't CreatePalette"); -}; - - -// -// Free the palette object -// -VOID DestroyDDPalette (VOID) -{ - if (DDPalette) - { - IDirectDrawPalette_Release(DDPalette); - DDPalette = NULL; - } -} - -// -// Set a a full palette of 256 PALETTEENTRY entries -// -VOID SetDDPalette(PALETTEENTRY* pal) -{ - // create palette first time - if (DDPalette == NULL) - CreateDDPalette(pal); - else - IDirectDrawPalette_SetEntries(DDPalette, 0, 0, 256, pal); - // setting the same palette to the same surface again does not increase - // the reference count - IDirectDrawSurface_SetPalette(ScreenReal, DDPalette); -} - -// -// Wait for vsync, gross -// -VOID WaitVbl(VOID) -{ - IDirectDraw2_WaitForVerticalBlank(DDr2, DDWAITVB_BLOCKBEGIN, NULL); -} - - -// -// Restore the palette. Useful when we regain focus. -// -VOID RestoreDDPalette(VOID) -{ - if (DDPalette) - IDirectDrawSurface_SetPalette(ScreenReal, DDPalette); -} -#endif diff --git a/src/win32/fabdxlib.h b/src/win32/fabdxlib.h deleted file mode 100644 index 2836b795d..000000000 --- a/src/win32/fabdxlib.h +++ /dev/null @@ -1,82 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief faB's DirectX library v1.0 - -#ifndef _H_FABDXLIB_ -#define _H_FABDXLIB_ - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#ifdef __MINGW32__ -//#define NONAMELESSUNION -#endif -#ifdef _MSC_VER -#pragma warning(disable : 4201) -#endif -#include -#if (defined (DIRECTDRAW_VERSION) && (DIRECTDRAW_VERSION >= 0x0700)) -#undef DUMMYUNIONNAMEN -#endif -// format of function in app called with width,height -typedef BOOL (*APPENUMMODESCALLBACK)(int width, int height, int bpp); - - -// globals -extern IDirectDraw2* DDr2; -extern IDirectDrawSurface* ScreenReal; -extern IDirectDrawSurface* ScreenVirtual; -extern IDirectDrawPalette* DDPalette; - -extern BOOL bAppFullScreen; // main code might need this to know the current - // fullscreen or windowed state - -extern int windowPosX; // current position in windowed mode -extern int windowPosY; - -extern int ScreenWidth; -extern int ScreenHeight; -extern BOOL ScreenLocked; // Screen surface is being locked -extern int ScreenPitch; // offset from one line to the next -extern LPBYTE ScreenPtr; // memory of the surface - -extern BOOL bDX0300; - -BOOL EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc); -BOOL CreateDirectDrawInstance (VOID); - -int InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr); -VOID CloseDirectDraw (VOID); - -VOID ReleaseChtuff (VOID); - -VOID ClearSurface (IDirectDrawSurface* surface, int color); -BOOL ScreenFlip (int wait); -VOID TextPrint (int x, int y, LPCSTR message); - -VOID CreateDDPalette (PALETTEENTRY* colorTable); -VOID DestroyDDPalette (VOID); -VOID SetDDPalette (PALETTEENTRY* pal); -VOID RestoreDDPalette(VOID); - -VOID WaitVbl (VOID); - -boolean LockScreen (VOID); -VOID UnlockScreen (VOID); - - -#endif /* _H_FABDXLIB_ */ diff --git a/src/win32/win_cd.c b/src/win32/win_cd.c deleted file mode 100644 index 324c24928..000000000 --- a/src/win32/win_cd.c +++ /dev/null @@ -1,539 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief cd music interface (uses MCI). - -#include "../doomdef.h" -#include "../doomstat.h" -#ifdef _WINDOWS -#include "win_main.h" -#include - -#include "../command.h" -#include "../doomtype.h" -#include "../i_sound.h" -#include "../i_system.h" - -#include "../s_sound.h" - -#define MAX_CD_TRACKS 255 - -typedef struct { - BOOL IsAudio; - DWORD Start, End; - DWORD Length; // minutes -} CDTrack; - -// ------- -// private -// ------- -static CDTrack m_nTracks[MAX_CD_TRACKS]; -static int m_nTracksCount; // up to MAX_CD_TRACKS -static MCI_STATUS_PARMS m_MCIStatus; -static MCI_OPEN_PARMS m_MCIOpen; - -// ------ -// protos -// ------ -static void Command_Cd_f (void); - - -// ------------------- -// MCIErrorMessageBox -// Retrieve error message corresponding to return value from -// mciSendCommand() or mciSenString() -// ------------------- -static VOID MCIErrorMessageBox (MCIERROR iErrorCode) -{ - char szErrorText[128]; - if (!mciGetErrorStringA (iErrorCode, szErrorText, sizeof (szErrorText))) - wsprintfA(szErrorText,"MCI CD Audio Unknown Error #%lu\n", iErrorCode); - I_OutputMsg("%s", szErrorText); - /*MessageBox (GetActiveWindow(), szTemp+1, "LEGACY", - MB_OK | MB_ICONSTOP);*/ -} - - -// -------- -// CD_Reset -// -------- -static VOID CD_Reset (VOID) -{ - // no win32 equivalent - //faB: for DOS, some odd drivers like to be reset sometimes.. useless in MCI I guess -} - - -// ---------------- -// CD_ReadTrackInfo -// Read in number of tracks, and length of each track in minutes/seconds -// returns true if error -// ---------------- -static BOOL CD_ReadTrackInfo(VOID) -{ - UINT nTrackLength; - INT i; - MCIERROR iErr; - - m_nTracksCount = 0; - - m_MCIStatus.dwItem = MCI_STATUS_NUMBER_OF_TRACKS; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus); - if (iErr) - { - MCIErrorMessageBox (iErr); - return FALSE; - } - m_nTracksCount = (int)m_MCIStatus.dwReturn; - if (m_nTracksCount > MAX_CD_TRACKS) - m_nTracksCount = MAX_CD_TRACKS; - - for (i = 0; i < m_nTracksCount; i++) - { - m_MCIStatus.dwTrack = (DWORD)(i+1); - m_MCIStatus.dwItem = MCI_STATUS_LENGTH; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_TRACK|MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus); - if (iErr) - { - MCIErrorMessageBox (iErr); - return FALSE; - } - nTrackLength = (DWORD)(MCI_MSF_MINUTE(m_MCIStatus.dwReturn)*60 + MCI_MSF_SECOND(m_MCIStatus.dwReturn)); - m_nTracks[i].Length = nTrackLength; - - m_MCIStatus.dwItem = MCI_CDA_STATUS_TYPE_TRACK; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_TRACK|MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus); - if (iErr) - { - MCIErrorMessageBox (iErr); - return FALSE; - } - m_nTracks[i].IsAudio = (m_MCIStatus.dwReturn == MCI_CDA_TRACK_AUDIO); - } - - return TRUE; -} - - -// ------------ -// CD_TotalTime -// returns total time for all audio tracks in seconds -// ------------ -static UINT CD_TotalTime(VOID) -{ - UINT nTotalLength = 0; - INT nTrack; - for (nTrack = 0; nTrack < m_nTracksCount; nTrack++) - { - if (m_nTracks[nTrack].IsAudio) - nTotalLength += m_nTracks[nTrack].Length; - } - return nTotalLength; -} - - -//====================================================================== -// CD AUDIO MUSIC SUBSYSTEM -//====================================================================== - -UINT8 cdaudio_started = 0; // for system startup/shutdown - -static BOOL cdPlaying = FALSE; -static INT cdPlayTrack; // when cdPlaying is true -static BOOL cdLooping = FALSE; -static BYTE cdRemap[MAX_CD_TRACKS]; -static BOOL cdEnabled = TRUE; // cd info available -static BOOL cdValid; // true when last cd audio info was ok -static BOOL wasPlaying; -//static INT cdVolume = 0; // current cd volume (0-31) - -// 0-31 like Music & Sfx, though CD hardware volume is 0-255. -consvar_t cd_volume = CVAR_INIT ("cd_volume","18",CV_SAVE,soundvolume_cons_t, NULL); - -// allow Update for next/loop track -// some crap cd drivers take up to -// a second for a simple 'busy' check.. -// (on those Update can be disabled) -consvar_t cdUpdate = CVAR_INIT ("cd_update","1",CV_SAVE, NULL, NULL); - -#if (__GNUC__ > 6) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat-overflow" -#endif -// hour,minutes,seconds -static LPSTR hms(UINT seconds) -{ - UINT hours, minutes; - static CHAR s[9]; - - minutes = seconds / 60; - seconds %= 60; - hours = minutes / 60; - minutes %= 60; - if (hours > 0) - sprintf (s, "%lu:%02lu:%02lu", (long unsigned int)hours, (long unsigned int)minutes, (long unsigned int)seconds); - else - sprintf (s, "%2lu:%02lu", (long unsigned int)minutes, (long unsigned int)seconds); - return s; -} -#if (__GNUC__ > 6) -#pragma GCC diagnostic pop -#endif - -static void Command_Cd_f(void) -{ - LPCSTR s; - int i,j; - - if (!cdaudio_started) - return; - - if (COM_Argc() < 2) - { - CONS_Printf (M_GetText( - "cd [on] [off] [remap] [reset] [select]\n" - " [open] [info] [play ] [resume]\n" - " [stop] [pause] [loop ]\n")); - return; - } - - s = COM_Argv(1); - - // activate cd music - if (!strncmp(s,"on",2)) - { - cdEnabled = TRUE; - return; - } - - // stop/deactivate cd music - if (!strncmp(s, "off", 3)) - { - if (cdPlaying) - I_StopCD(); - cdEnabled = FALSE; - return; - } - - // remap tracks - if (!strncmp(s, "remap", 5)) - { - i = (int)COM_Argc() - 2; - if (i <= 0) - { - CONS_Printf(M_GetText("CD tracks remapped in that order :\n")); - for (j = 1; j < MAX_CD_TRACKS; j++) - if (cdRemap[j] != j) - CONS_Printf(" %2d -> %2d\n", j, cdRemap[j]); - return; - } - for (j = 1; j <= i; j++) - cdRemap[j] = (UINT8)atoi(COM_Argv(j+1)); - return; - } - - // reset the CD driver, useful on some odd cd's - if (!strncmp(s,"reset",5)) - { - cdEnabled = TRUE; - if (cdPlaying) - I_StopCD (); - for (i = 0; i < MAX_CD_TRACKS; i++) - cdRemap[i] = (UINT8)i; - CD_Reset(); - cdValid = CD_ReadTrackInfo(); - return; - } - - // any other command is not allowed until we could retrieve cd information - if (!cdValid) - { - CONS_Printf(M_GetText("CD is not ready.\n")); - return; - } - - /* faB: not with MCI, didn't find it, useless anyway - if (!strncmp(s,"open",4)) - { - if (cdPlaying) - I_StopCD (); - bcd_open_door(); - cdValid = FALSE; - return; - }*/ - - if (!strncmp(s,"info",4)) - { - if (!CD_ReadTrackInfo()) - { - cdValid = FALSE; - return; - } - - cdValid = TRUE; - - if (m_nTracksCount <= 0) - CONS_Printf(M_GetText("No audio tracks\n")); - else - { - // display list of tracks - // highlight current playing track - for (i = 0; i < m_nTracksCount; i++) - { - CONS_Printf("%s%2d. %s %s\n", - cdPlaying && (cdPlayTrack == i) ? "\x82 " : " ", - i+1, m_nTracks[i].IsAudio ? M_GetText("audio") : M_GetText("data "), - hms(m_nTracks[i].Length)); - } - CONS_Printf(M_GetText("\x82Total time : %s\n"), hms(CD_TotalTime())); - } - if (cdPlaying) - { - CONS_Printf(M_GetText("Currently %s track %u\n"), cdLooping ? M_GetText("looping") : M_GetText("playing"), cdPlayTrack); - } - return; - } - - if (!strncmp(s,"play",4)) - { - I_PlayCD ((UINT8)atoi (COM_Argv (2)), false); - return; - } - - if (!strncmp(s,"stop",4)) - { - I_StopCD (); - return; - } - - if (!strncmp(s,"loop",4)) - { - I_PlayCD((UINT8)atoi (COM_Argv (2)), true); - return; - } - - if (!strncmp(s,"resume",4)) - { - I_ResumeCD (); - return; - } - - CONS_Printf (M_GetText("Invalid CD command \"CD %s\"\n"), s); -} - - -// ------------ -// I_ShutdownCD -// Shutdown CD Audio subsystem, release whatever was allocated -// ------------ -void I_ShutdownCD(void) -{ - MCIERROR iErr; - - if (!cdaudio_started) - return; - - CONS_Printf("I_ShutdownCD: "); - - I_StopCD(); - - // closes MCI CD - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0); - if (iErr) - MCIErrorMessageBox (iErr); -} - - -// -------- -// I_InitCD -// Init CD Audio subsystem -// -------- -void I_InitCD(void) -{ - MCI_SET_PARMS mciSet; - MCIERROR iErr; - int i; - - // We don't have an open device yet - m_MCIOpen.wDeviceID = 0; - m_nTracksCount = 0; - - cdaudio_started = false; - - m_MCIOpen.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO; - iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD_PTR)&m_MCIOpen); - if (iErr) - { - MCIErrorMessageBox (iErr); - return; - } - - // Set the time format to track/minute/second/frame (TMSF). - mciSet.dwTimeFormat = MCI_FORMAT_TMSF; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mciSet); - if (iErr) - { - MCIErrorMessageBox (iErr); - mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0); - return; - } - - I_AddExitFunc (I_ShutdownCD); - cdaudio_started = true; - - CONS_Printf (M_GetText("CD audio Initialized\n")); - - // last saved in config.cfg - i = cd_volume.value; - //I_SetVolumeCD (0); // initialize to 0 for some odd cd drivers - I_SetVolumeCD (i); // now set the last saved volume - - for (i = 0; i < MAX_CD_TRACKS; i++) - cdRemap[i] = (UINT8)i; - - if (!CD_ReadTrackInfo()) - { - CONS_Printf(M_GetText("No CD in drive\n")); - cdEnabled = FALSE; - cdValid = FALSE; - } - else - { - cdEnabled = TRUE; - cdValid = TRUE; - } - - COM_AddCommand ("cd", Command_Cd_f); -} - - - -// loop/go to next track when track is finished (if cd_update var is true) -// update the volume when it has changed (from console/menu) -void I_UpdateCD(void) -{ - /// \todo check for cd change and restart music ? -} - - -// -void I_PlayCD(UINT8 nTrack, UINT8 bLooping) -{ - MCI_PLAY_PARMS mciPlay; - MCIERROR iErr; - - if (!cdaudio_started || !cdEnabled) - return; - - //faB: try again if it didn't work (just free the user of typing 'cd reset' command) - if (!cdValid) - cdValid = CD_ReadTrackInfo(); - if (!cdValid) - return; - - // tracks start at 0 in the code.. - nTrack--; - if (nTrack >= m_nTracksCount) - nTrack = (UINT8) (nTrack % m_nTracksCount); - - nTrack = cdRemap[nTrack]; - - if (cdPlaying) - { - if (cdPlayTrack == nTrack) - return; - I_StopCD (); - } - - cdPlayTrack = nTrack; - - if (!m_nTracks[nTrack].IsAudio) - { - //I_OutputMsg("\x82""CD Play: not an audio track\n"); // Tails 03-25-2001 - return; - } - - cdLooping = bLooping; - - //faB: stop MIDI music, MIDI music will restart if volume is upped later - cv_digmusicvolume.value = 0; - cv_midimusicvolume.value = 0; - I_StopSong(); - - //faB: I don't use the notify message, I'm trying to minimize the delay - mciPlay.dwCallback = (DWORD)((size_t)hWndMain); - mciPlay.dwFrom = MCI_MAKE_TMSF(nTrack+1, 0, 0, 0); - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_PLAY, MCI_FROM|MCI_NOTIFY, (DWORD_PTR)&mciPlay); - if (iErr) - { - MCIErrorMessageBox (iErr); - cdValid = FALSE; - cdPlaying = FALSE; - return; - } - - cdPlaying = TRUE; -} - - -// pause cd music -void I_StopCD(void) -{ - MCIERROR iErr; - - if (!cdaudio_started || !cdEnabled) - return; - - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_PAUSE, MCI_WAIT, 0); - if (iErr) - MCIErrorMessageBox (iErr); - else - { - wasPlaying = cdPlaying; - cdPlaying = FALSE; - } -} - - -// continue after a pause -void I_ResumeCD(void) -{ - MCIERROR iErr; - - if (!cdaudio_started || !cdEnabled) - return; - - if (!cdValid) - return; - - if (!wasPlaying) - return; - - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_RESUME, MCI_WAIT, 0); - if (iErr) - MCIErrorMessageBox (iErr); - else - cdPlaying = TRUE; -} - - -// volume : logical cd audio volume 0-31 (hardware is 0-255) -boolean I_SetVolumeCD (INT32 volume) -{ - UNREFERENCED_PARAMETER(volume); - return false; -} -#endif diff --git a/src/win32/win_dll.c b/src/win32/win_dll.c deleted file mode 100644 index 4743cec34..000000000 --- a/src/win32/win_dll.c +++ /dev/null @@ -1,238 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief load and initialise the 3D driver DLL - -#include "../doomdef.h" -#ifdef HWRENDER -#include "../hardware/hw_drv.h" // get the standard 3D Driver DLL exports prototypes -#endif - -#ifdef HW3SOUND -#include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes -#endif - -#ifdef _WINDOWS - -#include "win_dll.h" -#include "win_main.h" // I_ShowLastError() - -#if defined(HWRENDER) || defined(HW3SOUND) -typedef struct loadfunc_s { - LPCSTR fnName; - LPVOID fnPointer; -} loadfunc_t; - -// -------------------------------------------------------------------------- -// Load a DLL, returns the HMODULE handle or NULL -// -------------------------------------------------------------------------- -static HMODULE LoadDLL (LPCSTR dllName, loadfunc_t *funcTable) -{ - LPVOID funcPtr; - loadfunc_t *loadfunc; - HMODULE hModule; - - if ((hModule = LoadLibraryA(dllName)) != NULL) - { - // get function pointers for all functions we use - for (loadfunc = funcTable; loadfunc->fnName != NULL; loadfunc++) - { - funcPtr = GetProcAddress(hModule, loadfunc->fnName); - if (!funcPtr) { - I_ShowLastError(FALSE); - MessageBoxA(NULL, va("The '%s' haven't the good specification (function %s missing)\n\n" - "You must use dll from the same zip of this exe\n", dllName, loadfunc->fnName), - "Error", MB_OK|MB_ICONINFORMATION); - return FALSE; - } - // store function address - *((LPVOID*)loadfunc->fnPointer) = funcPtr; - } - } - else - { - I_ShowLastError(FALSE); - MessageBoxA(NULL, va("LoadLibrary() FAILED : couldn't load '%s'\r\n", dllName), "Warning", MB_OK|MB_ICONINFORMATION); - } - - return hModule; -} - - -// -------------------------------------------------------------------------- -// Unload the DLL -// -------------------------------------------------------------------------- -static VOID UnloadDLL (HMODULE* pModule) -{ - if (FreeLibrary(*pModule)) - *pModule = NULL; - else - I_ShowLastError(TRUE); -} -#endif - -// ========================================================================== -// STANDARD 3D DRIVER DLL FOR DOOM LEGACY -// ========================================================================== - -// note : the 3D driver loading should be put somewhere else.. - -#ifdef HWRENDER -static HMODULE hwdModule = NULL; - -static loadfunc_t hwdFuncTable[] = { -#ifdef _X86_ - {"Init@4", &hwdriver.pfnInit}, - {"Shutdown@0", &hwdriver.pfnShutdown}, - {"GetModeList@8", &hwdriver.pfnGetModeList}, - {"SetPalette@4", &hwdriver.pfnSetPalette}, - {"FinishUpdate@4", &hwdriver.pfnFinishUpdate}, - {"Draw2DLine@12", &hwdriver.pfnDraw2DLine}, - {"DrawPolygon@16", &hwdriver.pfnDrawPolygon}, - {"RenderSkyDome@4", &hwdriver.pfnRenderSkyDome}, - {"SetBlend@4", &hwdriver.pfnSetBlend}, - {"ClearBuffer@12", &hwdriver.pfnClearBuffer}, - {"SetTexture@4", &hwdriver.pfnSetTexture}, - {"UpdateTexture@4", &hwdriver.pfnUpdateTexture}, - {"DeleteTexture@4", &hwdriver.pfnDeleteTexture}, - {"ReadRect@24", &hwdriver.pfnReadRect}, - {"GClipRect@20", &hwdriver.pfnGClipRect}, - {"ClearMipMapCache@0", &hwdriver.pfnClearMipMapCache}, - {"SetSpecialState@8", &hwdriver.pfnSetSpecialState}, - {"DrawModel@16", &hwdriver.pfnDrawModel}, - {"SetTransform@4", &hwdriver.pfnSetTransform}, - {"GetTextureUsed@0", &hwdriver.pfnGetTextureUsed}, - {"GetRenderVersion@0", &hwdriver.pfnGetRenderVersion}, -#ifdef SHUFFLE - {"PostImgRedraw@4", &hwdriver.pfnPostImgRedraw}, -#endif - {"FlushScreenTextures@0",&hwdriver.pfnFlushScreenTextures}, - {"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe}, - {"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe}, - {"DoScreenWipe@0", &hwdriver.pfnDoScreenWipe}, - {"DrawIntermissionBG@0",&hwdriver.pfnDrawIntermissionBG}, - {"MakeScreenTexture@0", &hwdriver.pfnMakeScreenTexture}, - {"MakeScreenFinalTexture@0", &hwdriver.pfnMakeScreenFinalTexture}, - {"DrawScreenFinalTexture@8", &hwdriver.pfnDrawScreenFinalTexture}, -#else - {"Init", &hwdriver.pfnInit}, - {"Shutdown", &hwdriver.pfnShutdown}, - {"GetModeList", &hwdriver.pfnGetModeList}, - {"SetPalette", &hwdriver.pfnSetPalette}, - {"FinishUpdate", &hwdriver.pfnFinishUpdate}, - {"Draw2DLine", &hwdriver.pfnDraw2DLine}, - {"DrawPolygon", &hwdriver.pfnDrawPolygon}, - {"RenderSkyDome", &hwdriver.pfnRenderSkyDome}, - {"SetBlend", &hwdriver.pfnSetBlend}, - {"ClearBuffer", &hwdriver.pfnClearBuffer}, - {"SetTexture", &hwdriver.pfnSetTexture}, - {"UpdateTexture", &hwdriver.pfnUpdateTexture}, - {"DeleteTexture", &hwdriver.pfnDeleteTexture}, - {"ReadRect", &hwdriver.pfnReadRect}, - {"GClipRect", &hwdriver.pfnGClipRect}, - {"ClearMipMapCache", &hwdriver.pfnClearMipMapCache}, - {"SetSpecialState", &hwdriver.pfnSetSpecialState}, - {"DrawModel", &hwdriver.pfnDrawModel}, - {"SetTransform", &hwdriver.pfnSetTransform}, - {"GetTextureUsed", &hwdriver.pfnGetTextureUsed}, - {"GetRenderVersion", &hwdriver.pfnGetRenderVersion}, -#ifdef SHUFFLE - {"PostImgRedraw", &hwdriver.pfnPostImgRedraw}, -#endif - {"FlushScreenTextures", &hwdriver.pfnFlushScreenTextures}, - {"StartScreenWipe", &hwdriver.pfnStartScreenWipe}, - {"EndScreenWipe", &hwdriver.pfnEndScreenWipe}, - {"DoScreenWipe", &hwdriver.pfnDoScreenWipe}, - {"DrawIntermissionBG", &hwdriver.pfnDrawIntermissionBG}, - {"MakeScreenTexture", &hwdriver.pfnMakeScreenTexture}, - {"MakeScreenFinalTexture", &hwdriver.pfnMakeScreenFinalTexture}, - {"DrawScreenFinalTexture", &hwdriver.pfnDrawScreenFinalTexture}, -#endif - {NULL,NULL} -}; - -BOOL Init3DDriver (LPCSTR dllName) -{ - hwdModule = LoadDLL(dllName, hwdFuncTable); - return (hwdModule != NULL); -} - -VOID Shutdown3DDriver (VOID) -{ - UnloadDLL(&hwdModule); -} -#endif - -#ifdef HW3SOUND -static HMODULE hwsModule = NULL; - -static loadfunc_t hwsFuncTable[] = { -#ifdef _X86_ - {"Startup@8", &hw3ds_driver.pfnStartup}, - {"Shutdown@0", &hw3ds_driver.pfnShutdown}, - {"AddSfx@4", &hw3ds_driver.pfnAddSfx}, - {"AddSource@8", &hw3ds_driver.pfnAddSource}, - {"StartSource@4", &hw3ds_driver.pfnStartSource}, - {"StopSource@4", &hw3ds_driver.pfnStopSource}, - {"GetHW3DSVersion@0", &hw3ds_driver.pfnGetHW3DSVersion}, - {"BeginFrameUpdate@0", &hw3ds_driver.pfnBeginFrameUpdate}, - {"EndFrameUpdate@0", &hw3ds_driver.pfnEndFrameUpdate}, - {"IsPlaying@4", &hw3ds_driver.pfnIsPlaying}, - {"UpdateListener@8", &hw3ds_driver.pfnUpdateListener}, - {"UpdateSourceParms@12", &hw3ds_driver.pfnUpdateSourceParms}, - {"SetCone@8", &hw3ds_driver.pfnSetCone}, - {"SetGlobalSfxVolume@4", &hw3ds_driver.pfnSetGlobalSfxVolume}, - {"Update3DSource@8", &hw3ds_driver.pfnUpdate3DSource}, - {"ReloadSource@8", &hw3ds_driver.pfnReloadSource}, - {"KillSource@4", &hw3ds_driver.pfnKillSource}, - {"KillSfx@4", &hw3ds_driver.pfnKillSfx}, - {"GetHW3DSTitle@8", &hw3ds_driver.pfnGetHW3DSTitle}, -#else - {"Startup", &hw3ds_driver.pfnStartup}, - {"Shutdown", &hw3ds_driver.pfnShutdown}, - {"AddSfx", &hw3ds_driver.pfnAddSfx}, - {"AddSource", &hw3ds_driver.pfnAddSource}, - {"StartSource", &hw3ds_driver.pfnStartSource}, - {"StopSource", &hw3ds_driver.pfnStopSource}, - {"GetHW3DSVersion", &hw3ds_driver.pfnGetHW3DSVersion}, - {"BeginFrameUpdate", &hw3ds_driver.pfnBeginFrameUpdate}, - {"EndFrameUpdate", &hw3ds_driver.pfnEndFrameUpdate}, - {"IsPlaying", &hw3ds_driver.pfnIsPlaying}, - {"UpdateListener", &hw3ds_driver.pfnUpdateListener}, - {"UpdateSourceParms", &hw3ds_driver.pfnUpdateSourceParms}, - {"SetCone", &hw3ds_driver.pfnSetCone}, - {"SetGlobalSfxVolume", &hw3ds_driver.pfnSetGlobalSfxVolume}, - {"Update3DSource", &hw3ds_driver.pfnUpdate3DSource}, - {"ReloadSource", &hw3ds_driver.pfnReloadSource}, - {"KillSource", &hw3ds_driver.pfnKillSource}, - {"KillSfx", &hw3ds_driver.pfnKillSfx}, - {"GetHW3DSTitle", &hw3ds_driver.pfnGetHW3DSTitle}, -#endif - {NULL, NULL} -}; - -BOOL Init3DSDriver(LPCSTR dllName) -{ - hwsModule = LoadDLL(dllName, hwsFuncTable); - return (hwsModule != NULL); -} - -VOID Shutdown3DSDriver (VOID) -{ - UnloadDLL(&hwsModule); -} -#endif -#endif //_WINDOWS diff --git a/src/win32/win_dll.h b/src/win32/win_dll.h deleted file mode 100644 index b4b259587..000000000 --- a/src/win32/win_dll.h +++ /dev/null @@ -1,31 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief load/unload a DLL at run-time - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include - -#ifdef HWRENDER -BOOL Init3DDriver (LPCSTR dllName); -VOID Shutdown3DDriver (VOID); -#endif - -#ifdef HW3SOUND -BOOL Init3DSDriver(LPCSTR dllName); -VOID Shutdown3DSDriver(VOID); -#endif diff --git a/src/win32/win_main.c b/src/win32/win_main.c deleted file mode 100644 index a5ebf3211..000000000 --- a/src/win32/win_main.c +++ /dev/null @@ -1,674 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 WinMain Entry Point -/// -/// Win32 Sonic Robo Blast 2 -/// -/// NOTE: -/// To compile WINDOWS SRB2 version : define a '_WINDOWS' symbol. -/// to do this go to Project/Settings/ menu, click C/C++ tab, in -/// 'Preprocessor definitions:' add '_WINDOWS' - -#include "../doomdef.h" -#include - -#ifdef _WINDOWS - -#include "../doomstat.h" // netgame -#include "resource.h" - -#include "../m_argv.h" -#include "../d_main.h" -#include "../i_system.h" - -#include "../keys.h" //hack quick test - -#include "../console.h" - -#include "fabdxlib.h" -#include "win_main.h" -#include "win_dbg.h" -#include "../s_sound.h" // pause sound with handling -#include "../g_input.h" // KEY_MOUSEWHEELxxx -#include "../screen.h" // for BASEVID* - -// MSWheel support for Win95/NT3.51 -#include - -#ifndef WM_XBUTTONDOWN -#define WM_XBUTTONDOWN 523 -#endif -#ifndef WM_XBUTTONUP -#define WM_XBUTTONUP 524 -#endif -#ifndef MK_XBUTTON1 -#define MK_XBUTTON1 32 -#endif -#ifndef MK_XBUTTON2 -#define MK_XBUTTON2 64 -#endif - -typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID); - -HWND hWndMain = NULL; -static HCURSOR windowCursor = NULL; // main window cursor - -static LPCSTR wClassName = "SRB2WC"; - -INT appActive = false; // app window is active - -#ifdef LOGMESSAGES -FILE *logstream; -#endif - -BOOL nodinput = FALSE; - -static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - event_t ev; //Doom input event - int mouse_keys; - - // judgecutor: - // Response MSH Mouse Wheel event - - if (message == MSHWheelMessage) - { - message = WM_MOUSEWHEEL; - wParam <<= 16; - } - - //I_OutputMsg("MainWndproc: %p,%i,%i,%i",hWnd, message, wParam, (UINT)lParam); - - switch (message) - { - case WM_CREATE: - nodinput = M_CheckParm("-nodinput"); - if (!nodinput && !LoadDirectInput()) - nodinput = true; - break; - - case WM_ACTIVATEAPP: // Handle task switching - appActive = (int)wParam; - - //coming back from alt-tab? reset the palette. - if (appActive) - vid.recalc = true; - - // pause music when alt-tab - if (appActive && !paused) - S_ResumeAudio(); - else if (!paused) - S_PauseAudio(); - { - HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - DWORD mode; - if (ci != INVALID_HANDLE_VALUE && GetFileType(ci) == FILE_TYPE_CHAR && GetConsoleMode(ci, &mode)) - appActive = true; - } - InvalidateRect (hWnd, NULL, TRUE); - break; - - case WM_PAINT: - if (!appActive && !bAppFullScreen && !netgame) - // app becomes inactive (if windowed) - { - // Paint "Game Paused" in the middle of the screen - PAINTSTRUCT ps; - RECT rect; - HDC hdc = BeginPaint (hWnd, &ps); - GetClientRect (hWnd, &rect); - DrawText (hdc, TEXT("Game Paused"), -1, &rect, - DT_SINGLELINE | DT_CENTER | DT_VCENTER); - EndPaint (hWnd, &ps); - return 0; - } - - break; - - case WM_QUERYNEWPALETTE: - RestoreDDPalette(); - return TRUE; - - case WM_PALETTECHANGED: - if((HWND)wParam != hWnd) - RestoreDDPalette(); - break; - - //case WM_RBUTTONDOWN: - //case WM_LBUTTONDOWN: - - case WM_MOVE: - if (bAppFullScreen) - { - SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - return 0; - } - else - { - windowPosX = (SHORT) LOWORD(lParam); // horizontal position - windowPosY = (SHORT) HIWORD(lParam); // vertical position - break; - } - break; - - // This is where switching windowed/fullscreen is handled. DirectDraw - // objects must be destroyed, recreated, and artwork reloaded. - - case WM_DISPLAYCHANGE: - case WM_SIZE: - break; - - case WM_SETCURSOR: - if (bAppFullScreen) - SetCursor(NULL); - else - SetCursor(windowCursor); - return TRUE; - - case WM_KEYUP: - ev.type = ev_keyup; - goto handleKeyDoom; - break; - - case WM_KEYDOWN: - ev.type = ev_keydown; - - handleKeyDoom: - ev.key = 0; - if (wParam == VK_PAUSE) - // intercept PAUSE key - { - ev.key = KEY_PAUSE; - } - else if (!keyboard_started) - // post some keys during the game startup - // (allow escaping from network synchronization, or pressing enter after - // an error message in the console) - { - switch (wParam) - { - case VK_ESCAPE: ev.key = KEY_ESCAPE; break; - case VK_RETURN: ev.key = KEY_ENTER; break; - case VK_SHIFT: ev.key = KEY_LSHIFT; break; - default: ev.key = MapVirtualKey((DWORD)wParam,2); // convert in to char - } - } - - if (ev.key) - D_PostEvent (&ev); - - return 0; - break; - - // judgecutor: - // Handle mouse events - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MOUSEMOVE: - if (nodinput) - { - mouse_keys = 0; - if (wParam & MK_LBUTTON) - mouse_keys |= 1; - if (wParam & MK_RBUTTON) - mouse_keys |= 2; - if (wParam & MK_MBUTTON) - mouse_keys |= 4; - I_GetSysMouseEvents(mouse_keys); - } - break; - - case WM_XBUTTONUP: - if (nodinput) - { - ev.type = ev_keyup; - ev.key = KEY_MOUSE1 + 3 + HIWORD(wParam); - D_PostEvent(&ev); - return TRUE; - } - break; - case WM_XBUTTONDOWN: - if (nodinput) - { - ev.type = ev_keydown; - ev.key = KEY_MOUSE1 + 3 + HIWORD(wParam); - D_PostEvent(&ev); - return TRUE; - } - break; - case WM_MOUSEWHEEL: - //I_OutputMsg("MW_WHEEL dispatched.\n"); - ev.type = ev_keydown; - if ((INT16)HIWORD(wParam) > 0) - ev.key = KEY_MOUSEWHEELUP; - else - ev.key = KEY_MOUSEWHEELDOWN; - D_PostEvent(&ev); - break; - - case WM_SETTEXT: - COM_BufAddText((LPCSTR)lParam); - return TRUE; - break; - - case WM_CLOSE: - PostQuitMessage(0); //to quit while in-game - ev.key = KEY_ESCAPE; //to exit network synchronization - ev.type = ev_keydown; - D_PostEvent (&ev); - return 0; - case WM_DESTROY: - //faB: main app loop will exit the loop and proceed with I_Quit() - PostQuitMessage(0); - break; - - case WM_SYSCOMMAND: - // Don't allow the keyboard to activate the menu. - if(wParam == SC_KEYMENU) - return 0; - - break; - - default: - break; - } - - return DefWindowProc(hWnd, message, wParam, lParam); -} - -static inline VOID OpenTextConsole(VOID) -{ - HANDLE ci, co; - BOOL console; - -#ifdef _DEBUG - console = M_CheckParm("-noconsole") == 0; -#else - console = M_CheckParm("-console") != 0; -#endif - - dedicated = M_CheckParm("-dedicated") != 0; - - if (M_CheckParm("-detachconsole")) - { - if (FreeConsole()) - { - I_OutputMsg("Detatched console.\n"); - console = TRUE; //lets get back a console - } - else - { - I_OutputMsg("No console to detatch.\n"); - I_ShowLastError(FALSE); - } - } - - if (dedicated || console) - { - if (AllocConsole()) //Let get the real console HANDLEs, because Mingw's Bash is bad! - { - SetConsoleTitleA("SRB2 Console"); - CONS_Printf(M_GetText("Hello, it's me, SRB2's Console Window\n")); - } - else - { - I_OutputMsg("We have a console already.\n"); - I_ShowLastError(FALSE); - return; - } - } - else - return; - - ci = CreateFile(TEXT("CONIN$") , GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (ci != INVALID_HANDLE_VALUE) - { - HANDLE sih = GetStdHandle(STD_INPUT_HANDLE); - if (sih != ci) - { - I_OutputMsg("Old STD_INPUT_HANDLE: %p\nNew STD_INPUT_HANDLE: %p\n", sih, ci); - SetStdHandle(STD_INPUT_HANDLE,ci); - } - else - I_OutputMsg("STD_INPUT_HANDLE already set at %p\n", ci); - - if (GetFileType(ci) == FILE_TYPE_CHAR) - { -#if 0 - const DWORD CM = ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_INPUT; //default mode but no ENABLE_MOUSE_INPUT - if (SetConsoleMode(ci,CM)) - { - I_OutputMsg("Disabled mouse input on the console\n"); - } - else - { - I_OutputMsg("Could not disable mouse input on the console\n"); - I_ShowLastError(FALSE); - } -#endif - } - else - I_OutputMsg("Handle CONIN$ in not a Console HANDLE\n"); - } - else - { - I_OutputMsg("Could not get a CONIN$ HANDLE\n"); - I_ShowLastError(FALSE); - } - - co = CreateFile(TEXT("CONOUT$"), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (co != INVALID_HANDLE_VALUE) - { - HANDLE soh = GetStdHandle(STD_OUTPUT_HANDLE); - HANDLE seh = GetStdHandle(STD_ERROR_HANDLE); - if (soh != co) - { - I_OutputMsg("Old STD_OUTPUT_HANDLE: %p\nNew STD_OUTPUT_HANDLE: %p\n", soh, co); - SetStdHandle(STD_OUTPUT_HANDLE,co); - } - else - I_OutputMsg("STD_OUTPUT_HANDLE already set at %p\n", co); - if (seh != co) - { - I_OutputMsg("Old STD_ERROR_HANDLE: %p\nNew STD_ERROR_HANDLE: %p\n", seh, co); - SetStdHandle(STD_ERROR_HANDLE,co); - } - else - I_OutputMsg("STD_ERROR_HANDLE already set at %p\n", co); - } - else - I_OutputMsg("Could not get a CONOUT$ HANDLE\n"); -} - - -// -// Do that Windows initialization stuff... -// -static HWND OpenMainWindow (HINSTANCE hInstance, LPSTR wTitle) -{ - const LONG styles = WS_CAPTION|WS_POPUP|WS_SYSMENU, exstyles = 0; - HWND hWnd; - WNDCLASSEXA wc; - RECT bounds; - - // Set up and register window class - ZeroMemory(&wc, sizeof(wc)); - wc.cbSize = sizeof(wc); - wc.style = CS_HREDRAW | CS_VREDRAW /*| CS_DBLCLKS*/; - wc.lpfnWndProc = MainWndproc; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DLICON1)); - windowCursor = LoadCursor(NULL, IDC_WAIT); //LoadCursor(hInstance, MAKEINTRESOURCE(IDC_DLCURSOR1)); - wc.hCursor = windowCursor; - wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.lpszClassName = wClassName; - - if (!RegisterClassExA(&wc)) - { - I_OutputMsg("Error doing RegisterClassExA\n"); - I_ShowLastError(TRUE); - return INVALID_HANDLE_VALUE; - } - - // Create a window - // CreateWindowEx - seems to create just the interior, not the borders - - bounds.left = 0; - bounds.right = dedicated ? 0 : specialmodes[0].width; - bounds.top = 0; - bounds.bottom = dedicated ? 0 : specialmodes[0].height; - - AdjustWindowRectEx(&bounds, styles, FALSE, exstyles); - - hWnd = CreateWindowExA( - exstyles, //ExStyle - wClassName, //Classname - wTitle, //Windowname - styles, //dwStyle //WS_VISIBLE|WS_POPUP for bAppFullScreen - 0, - 0, - bounds.right - bounds.left, //GetSystemMetrics(SM_CXSCREEN), - bounds.bottom - bounds.top, //GetSystemMetrics(SM_CYSCREEN), - NULL, //hWnd Parent - NULL, //hMenu Menu - hInstance, - NULL); - - if (hWnd == INVALID_HANDLE_VALUE) - { - I_OutputMsg("Error doing CreateWindowExA\n"); - I_ShowLastError(TRUE); - } - - return hWnd; -} - - -static inline BOOL tlErrorMessage(const TCHAR *err) -{ - /* make the cursor visible */ - SetCursor(LoadCursor(NULL, IDC_ARROW)); - - // - // warn user if there is one - // - printf("Error %s..\n", err); - fflush(stdout); - - MessageBox(hWndMain, err, TEXT("ERROR"), MB_OK); - return FALSE; -} - - -// ------------------ -// Command line stuff -// ------------------ -#define MAXCMDLINEARGS 64 -static char * myWargv[MAXCMDLINEARGS+1]; -static char myCmdline[512]; - -static VOID GetArgcArgv (LPSTR cmdline) -{ - LPSTR tokenstr; - size_t i = 0, len; - char cSep = ' '; - BOOL bCvar = FALSE, prevCvar = FALSE; - - // split arguments of command line into argv - strlcpy (myCmdline, cmdline, sizeof(myCmdline)); // in case window's cmdline is in protected memory..for strtok - len = strlen (myCmdline); - - myargc = 0; - while (myargc < MAXCMDLINEARGS) - { - // get token - while (myCmdline[i] == cSep) - i++; - if (i >= len) - break; - tokenstr = myCmdline + i; - if (myCmdline[i] == '"') - { - cSep = '"'; - i++; - if (!prevCvar) //cvar leave the "" in - tokenstr++; - } - else - cSep = ' '; - - //cvar - if (myCmdline[i] == '+' && cSep == ' ') //a + begins a cvarname, but not after quotes - bCvar = TRUE; - else - bCvar = FALSE; - - while (myCmdline[i] && - myCmdline[i] != cSep) - i++; - - if (myCmdline[i] == '"') - { - cSep = ' '; - if (prevCvar) - i++; // get ending " quote in arg - } - - prevCvar = bCvar; - - if (myCmdline + i > tokenstr) - { - myWargv[myargc++] = tokenstr; - } - - if (!myCmdline[i] || i >= len) - break; - - myCmdline[i++] = '\0'; - } - myWargv[myargc] = NULL; - - // m_argv.c uses myargv[], we used myWargv because we fill the arguments ourselves - // and myargv is just a pointer, so we set it to point myWargv - myargv = myWargv; -} - -static inline VOID MakeCodeWritable(VOID) -{ -#ifdef USEASM // Disable write-protection of code segment - DWORD OldRights; - const DWORD NewRights = PAGE_EXECUTE_READWRITE; - PBYTE pBaseOfImage = (PBYTE)GetModuleHandle(NULL); - PIMAGE_DOS_HEADER dosH =(PIMAGE_DOS_HEADER)pBaseOfImage; - PIMAGE_NT_HEADERS ntH = (PIMAGE_NT_HEADERS)(pBaseOfImage + dosH->e_lfanew); - PIMAGE_OPTIONAL_HEADER oH = (PIMAGE_OPTIONAL_HEADER) - ((PBYTE)ntH + sizeof (IMAGE_NT_SIGNATURE) + sizeof (IMAGE_FILE_HEADER)); - LPVOID pA = pBaseOfImage+oH->BaseOfCode; - SIZE_T pS = oH->SizeOfCode; -#if 1 // try to find the text section - PIMAGE_SECTION_HEADER ntS = IMAGE_FIRST_SECTION (ntH); - WORD s; - for (s = 0; s < ntH->FileHeader.NumberOfSections; s++) - { - if (memcmp (ntS[s].Name, ".text\0\0", 8) == 0) - { - pA = pBaseOfImage+ntS[s].VirtualAddress; - pS = ntS[s].Misc.VirtualSize; - break; - } - } -#endif - - if (!VirtualProtect(pA,pS,NewRights,&OldRights)) - I_Error("Could not make code writable\n"); -#endif -} - -// ----------------------------------------------------------------------------- -// HandledWinMain : called by exception handler -// ----------------------------------------------------------------------------- -static int WINAPI HandledWinMain(HINSTANCE hInstance) -{ - LPSTR args; - -#ifdef LOGMESSAGES - // DEBUG!!! - set logstream to NULL to disable debug log - // Replace WIN32 filehandle with standard C calls, because WIN32 doesn't handle \n properly. - logstream = fopen(va("%s"PATHSEP"%s", srb2home, "log.txt"), "wt"); -#endif - - // fill myargc,myargv for m_argv.c retrieval of cmdline arguments - args = GetCommandLineA(); - CONS_Printf("Command line arguments: '%s'\n", args); - GetArgcArgv(args); - // Create a text console window - OpenTextConsole(); - -#ifdef _DEBUG - { - int i; - CONS_Printf("Myargc: %d\n", myargc); - for (i = 0; i < myargc; i++) - CONS_Printf("myargv[%d] : '%s'\n", i, myargv[i]); - } -#endif - - // open a dummy window, both OpenGL and DirectX need one. - if ((hWndMain = OpenMainWindow(hInstance, va("SRB2 "VERSIONSTRING))) == INVALID_HANDLE_VALUE) - { - tlErrorMessage(TEXT("Couldn't open window")); - return FALSE; - } - - // currently starts DirectInput - CONS_Printf("I_StartupSystem() ...\n"); - I_StartupSystem(); - MakeCodeWritable(); - - // startup SRB2 - CONS_Printf("Setting up SRB2...\n"); - D_SRB2Main(); - CONS_Printf("Entering main game loop...\n"); - // never return - D_SRB2Loop(); - - // back to Windoze - return 0; -} - -// ----------------------------------------------------------------------------- -// Exception handler calls WinMain for catching exceptions -// ----------------------------------------------------------------------------- -int WINAPI WinMain (HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - int Result = -1; - UNREFERENCED_PARAMETER(hPrevInstance); - UNREFERENCED_PARAMETER(lpCmdLine); - UNREFERENCED_PARAMETER(nCmdShow); - - { -#if 0 - p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"),"IsDebuggerPresent"); - if((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent()) -#ifdef BUGTRAP - && !InitBugTrap() -#endif - ) -#endif - { - LoadLibraryA("exchndl.dll"); - } - } -#ifndef __MINGW32__ - prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo); -#endif - Result = HandledWinMain(hInstance); -#ifdef BUGTRAP - // This is safe even if BT didn't start. - ShutdownBugTrap(); -#endif - - return Result; -} -#endif //_WINDOWS diff --git a/src/win32/win_main.h b/src/win32/win_main.h deleted file mode 100644 index 326a813dd..000000000 --- a/src/win32/win_main.h +++ /dev/null @@ -1,45 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 Sharing - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#include - -extern HWND hWndMain; - -extern INT appActive; - -VOID I_GetSysMouseEvents(INT mouse_state); -extern UINT MSHWheelMessage; - -extern BOOL nodinput; -BOOL LoadDirectInput(VOID); - -//faB: midi channel Volume set is delayed by the MIDI stream callback thread, see win_snd.c -#define WM_MSTREAM_UPDATEVOLUME (WM_USER + 101) - -// defined in win_sys.c -VOID I_BeginProfile(VOID); //for timing code -DWORD I_EndProfile(VOID); - -VOID I_ShowLastError(BOOL MB); -VOID I_LoadingScreen (LPCSTR msg); - -VOID I_RestartSysMouse(VOID); -VOID I_DoStartupMouse(VOID); diff --git a/src/win32/win_net.c b/src/win32/win_net.c deleted file mode 100644 index 62c081bbe..000000000 --- a/src/win32/win_net.c +++ /dev/null @@ -1,42 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 network interface - -#include "../doomdef.h" -#include "../m_argv.h" -#include "../i_net.h" - -#ifdef _WINDOWS - -// -// NETWORKING -// - -// -// I_InitNetwork -// -boolean I_InitNetwork(void) -{ - if (M_CheckParm ("-net")) - { - I_Error("The Win32 version of SRB2 doesn't work with external drivers like ipxsetup, sersetup, or doomatic\n" - "Read the documentation about \"-server\" and \"-connect\" parameters or just use the launcher\n"); - } - - return false; -} -#endif diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c deleted file mode 100644 index 13f766728..000000000 --- a/src/win32/win_snd.c +++ /dev/null @@ -1,959 +0,0 @@ -/// \file -/// \brief FMOD Ex interface for sound -#include "../doomdef.h" -#include "../sounds.h" -#include "../i_sound.h" -#include "../s_sound.h" -#include "../w_wad.h" -#include "../z_zone.h" -#include "../byteptr.h" - -#include // FMOD Ex -#define errcode _errcode -#include -#undef errcode - -#ifdef HAVE_LIBGME -#include "gme/gme.h" -#define GME_TREBLE 5.0 -#define GME_BASS 1.0 - -#ifdef HAVE_ZLIB -#ifndef _MSC_VER -#ifndef _LARGEFILE64_SOURCE -#define _LARGEFILE64_SOURCE -#endif -#endif - -#ifndef _LFS64_LARGEFILE -#define _LFS64_LARGEFILE -#endif - -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 0 -#endif - -#include "zlib.h" -#endif // HAVE_ZLIB -#endif // HAVE_LIBGME - -static FMOD_SYSTEM *fsys; -static FMOD_SOUND *music_stream; -static FMOD_CHANNEL *music_channel; - -static UINT8 music_volume, midi_volume, sfx_volume; -static INT32 current_track; - -#ifdef HAVE_LIBGME -static Music_Emu *gme; -#endif - -// -// SYSTEM -// - -// spew console messages for general errors. -static void FMR_Debug(FMOD_RESULT e, int line) -{ - if (e != FMOD_OK) - CONS_Alert(CONS_ERROR, "FMOD:%d - %s\n", line, FMOD_ErrorString(e)); -} -#define FMR(x) FMR_Debug(x, __LINE__) - -// for operations on music_channel ONLY. -// returns false if music was released. -// (in other words, if !FMR_MUSIC(op) return immediately, -// because music_stream and music_channel are no longer valid.) -static boolean FMR_Music_Debug(FMOD_RESULT e, int line) -{ - switch(e) - { - case FMOD_ERR_INVALID_HANDLE: // non-looping song ended - case FMOD_ERR_CHANNEL_STOLEN: // song ended and then sfx was played - FMOD_Sound_Release(music_stream); - music_stream = NULL; - return false; - default: - FMR_Debug(e, line); - break; - } - return true; -} -#define FMR_MUSIC(x) FMR_Music_Debug(x, __LINE__) - -void I_StartupSound(void) -{ - I_Assert(!sound_started); - sound_started = true; - - FMR(FMOD_System_Create(&fsys)); - FMR(FMOD_System_SetDSPBufferSize(fsys, 44100 / 30, 2)); - FMR(FMOD_System_Init(fsys, 64, FMOD_INIT_VOL0_BECOMES_VIRTUAL, NULL)); - music_stream = NULL; -#ifdef HAVE_LIBGME - gme = NULL; -#endif - current_track = -1; -} - -void I_ShutdownSound(void) -{ - I_Assert(sound_started); - sound_started = false; - -#ifdef HAVE_LIBGME - if (gme) - gme_delete(gme); -#endif - FMR(FMOD_System_Release(fsys)); -} - -void I_UpdateSound(void) -{ - FMR(FMOD_System_Update(fsys)); -} - -#ifdef HAVE_LIBGME -// Callback hook to read streaming GME data. -static FMOD_RESULT F_CALLBACK GMEReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen) -{ - Music_Emu *emu; - void *emuvoid = NULL; - // get our emu - FMR(FMOD_Sound_GetUserData(sound, &emuvoid)); - emu = emuvoid; - // no emu? no play. - if (!emu) - return FMOD_ERR_FILE_EOF; - if (gme_track_ended(emu)) - { - // don't delete the primary music stream - if (emu == gme) - return FMOD_ERR_FILE_EOF; - // do delete sfx streams - FMR(FMOD_Sound_SetUserData(sound, NULL)); - gme_delete(emu); - return FMOD_ERR_FILE_EOF; - } - // play beautiful musics theme of ancient land. - if (gme_play(emu, datalen/2, data)) - return FMOD_ERR_FILE_BAD; - // O.K - return FMOD_OK; -} -#endif - -// -// SFX -// - -// convert doom format sound (signed 8bit) -// to an fmod format sound (unsigned 8bit) -// and return the FMOD_SOUND. -static inline FMOD_SOUND *ds2fmod(char *stream) -{ - FMOD_SOUND *sound; - UINT16 ver; - UINT16 freq; - UINT32 samples; - FMOD_CREATESOUNDEXINFO fmt; - UINT32 i; - UINT8 *p; - - // lump header - ver = READUINT16(stream); // sound version format? - if (ver != 3) // It should be 3 if it's a doomsound... - return NULL; // onos! it's not a doomsound! - freq = READUINT16(stream); - samples = READUINT32(stream); - //CONS_Printf("FMT: v%d f%d, s%d, b%d\n", ver, freq, samples, bps); - - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - - // convert to unsigned - fmt.format = FMOD_SOUND_FORMAT_PCM8; // 8bit - fmt.length = samples*1; // 1 bps - fmt.numchannels = 1; // mono - fmt.defaultfrequency = freq; - - // Make a duplicate of the stream to change format. - p = Z_Malloc(fmt.length, PU_SOUND, NULL); - for (i = 0; i < fmt.length; i++) - p[i] = (UINT8)(stream[i]+0x80); // convert from signed to unsigned - stream = (char *)p; - - // Create FMOD_SOUND. - FMR(FMOD_System_CreateSound(fsys, stream, FMOD_CREATESAMPLE|FMOD_OPENMEMORY|FMOD_OPENRAW|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - - Z_Free(stream); // FMOD made its own copy, so we don't need this anymore. - return sound; -} - -void *I_GetSfx(sfxinfo_t *sfx) -{ - FMOD_SOUND *sound; - char *lump; - FMOD_CREATESOUNDEXINFO fmt; -#ifdef HAVE_LIBGME - Music_Emu *emu; - gme_info_t *info; -#endif - - if (sfx->lumpnum == LUMPERROR) - sfx->lumpnum = S_GetSfxLumpNum(sfx); - sfx->length = W_LumpLength(sfx->lumpnum); - - lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND); - sound = ds2fmod(lump); - if (sound) - { - Z_Free(lump); - return sound; - } - - // It's not a doom sound. - // Try to read it as an FMOD sound? - - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - fmt.length = sfx->length; - -#ifdef HAVE_LIBGME - // VGZ format - if ((UINT8)lump[0] == 0x1F - && (UINT8)lump[1] == 0x8B) - { -#ifdef HAVE_ZLIB - UINT8 *inflatedData; - size_t inflatedLen; - z_stream stream; - int zErr; // Somewhere to handle any error messages zlib tosses out - - memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream - // Begin the inflation process - inflatedLen = *(UINT32 *)(lump + (sfx->length-4)); // Last 4 bytes are the decompressed size, typically - inflatedData = (UINT8 *)Z_Malloc(inflatedLen, PU_SOUND, NULL); // Make room for the decompressed data - stream.total_in = stream.avail_in = sfx->length; - stream.total_out = stream.avail_out = inflatedLen; - stream.next_in = (UINT8 *)lump; - stream.next_out = inflatedData; - - zErr = inflateInit2(&stream, 32 + MAX_WBITS); - if (zErr == Z_OK) // We're good to go - { - zErr = inflate(&stream, Z_FINISH); - if (zErr == Z_STREAM_END) { - // Run GME on new data - if (!gme_open_data(inflatedData, inflatedLen, &emu, 44100)) - { - Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around - Z_Free(lump); // We're done with the uninflated lump now, too. - - gme_start_track(emu, 0); - gme_track_info(emu, &info, 0); - - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = ((UINT32)info->play_length * 441 / 10) * 4; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = emu; - - FMR(FMOD_System_CreateSound(fsys, NULL, FMOD_CREATESAMPLE|FMOD_OPENUSER|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - return sound; - } - } - else - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg); - } - (void)inflateEnd(&stream); - } - else // Hold up, zlib's got a problem - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg); - } - Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up -#else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); -#endif - } - // Try to read it as a GME sound - else if (!gme_open_data(lump, sfx->length, &emu, 44100)) - { - Z_Free(lump); - - gme_start_track(emu, 0); - gme_track_info(emu, &info, 0); - - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = ((UINT32)info->play_length * 441 / 10) * 4; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = emu; - - gme_free_info(info); - - FMR(FMOD_System_CreateSound(fsys, NULL, FMOD_CREATESAMPLE|FMOD_OPENUSER|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - return sound; - } -#endif - - // Ogg, Mod, Midi, etc. - FMR(FMOD_System_CreateSound(fsys, lump, FMOD_CREATESAMPLE|FMOD_OPENMEMORY|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - Z_Free(lump); // We're done with the lump now, at least. - return sound; -} - -void I_FreeSfx(sfxinfo_t *sfx) -{ - if (sfx->data) - FMOD_Sound_Release(sfx->data); - sfx->data = NULL; -} - -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) -{ - FMOD_SOUND *sound; - FMOD_CHANNEL *chan; - INT32 i; - float frequency; - (void)channel; - - sound = (FMOD_SOUND *)S_sfx[id].data; - I_Assert(sound != NULL); - - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, sound, true, &chan)); - - if (sep == 0) - sep = 1; - - FMR(FMOD_Channel_SetVolume(chan, (vol / 255.0) * (sfx_volume / 31.0))); - FMR(FMOD_Channel_SetPan(chan, (sep - 128) / 127.0)); - - FMR(FMOD_Sound_GetDefaults(sound, &frequency, NULL, NULL, NULL)); - FMR(FMOD_Channel_SetFrequency(chan, (pitch / 128.0) * frequency)); - - FMR(FMOD_Channel_SetPriority(chan, priority)); - //UNREFERENCED_PARAMETER(priority); - //FMR(FMOD_Channel_SetPriority(chan, 1 + ((0xff-vol)>>1))); // automatic priority 1 - 128 based on volume (priority 0 is music) - - FMR(FMOD_Channel_GetIndex(chan, &i)); - FMR(FMOD_Channel_SetPaused(chan, false)); - return i; -} - -void I_StopSound(INT32 handle) -{ - FMOD_CHANNEL *chan; - FMR(FMOD_System_GetChannel(fsys, handle, &chan)); - if (music_stream && chan == music_channel) - return; - FMR(FMOD_Channel_Stop(chan)); -} - -boolean I_SoundIsPlaying(INT32 handle) -{ - FMOD_CHANNEL *chan; - FMOD_BOOL playing; - FMOD_RESULT e; - FMR(FMOD_System_GetChannel(fsys, handle, &chan)); - if (music_stream && chan == music_channel) - return false; - e = FMOD_Channel_IsPlaying(chan, &playing); - switch(e) - { - case FMOD_ERR_INVALID_HANDLE: // Sound effect finished. - case FMOD_ERR_CHANNEL_STOLEN: // Sound effect interrupted. -- technically impossible due to GetChannel by handle. :( - return false; // therefore, it's not playing anymore. - default: - FMR(e); - break; - } - return (boolean)playing; -} - -// seems to never be called on an invalid channel (calls I_SoundIsPlaying first?) -// so I'm not gonna worry about it. -void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch) -{ - FMOD_CHANNEL *chan; - FMOD_SOUND *sound; - float frequency; - - FMR(FMOD_System_GetChannel(fsys, handle, &chan)); - FMR(FMOD_Channel_SetVolume(chan, (vol / 255.0) * (sfx_volume / 31.0))); - FMR(FMOD_Channel_SetPan(chan, (sep - 128) / 127.0)); - - FMR(FMOD_Channel_GetCurrentSound(chan, &sound)); - FMR(FMOD_Sound_GetDefaults(sound, &frequency, NULL, NULL, NULL)); - FMR(FMOD_Channel_SetFrequency(chan, (pitch / 128.0) * frequency)); - - //FMR(FMOD_Channel_SetPriority(chan, 1 + ((0xff-vol)>>1))); // automatic priority 1 - 128 based on volume (priority 0 is music) -} - -void I_SetSfxVolume(UINT8 volume) -{ - // volume is 0 to 31. - sfx_volume = volume; -} - -/// ------------------------ -// MUSIC SYSTEM -/// ------------------------ - -void I_InitMusic(void) -{ -} - -void I_ShutdownMusic(void) -{ - I_StopSong(); -} - -/// ------------------------ -// MUSIC PROPERTIES -/// ------------------------ - -musictype_t I_SongType(void) -{ - FMOD_SOUND_TYPE type; - -#ifdef HAVE_LIBGME - if (gme) - return MU_GME; -#endif - - if (!music_stream) - return MU_NONE; - - if (FMOD_Sound_GetFormat(music_stream, &type, NULL, NULL, NULL) == FMOD_OK) - { - switch(type) - { - case FMOD_SOUND_TYPE_WAV: - return MU_WAV; - case FMOD_SOUND_TYPE_MOD: - return MU_MOD; - case FMOD_SOUND_TYPE_MIDI: - return MU_MID; - case FMOD_SOUND_TYPE_OGGVORBIS: - return MU_OGG; - case FMOD_SOUND_TYPE_MPEG: - return MU_MP3; - case FMOD_SOUND_TYPE_FLAC: - return MU_FLAC; - default: - return MU_NONE; - } - } - else - return MU_NONE; -} - -boolean I_SongPlaying(void) -{ - return (music_stream != NULL); -} - -boolean I_SongPaused(void) -{ - FMOD_BOOL fmpaused = false; - if (music_stream) - FMOD_Channel_GetPaused(music_channel, &fmpaused); - return (boolean)fmpaused; -} - -/// ------------------------ -// MUSIC EFFECTS -/// ------------------------ - -boolean I_SetSongSpeed(float speed) -{ - FMOD_RESULT e; - float frequency; - if (!music_stream) - return false; - if (speed > 250.0f) - speed = 250.0f; //limit speed up to 250x - -#ifdef HAVE_LIBGME - // Try to set GME speed - if (gme) - { - gme_set_tempo(gme, speed); - return true; - } -#endif - - // Try to set Mod/Midi speed - e = FMOD_Sound_SetMusicSpeed(music_stream, speed); - - if (e == FMOD_ERR_FORMAT) - { - // Just change pitch instead for Ogg/etc. - FMR(FMOD_Sound_GetDefaults(music_stream, &frequency, NULL, NULL, NULL)); - FMR_MUSIC(FMOD_Channel_SetFrequency(music_channel, speed*frequency)); - } - else - FMR_MUSIC(e); - - return true; -} - -/// ------------------------ -// MUSIC PLAYBACK -/// ------------------------ - -boolean I_LoadSong(char *data, size_t len) -{ - FMOD_CREATESOUNDEXINFO fmt; - FMOD_RESULT e; - FMOD_TAG tag; - unsigned int loopstart, loopend; - - if ( -#ifdef HAVE_LIBGME - gme || -#endif - music_stream - ) - I_UnloadSong(); - - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - -#ifdef HAVE_LIBGME - if ((UINT8)data[0] == 0x1F - && (UINT8)data[1] == 0x8B) - { -#ifdef HAVE_ZLIB - UINT8 *inflatedData; - size_t inflatedLen; - z_stream stream; - int zErr; // Somewhere to handle any error messages zlib tosses out - - memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream - // Begin the inflation process - inflatedLen = *(UINT32 *)(data + (len-4)); // Last 4 bytes are the decompressed size, typically - inflatedData = (UINT8 *)Z_Calloc(inflatedLen, PU_MUSIC, NULL); // Make room for the decompressed data - stream.total_in = stream.avail_in = len; - stream.total_out = stream.avail_out = inflatedLen; - stream.next_in = (UINT8 *)data; - stream.next_out = inflatedData; - - zErr = inflateInit2(&stream, 32 + MAX_WBITS); - if (zErr == Z_OK) // We're good to go - { - zErr = inflate(&stream, Z_FINISH); - if (zErr == Z_STREAM_END) { - // Run GME on new data - if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100)) - { - gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; - Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around - Z_Free(data); // We don't need this, either. - gme_set_equalizer(gme,&gmeq); - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = -1; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = gme; - FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream)); - return true; - } - } - else - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg); - } - (void)inflateEnd(&stream); - } - else // Hold up, zlib's got a problem - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg); - } - Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up -#else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); -#endif - } - else if (!gme_open_data(data, len, &gme, 44100)) - { - gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; - Z_Free(data); // We don't need this anymore. - gme_set_equalizer(gme,&gmeq); - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = -1; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = gme; - FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream)); - return true; - } -#endif - - fmt.length = len; - - e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream); - if (e != FMOD_OK) - { - if (e == FMOD_ERR_FORMAT) - CONS_Alert(CONS_WARNING, "Failed to play music lump due to invalid format.\n"); - else - FMR(e); - return false; - } - - // Try to find a loop point in streaming music formats (ogg, mp3) - - // A proper LOOPPOINT is its own tag, stupid. - e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - FMR(e); - loopstart = atoi((char *)tag.data); // assumed to be a string data tag. - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); - return true; - } - - // Use LOOPMS for time in miliseconds. - e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - FMR(e); - loopstart = atoi((char *)tag.data); // assumed to be a string data tag. - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM)); - return true; - } - - // Try to fetch it from the COMMENT tag, like A.J. Freda - e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - char *loopText; - // Handle any errors that arose, first - FMR(e); - // Figure out where the number starts - loopText = strstr((char *)tag.data,"LOOPPOINT="); - if (loopText != NULL) - { - // Skip the "LOOPPOINT=" part. - loopText += 10; - // Convert it to our looppoint - // FMOD seems to ensure the tag is properly NULL-terminated. - // atoi will stop when it reaches anything that's not a number. - loopstart = atoi(loopText); - // Now do the rest like above - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); - } - return true; - } - - // No special loop point - return true; -} - -void I_UnloadSong(void) -{ - I_StopSong(); -#ifdef HAVE_LIBGME - if (gme) - { - gme_delete(gme); - gme = NULL; - } -#endif - if (music_stream) - { - FMR(FMOD_Sound_Release(music_stream)); - music_stream = NULL; - } -} - -boolean I_PlaySong(boolean looping) -{ -#ifdef HAVE_LIBGME - if (gme) - { - gme_start_track(gme, 0); - current_track = 0; - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); - FMR(FMOD_Channel_SetPriority(music_channel, 0)); - return true; - } -#endif - - FMR(FMOD_Sound_SetMode(music_stream, (looping ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF))); - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - if (I_SongType() != MU_MID) - FMR(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0)); - else - FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); - FMR(FMOD_Channel_SetPriority(music_channel, 0)); - current_track = 0; - - return true; -} - -void I_StopSong(void) -{ - if (music_channel) - FMR_MUSIC(FMOD_Channel_Stop(music_channel)); -} - -void I_PauseSong(void) -{ - if (music_channel) - FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true)); -} - -void I_ResumeSong(void) -{ - if (music_channel) - FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false)); -} - -void I_SetMusicVolume(UINT8 volume) -{ - if (!music_channel) - return; - - // volume is 0 to 31. - if (I_SongType() == MU_MID) - music_volume = 31; // windows bug hack - else - music_volume = volume; - - FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); -} - -UINT32 I_GetSongLength(void) -{ - UINT32 length; - if (I_SongType() == MU_MID) - return 0; - FMR_MUSIC(FMOD_Sound_GetLength(music_stream, &length, FMOD_TIMEUNIT_MS)); - return length; -} - -boolean I_SetSongLoopPoint(UINT32 looppoint) -{ - (void)looppoint; - return false; -} - -UINT32 I_GetSongLoopPoint(void) -{ - return 0; -} - -boolean I_SetSongPosition(UINT32 position) -{ - FMOD_RESULT e; - if(I_SongType() == MU_MID) - // Dummy out; this works for some MIDI, but not others. - // SDL does not support this for any MIDI. - return false; - - e = FMOD_Channel_SetPosition(music_channel, position, FMOD_TIMEUNIT_MS); - if (e == FMOD_OK) - return true; - else if (e == FMOD_ERR_UNSUPPORTED // Only music modules, numbnuts! - || e == FMOD_ERR_INVALID_POSITION) // Out-of-bounds! - return false; - else // Congrats, you horribly broke it somehow - { - FMR_MUSIC(e); - return false; - } -} - -UINT32 I_GetSongPosition(void) -{ - FMOD_RESULT e; - unsigned int fmposition = 0; - if(I_SongType() == MU_MID) - // Dummy out because unsupported, even though FMOD does this correctly. - return 0; - e = FMOD_Channel_GetPosition(music_channel, &fmposition, FMOD_TIMEUNIT_MS); - if (e == FMOD_OK) - return (UINT32)fmposition; - else - return 0; -} - -boolean I_SetSongTrack(INT32 track) -{ - if (track != current_track) // If the track's already playing, then why bother? - { - FMOD_RESULT e; - - #ifdef HAVE_LIBGME - // If the specified track is within the number of tracks playing, then change it - if (gme) - { - if (track >= 0 - && track < gme_track_count(gme)) - { - gme_err_t gme_e = gme_start_track(gme,track); - if (gme_e == NULL) - { - current_track = track; - return true; - } - else - CONS_Alert(CONS_ERROR, "Encountered GME error: %s\n", gme_e); - } - return false; - } - #endif // HAVE_LIBGME - - // Try to set it via FMOD - e = FMOD_Channel_SetPosition(music_channel, (UINT32)track, FMOD_TIMEUNIT_MODORDER); - if (e == FMOD_OK) // We good - { - current_track = track; - return true; - } - else if (e == FMOD_ERR_UNSUPPORTED // Only music modules, numbnuts! - || e == FMOD_ERR_INVALID_POSITION) // Out-of-bounds! - return false; - else // Congrats, you horribly broke it somehow - { - FMR_MUSIC(e); - return false; - } - } - return false; -} - -/// ------------------------ -/// MUSIC FADING -/// ------------------------ - -void I_SetInternalMusicVolume(UINT8 volume) -{ - (void)volume; -} - -void I_StopFadingSong(void) -{ -} - -boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)) -{ - (void)target_volume; - (void)source_volume; - (void)ms; - (void)callback; - return false; -} - -boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)) -{ - (void)target_volume; - (void)ms; - (void)callback; - return false; -} - -boolean I_FadeOutStopSong(UINT32 ms) -{ - (void)ms; - return false; -} - -boolean I_FadeInPlaySong(UINT32 ms, boolean looping) -{ - (void)ms; - (void)looping; - return false; -} diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c deleted file mode 100644 index ff443935f..000000000 --- a/src/win32/win_sys.c +++ /dev/null @@ -1,3707 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief win32 system i/o -/// -/// Startup & Shutdown routines for music,sound,timer,keyboard,... -/// Signal handler to trap errors and exit cleanly. - -#include "../doomdef.h" - -#ifdef _WINDOWS - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "../m_misc.h" -#include "../i_video.h" -#include "../i_sound.h" -#include "../i_system.h" - -#include "../d_net.h" -#include "../g_game.h" - -#include "../d_main.h" - -#include "../m_argv.h" - -#include "../w_wad.h" -#include "../z_zone.h" -#include "../g_input.h" - -#include "../keys.h" - -#include "../screen.h" - -#include "../m_menu.h" - -// Wheel support for Win95/WinNT3.51 -#include - -// Taken from Win98/NT4.0 -#ifndef SM_MOUSEWHEELPRESENT -#define SM_MOUSEWHEELPRESENT 75 -#endif - -#ifndef MSH_MOUSEWHEEL -#ifdef UNICODE -#define MSH_MOUSEWHEEL L"MSWHEEL_ROLLMSG" -#else -#define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" -#endif -#endif - -#include "win_main.h" -#include "win_dbg.h" -#include "../i_joy.h" - -#ifndef NOMUMBLE -// Mumble context string -#include "../d_clisrv.h" -#include "../byteptr.h" -#endif - -#define DIRECTINPUT_VERSION 0x0500 -// Force dinput.h to generate old DX3 headers. -#define DXVERSION_NTCOMPATIBLE 0x0300 -#include -#ifndef IDirectInputEffect_Stop -#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) -#endif -#ifndef IDirectInputEffect_SetParameters -#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) -#endif -#ifndef IDirectInputEffect_Release -#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) -#endif - -#include "fabdxlib.h" - -/// \brief max number of joystick buttons -#define JOYBUTTONS_MAX 32 // rgbButtons[32] -/// \brief max number of joystick button events -#define JOYBUTTONS_MIN min((JOYBUTTONS),(JOYBUTTONS_MAX)) - -/// \brief max number of joysick axies -#define JOYAXISSET_MAX 4 // (lX, lY), (lZ,lRx), (lRy, lRz), rglSlider[2] is very diff -/// \brief max number ofjoystick axis events -#define JOYAXISSET_MIN min((JOYAXISSET),(JOYAXISSET_MAX)) - -/// \brief max number of joystick hats -#define JOYHATS_MAX 4 // rgdwPOV[4]; -/// \brief max number of joystick hat events -#define JOYHATS_MIN min((JOYHATS),(JOYHATS_MAX)) - -/// \brief max number of mouse buttons -#define MOUSEBUTTONS_MAX 8 // 8 bit of BYTE and DIMOFS_BUTTON7 -/// \brief max number of muse button events -#define MOUSEBUTTONS_MIN min((MOUSEBUTTONS),(MOUSEBUTTONS_MAX)) - -// ================== -// DIRECT INPUT STUFF -// ================== -BOOL bDX0300; // if true, we created a DirectInput 0x0300 version -static LPDIRECTINPUTA lpDI = NULL; -static LPDIRECTINPUTDEVICEA lpDIK = NULL; // Keyboard -static LPDIRECTINPUTDEVICEA lpDIM = NULL; // mice -static LPDIRECTINPUTDEVICEA lpDIJ = NULL; // joystick 1P -static LPDIRECTINPUTEFFECT lpDIE[NumberofForces]; // joystick 1Es -static LPDIRECTINPUTDEVICE2A lpDIJA = NULL; // joystick 1I -static LPDIRECTINPUTDEVICEA lpDIJ2 = NULL; // joystick 2P -static LPDIRECTINPUTEFFECT lpDIE2[NumberofForces]; // joystick 1Es -static LPDIRECTINPUTDEVICE2A lpDIJ2A = NULL;// joystick 2I - -// Do not execute cleanup code more than once. See Shutdown_xxx() routines. -UINT8 graphics_started = 0; -UINT8 keyboard_started = 0; -UINT8 sound_started = 0; -static boolean mouse_enabled = false; -static boolean joystick_detected = false; -static boolean joystick2_detected = false; - -static VOID I_ShutdownKeyboard(VOID); -static VOID I_GetKeyboardEvents(VOID); -static VOID I_ShutdownJoystick(VOID); -static VOID I_ShutdownJoystick2(VOID); - -static boolean entering_con_command = false; - -// -// Why would this be system specific?? hmmmm.... -// -// it is for virtual reality system, next incoming feature :) -static ticcmd_t emptycmd; -ticcmd_t *I_BaseTiccmd(void) -{ - return &emptycmd; -} - -static ticcmd_t emptycmd2; -ticcmd_t *I_BaseTiccmd2(void) -{ - return &emptycmd2; -} - -// Allocates the base zone memory, -// this function returns a valid pointer and size, -// else it should interrupt the program immediately. -// -// now checks if mem could be allocated, this is still -// prehistoric... there's a lot to do here: memory locking, detection -// of win95 etc... -// - -// return free and total memory in the system -UINT32 I_GetFreeMem(UINT32* total) -{ - MEMORYSTATUS info; - - info.dwLength = sizeof (MEMORYSTATUS); - GlobalMemoryStatus(&info); - if (total) - *total = (UINT32)info.dwTotalPhys; - return (UINT32)info.dwAvailPhys; -} - -// --------- -// I_Profile -// Two little functions to profile our code using the high resolution timer -// --------- -static LARGE_INTEGER ProfileCount; -VOID I_BeginProfile(VOID) -{ - if (!QueryPerformanceCounter(&ProfileCount)) - I_Error("I_BeginProfile failed"); // can't profile without the high res timer -} - -// we're supposed to use this to measure very small amounts of time, -// that's why we return a DWORD and not a 64bit value -DWORD I_EndProfile(VOID) -{ - LARGE_INTEGER CurrTime; - DWORD ret; - if (!QueryPerformanceCounter (&CurrTime)) - I_Error("I_EndProfile failed"); - if (CurrTime.QuadPart - ProfileCount.QuadPart > (LONGLONG)0xFFFFFFFFUL) - I_Error("I_EndProfile overflow"); - ret = (DWORD)(CurrTime.QuadPart - ProfileCount.QuadPart); - // we can call I_EndProfile() several time, I_BeginProfile() need be called just once - ProfileCount = CurrTime; - - return ret; -} - -// --------- -// I_GetTime -// Use the High Resolution Timer if available, -// else use the multimedia timer which has 1 millisecond precision on Windowz 95, -// but lower precision on Windows NT -// --------- -static long hacktics = 0; // used locally for keyboard repeat keys -static DWORD starttickcount = 0; // hack for win2k time bug - -tic_t I_GetTime(void) -{ - tic_t newtics = 0; - - if (!starttickcount) // high precision timer - { - LARGE_INTEGER currtime; // use only LowPart if high resolution counter is not available - static LARGE_INTEGER basetime = {{0, 0}}; - - // use this if High Resolution timer is found - static LARGE_INTEGER frequency; - - if (!basetime.LowPart) - { - if (!QueryPerformanceFrequency(&frequency)) - frequency.QuadPart = 0; - else - QueryPerformanceCounter(&basetime); - } - - if (frequency.LowPart && QueryPerformanceCounter(&currtime)) - { - newtics = (int)((currtime.QuadPart - basetime.QuadPart) * NEWTICRATE - / frequency.QuadPart); - } - else - { - currtime.LowPart = timeGetTime(); - if (!basetime.LowPart) - basetime.LowPart = currtime.LowPart; - newtics = ((currtime.LowPart - basetime.LowPart)/(1000/NEWTICRATE)); - } - } - else - newtics = (GetTickCount() - starttickcount)/(1000/NEWTICRATE); - - hacktics = newtics; // a local counter for keyboard repeat key - return newtics; -} - -void I_Sleep(void) -{ - if (cv_sleep.value != -1) - Sleep(cv_sleep.value); -} - -// should move to i_video -void I_WaitVBL(INT32 count) -{ - UNREFERENCED_PARAMETER(count); -} - -// this is probably to activate the 'loading' disc icon -// it should set a flag, that I_FinishUpdate uses to know -// whether it draws a small 'loading' disc icon on the screen or not -// -// also it should explicitly draw the disc because the screen is -// possibly not refreshed while loading -// -void I_BeginRead(void) {} - -// see above, end the 'loading' disc icon, set the flag false -// -void I_EndRead(void) {} - -// =========================================================================================== -// EVENTS -// =========================================================================================== -static BOOL I_ReadyConsole(HANDLE ci) -{ - DWORD gotinput; - if (ci == INVALID_HANDLE_VALUE) return FALSE; - if (WaitForSingleObject(ci,0) != WAIT_OBJECT_0) return FALSE; - if (GetFileType(ci) != FILE_TYPE_CHAR) return FALSE; - if (!GetConsoleMode(ci, &gotinput)) return FALSE; - return (GetNumberOfConsoleInputEvents(ci, &gotinput) && gotinput); -} - -static inline VOID I_GetConsoleEvents(VOID) -{ - event_t ev = {0,0,0,0}; - HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO CSBI; - INPUT_RECORD input; - DWORD t; - - while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t) - { - ZeroMemory(&ev, sizeof(ev)); - switch (input.EventType) - { - case KEY_EVENT: - if (input.Event.KeyEvent.bKeyDown) - { - ev.type = ev_console; - entering_con_command = true; - switch (input.Event.KeyEvent.wVirtualKeyCode) - { - case VK_ESCAPE: - case VK_TAB: - ev.key = KEY_NULL; - break; - case VK_SHIFT: - ev.key = KEY_LSHIFT; - break; - case VK_RETURN: - entering_con_command = false; - /* FALLTHRU */ - default: - ev.key = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char - } - if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t)) - { - if (ev.key && ev.key != KEY_LSHIFT && ev.key != KEY_RSHIFT) - { -#ifdef UNICODE - WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL); -#else - WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1, &t, NULL); -#endif - } - if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK - && GetConsoleScreenBufferInfo(co,&CSBI)) - { - WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t); - } - } - } - else - { - ev.type = ev_keyup; - switch (input.Event.KeyEvent.wVirtualKeyCode) - { - case VK_SHIFT: - ev.key = KEY_LSHIFT; - break; - default: - break; - } - } - if (ev.key) D_PostEvent(&ev); - break; - case MOUSE_EVENT: - case WINDOW_BUFFER_SIZE_EVENT: - case MENU_EVENT: - case FOCUS_EVENT: - break; - } - } -} - -// ---------- -// I_GetEvent -// Post new events for all sorts of user-input -// ---------- -void I_GetEvent(void) -{ - I_GetConsoleEvents(); - I_GetKeyboardEvents(); - I_GetMouseEvents(); - I_GetJoystickEvents(); - I_GetJoystick2Events(); -} - -// ---------- -// I_OsPolling -// ---------- -void I_OsPolling(void) -{ - MSG msg; - HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - - // we need to dispatch messages to the window - // so the window procedure can respond to messages and PostEvent() for keys - // during D_SRB2Main startup. - // this one replaces the main loop of windows since I_OsPolling is called in the main loop - do - { - while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - { - if (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - else // winspec : this is quit message - I_Quit(); - } - if (!appActive && !netgame && !I_ReadyConsole(ci)) - WaitMessage(); - } while (!appActive && !netgame && !I_ReadyConsole(ci)); - - // this is called by the network synchronization, - // check keys and allow escaping - I_GetEvent(); - - // reset "emulated keys" - gamekeydown[KEY_MOUSEWHEELUP] = 0; - gamekeydown[KEY_MOUSEWHEELDOWN] = 0; -} - -// =========================================================================================== -// TIMER -// =========================================================================================== - -static VOID I_ShutdownTimer(VOID) -{ - timeEndPeriod(1); -} - -// -// Installs the timer interrupt handler with timer speed as TICRATE. -// -#define TIMER_ID 1 -#define TIMER_RATE (1000/TICRATE) -void I_StartupTimer(void) -{ - // for win2k time bug - if (M_CheckParm("-gettickcount")) - { - starttickcount = GetTickCount(); - CONS_Printf("Using GetTickCount()\n"); - } - timeBeginPeriod(1); - I_AddExitFunc(I_ShutdownTimer); -} - -// =========================================================================================== -// EXIT CODE, ERROR HANDLING -// =========================================================================================== - -static int errorcount = 0; // phuck recursive errors -static int shutdowning = false; - -// -// Used to trap various signals, to make sure things get shut down cleanly. -// -#ifdef NDEBUG -static void signal_handler(int num) -{ - //static char msg[] = "oh no! back to reality!\r\n"; - const char *sigmsg; - char sigdef[64]; - - D_QuitNetGame(); // Fix server freezes - CL_AbortDownloadResume(); - I_ShutdownSystem(); - - switch (num) - { - case SIGINT: - sigmsg = "interrupt"; - break; - case SIGILL: - sigmsg = "illegal instruction - invalid function image"; - break; - case SIGFPE: - sigmsg = "floating point exception"; - break; - case SIGSEGV: - sigmsg = "segment violation"; - break; - case SIGTERM: - sigmsg = "software termination signal from kill"; - break; - case SIGBREAK: - sigmsg = "Ctrl-Break sequence"; - break; - case SIGABRT: - sigmsg = "abnormal termination triggered by abort call"; - break; - default: - sprintf(sigdef, "signal number %d", num); - sigmsg = sigdef; - } - -#ifdef LOGMESSAGES - if (logstream) - { - I_OutputMsg("signal_handler() error: %s\r\n", sigmsg); - fclose(logstream); - logstream = NULL; - } -#endif - - MessageBoxA(hWndMain, va("signal_handler(): %s", sigmsg), "SRB2 error", MB_OK|MB_ICONERROR); - - signal(num, SIG_DFL); // default signal action - raise(num); -} -#endif - -// -// put an error message (with format) on stderr -// -void I_OutputMsg(const char *fmt, ...) -{ - HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD bytesWritten; - va_list argptr; - char txt[8192]; - - va_start(argptr,fmt); - vsprintf(txt, fmt, argptr); - va_end(argptr); - -#ifdef _MSC_VER - OutputDebugStringA(txt); -#endif - -#ifdef LOGMESSAGES - if (logstream) - { - fwrite(txt, strlen(txt), 1, logstream); - fflush(logstream); - } -#endif - - if (co == INVALID_HANDLE_VALUE) - return; - - if (GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &bytesWritten)) - { - static COORD coordNextWrite = {0,0}; - LPVOID oldLines = NULL; - INT oldLength; - CONSOLE_SCREEN_BUFFER_INFO csbi; - - // Save the lines that we're going to obliterate. - GetConsoleScreenBufferInfo(co, &csbi); - oldLength = csbi.dwSize.X * (csbi.dwCursorPosition.Y - coordNextWrite.Y) + csbi.dwCursorPosition.X - coordNextWrite.X; - - if (oldLength > 0) - { - LPVOID blank = malloc(oldLength); - if (!blank) return; - memset(blank, ' ', oldLength); // Blank out. - oldLines = malloc(oldLength*sizeof(TCHAR)); - if (!oldLines) - { - free(blank); - return; - } - - ReadConsoleOutputCharacter(co, oldLines, oldLength, coordNextWrite, &bytesWritten); - - // Move to where we what to print - which is where we would've been, - // had console input not been in the way, - SetConsoleCursorPosition(co, coordNextWrite); - - WriteConsoleA(co, blank, oldLength, &bytesWritten, NULL); - free(blank); - - // And back to where we want to print again. - SetConsoleCursorPosition(co, coordNextWrite); - } - - // Actually write the string now! - WriteConsoleA(co, txt, (DWORD)strlen(txt), &bytesWritten, NULL); - - // Next time, output where we left off. - GetConsoleScreenBufferInfo(co, &csbi); - coordNextWrite = csbi.dwCursorPosition; - - // Restore what was overwritten. - if (oldLines && entering_con_command) - WriteConsole(co, oldLines, oldLength, &bytesWritten, NULL); - if (oldLines) free(oldLines); - } - else // Redirected to a file. - WriteFile(co, txt, (DWORD)strlen(txt), &bytesWritten, NULL); -} - -// display error messy after shutdowngfx -// -void I_Error(const char *error, ...) -{ - va_list argptr; - char txt[8192]; - - // added 11-2-98 recursive error detecting - if (shutdowning) - { - errorcount++; - // try to shutdown each subsystem separately - if (errorcount == 5) - I_ShutdownGraphics(); - if (errorcount == 6) - I_ShutdownSystem(); - if (errorcount == 7) - { - M_SaveConfig(NULL); - G_SaveGameData(); - } - if (errorcount > 20) - { - // Don't print garbage - va_start(argptr,error); - vsprintf(txt, error, argptr); - va_end(argptr); - - OutputDebugStringA(txt); - MessageBoxA(hWndMain, txt, "SRB2 Recursive Error", MB_OK|MB_ICONERROR); - W_Shutdown(); - exit(-1); // recursive errors detected - } - } - shutdowning = true; - - // put message to stderr - va_start(argptr, error); - wvsprintfA(txt, error, argptr); - va_end(argptr); - - CONS_Printf("I_Error(): %s\n", txt); //don't change from CONS_Printf. - - // saving one time is enough! - if (!errorcount) - { - M_SaveConfig(NULL); // save game config, cvars.. - G_SaveGameData(); - } - - // save demo, could be useful for debug - // NOTE: demos are normally not saved here. - if (demorecording) - G_CheckDemoStatus(); - if (metalrecording) - G_StopMetalRecording(false); - - D_QuitNetGame(); - CL_AbortDownloadResume(); - M_FreePlayerSetupColors(); - - // shutdown everything that was started - I_ShutdownSystem(); - -#ifdef LOGMESSAGES - if (logstream) - { - fclose(logstream); - logstream = NULL; - } -#endif - - MessageBoxA(hWndMain, txt, "SRB2 Error", MB_OK|MB_ICONERROR); - - W_Shutdown(); - exit(-1); -} - -static inline VOID ShowEndTxt(HANDLE co) -{ - int i; - UINT16 j, att = 0; - int nlflag = 1; - CONSOLE_SCREEN_BUFFER_INFO backupcon; - COORD resizewin = {80,-1}; - DWORD bytesWritten; - CHAR let = 0; - UINT16 *ptext; - LPVOID data; - lumpnum_t endoomnum = W_GetNumForName("ENDOOM"); - //HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - - /* get the lump with the text */ - data = ptext = W_CacheLumpNum(endoomnum, PU_CACHE); - - backupcon.wAttributes = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // Just in case - GetConsoleScreenBufferInfo(co, &backupcon); //Store old state - resizewin.Y = backupcon.dwSize.Y; - if (backupcon.dwSize.X < resizewin.X) - SetConsoleScreenBufferSize(co, resizewin); - - for (i = 1; i <= 80*25; i++) // print 80x25 text and deal with the attributes too - { - j = (UINT16)(*ptext >> 8); // attribute first - let = (char)(*ptext & 0xff); // text senond - if (j != att) // attribute changed? - { - att = j; // save current attribute - SetConsoleTextAttribute(co, j); //set fg and bg color for buffer - } - - WriteConsoleA(co, &let, 1, &bytesWritten, NULL); // now the text - - if (nlflag && !(i % 80) && backupcon.dwSize.X > resizewin.X) // do we need a nl? - { - att = backupcon.wAttributes; - SetConsoleTextAttribute(co, att); // all attributes off - WriteConsoleA(co, "\n", 1, &bytesWritten, NULL); // newline to console - } - ptext++; - } - SetConsoleTextAttribute(co, backupcon.wAttributes); // all attributes off - //if (nlflag) - // WriteConsoleA(co, "\n", 1, &bytesWritten, NULL); - - getchar(); //pause! - - Z_Free(data); -} - - -// -// I_Quit: shutdown everything cleanly, in reverse order of Startup. -// -void I_Quit(void) -{ - HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD mode; - // when recording a demo, should exit using 'q', - // but sometimes we forget and use Alt+F4, so save here too. - if (demorecording) - G_CheckDemoStatus(); - if (metalrecording) - G_StopMetalRecording(false); - - M_SaveConfig(NULL); // save game config, cvars.. -#ifndef NONET - D_SaveBan(); // save the ban list -#endif - G_SaveGameData(); - - // maybe it needs that the ticcount continues, - // or something else that will be finished by I_ShutdownSystem(), - // so do it before. - D_QuitNetGame(); - CL_AbortDownloadResume(); - - M_FreePlayerSetupColors(); - - // shutdown everything that was started - I_ShutdownSystem(); - - if (shutdowning || errorcount) - I_Error("Error detected (%d)", errorcount); - -#ifdef LOGMESSAGES - if (logstream) - { - I_OutputMsg("I_Quit(): end of logstream.\n"); - fclose(logstream); - logstream = NULL; - } -#endif - if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM")!=LUMPERROR - && co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR - && GetConsoleMode(co, &mode)) - { - printf("\r"); - ShowEndTxt(co); - } - fflush(stderr); - if (myargmalloc) - free(myargv); // Deallocate allocated memory - W_Shutdown(); - exit(0); -} - -// -------------------------------------------------------------------------- -// I_ShowLastError -// Print a GetLastError() error message, and if MB is TRUE, also display it in a MessageBox -// -------------------------------------------------------------------------- -VOID I_ShowLastError(BOOL MB) -{ - LPSTR lpMsgBuf = NULL; - const DWORD LE = GetLastError(); - - if (LE == 0xdeadbeef) return; // Not a real error - - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, LE, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPVOID)&lpMsgBuf, 0, NULL); - - if (!lpMsgBuf) - { - I_OutputMsg("GetLastError: Unknown\n"); - return; - } - - // Display the string - if (MB && LE) MessageBoxA(NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION); - - // put it in text console and log if any - I_OutputMsg("GetLastError: %s", lpMsgBuf); - - // Free the buffer. - LocalFree(lpMsgBuf); -} - -// =========================================================================================== -// CLEAN STARTUP & SHUTDOWN HANDLING, JUST CLOSE EVERYTHING YOU OPENED. -// =========================================================================================== -// -// -static quitfuncptr quit_funcs[MAX_QUIT_FUNCS] = -{ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -// Adds a function to the list that need to be called by I_SystemShutdown(). -// -void I_AddExitFunc(void (*func)()) -{ - int c; - - for (c = 0; c < MAX_QUIT_FUNCS; c++) - { - if (!quit_funcs[c]) - { - quit_funcs[c] = func; - break; - } - } -} - -// Removes a function from the list that need to be called by I_SystemShutdown(). -// -void I_RemoveExitFunc(void (*func)()) -{ - int c; - - for (c = 0; c < MAX_QUIT_FUNCS; c++) - { - if (quit_funcs[c] == func) - { - while (c < MAX_QUIT_FUNCS - 1) - { - quit_funcs[c] = quit_funcs[c+1]; - c++; - } - quit_funcs[MAX_QUIT_FUNCS-1] = NULL; - break; - } - } -} - -// =========================================================================================== -// DIRECT INPUT HELPER CODE -// =========================================================================================== - -// Create a DirectInputDevice interface, -// create a DirectInputDevice2 interface if possible -static VOID CreateDevice2A(LPDIRECTINPUTA di, REFGUID pguid, LPDIRECTINPUTDEVICEA* lpDEV, - LPDIRECTINPUTDEVICE2A* lpDEV2) -{ - HRESULT hr, hr2; - LPDIRECTINPUTDEVICEA lpdid1; - LPDIRECTINPUTDEVICE2A lpdid2 = NULL; - - hr = IDirectInput_CreateDevice(di, pguid, &lpdid1, NULL); - - if (SUCCEEDED(hr)) - { - // get Device2 but only if we are not in DirectInput version 3 - if (!bDX0300 && lpDEV2) - { - LPDIRECTINPUTDEVICE2A *rp = &lpdid2; - LPVOID *tp = (LPVOID *)rp; - hr2 = IDirectInputDevice_QueryInterface(lpdid1, &IID_IDirectInputDevice2, tp); - if (FAILED(hr2)) - { - CONS_Alert(CONS_ERROR, M_GetText("Could not create IDirectInput device 2")); - lpdid2 = NULL; - } - } - } - else - I_Error("Could not create IDirectInput device"); - - *lpDEV = lpdid1; - if (lpDEV2) // only if we requested it - *lpDEV2 = lpdid2; -} - -// =========================================================================================== -// DIRECT INPUT MOUSE -// =========================================================================================== - -#define DI_MOUSE_BUFFERSIZE 16 // number of data elements in mouse buffer - -// -// Initialise the mouse. -// -static void I_ShutdownMouse(VOID); - -void I_StartupMouse(VOID) -{ - // this gets called when cv_usemouse is initted - // for the win32 version, we want to startup the mouse later - if (menuactive) - { - if (cv_usemouse.value) - I_DoStartupMouse(); - else - I_ShutdownMouse(); - } -} - -static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE; - -static void I_ShutdownMouse2(VOID) -{ - if (mouse2filehandle != INVALID_HANDLE_VALUE) - { - event_t event; - UINT i; - - SetCommMask(mouse2filehandle, 0); - - EscapeCommFunction(mouse2filehandle, CLRDTR); - EscapeCommFunction(mouse2filehandle, CLRRTS); - - PurgeComm(mouse2filehandle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR); - - CloseHandle(mouse2filehandle); - - // emulate the up of all mouse buttons - for (i = 0; i < MOUSEBUTTONS; i++) - { - event.type = ev_keyup; - event.key = KEY_2MOUSE1 + i; - D_PostEvent(&event); - } - - mouse2filehandle = INVALID_HANDLE_VALUE; - } -} - -#define MOUSECOMBUFFERSIZE 256 -static int handlermouse2x, handlermouse2y, handlermouse2buttons; - -static VOID I_PoolMouse2(VOID) -{ - BYTE buffer[MOUSECOMBUFFERSIZE]; - COMSTAT ComStat; - DWORD dwErrorFlags, dwLength, i; - CHAR dx, dy; - static BYTE bytenum, combytes[4]; - - ClearCommError(mouse2filehandle, &dwErrorFlags, &ComStat); - dwLength = min(MOUSECOMBUFFERSIZE, ComStat.cbInQue); - - if (dwLength > 0) - { - if (!ReadFile(mouse2filehandle, buffer, dwLength, &dwLength, NULL)) - { - CONS_Alert(CONS_ERROR, M_GetText("Read Error on secondary mouse port\n")); - return; - } - - // parse the mouse packets - for (i = 0; i < dwLength; i++) - { - if ((buffer[i] & 64) == 64) - bytenum = 0; - - if (bytenum < 4) - combytes[bytenum] = buffer[i]; - bytenum++; - - if (bytenum == 1) - { - handlermouse2buttons &= ~3; - handlermouse2buttons |= ((combytes[0] & (32+16)) >>4); - } - else if (bytenum == 3) - { - dx = (CHAR)((combytes[0] & 3) << 6); - dy = (CHAR)((combytes[0] & 12) << 4); - dx = (CHAR)(dx + combytes[1]); - dy = (CHAR)(dy + combytes[2]); - handlermouse2x += dx; - handlermouse2y += dy; - } - else if (bytenum == 4) // fourth byte (logitech mouses) - { - if (buffer[i] & 32) - handlermouse2buttons |= 4; - else - handlermouse2buttons &= ~4; - } - } - } -} - -// secondary mouse doesn't use DirectX, therefore forget all about grabbing, acquire, etc. -void I_StartupMouse2(void) -{ - DCB dcb; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - I_ShutdownMouse2(); - - if (!cv_usemouse2.value) - return; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - { - // COM file handle - mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ|GENERIC_WRITE, - 0, // exclusive access - NULL, // no security attrs - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (mouse2filehandle == INVALID_HANDLE_VALUE) - { - int e = GetLastError(); - if (e == 5) - CONS_Alert(CONS_ERROR, M_GetText("Error opening %s!\n"), cv_mouse2port.string); - else - CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: error %d\n"), cv_mouse2port.string, e); - return; - } - } - - // buffers - SetupComm(mouse2filehandle, MOUSECOMBUFFERSIZE, MOUSECOMBUFFERSIZE); - - // purge buffers - PurgeComm(mouse2filehandle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR); - - // setup port to 1200 7N1 - dcb.DCBlength = sizeof (DCB); - - GetCommState(mouse2filehandle, &dcb); - - dcb.BaudRate = CBR_1200; - dcb.ByteSize = 7; - dcb.Parity = NOPARITY; - dcb.StopBits = ONESTOPBIT; - - dcb.fDtrControl = DTR_CONTROL_ENABLE; - dcb.fRtsControl = RTS_CONTROL_ENABLE; - - dcb.fBinary = dcb.fParity = TRUE; - - SetCommState(mouse2filehandle, &dcb); - - I_AddExitFunc(I_ShutdownMouse2); -} - -#define MAX_MOUSE_BTNS 5 -static int center_x, center_y; -static INT old_mparms[3], new_mparms[3] = {0, 0, 1}; -static BOOL restore_mouse = FALSE; -static INT old_mouse_state = 0; -UINT MSHWheelMessage = 0; - -static VOID I_DoStartupSysMouse(VOID) -{ - boolean valid; - RECT w_rect; - - valid = SystemParametersInfo(SPI_GETMOUSE, 0, old_mparms, 0); - if (valid) - { - new_mparms[2] = old_mparms[2]; - restore_mouse = SystemParametersInfo(SPI_SETMOUSE, 0, new_mparms, 0); - } - - if (bAppFullScreen) - { - w_rect.top = 0; - w_rect.left = 0; - } - else - { - w_rect.top = windowPosY; - w_rect.left = windowPosX; - } - - w_rect.bottom = w_rect.top + VIDHEIGHT; - w_rect.right = w_rect.left + VIDWIDTH; - center_x = w_rect.left + (VIDWIDTH >> 1); - center_y = w_rect.top + (VIDHEIGHT >> 1); - SetCursor(NULL); - SetCursorPos(center_x, center_y); - SetCapture(hWndMain); - ClipCursor(&w_rect); -} - -static VOID I_ShutdownSysMouse(VOID) -{ - if (restore_mouse) - SystemParametersInfo(SPI_SETMOUSE, 0, old_mparms, 0); - ClipCursor(NULL); - ReleaseCapture(); -} - -VOID I_RestartSysMouse(VOID) -{ - if (nodinput) - { - I_ShutdownSysMouse(); - I_DoStartupSysMouse(); - } -} - -VOID I_GetSysMouseEvents(INT mouse_state) -{ - UINT i; - event_t event; - int xmickeys = 0, ymickeys = 0; - POINT c_pos; - - for (i = 0; i < MAX_MOUSE_BTNS; i++) - { - // check if button pressed - if ((mouse_state & (1 << i)) && !(old_mouse_state & (1 << i))) - { - event.type = ev_keydown; - event.key = KEY_MOUSE1 + i; - D_PostEvent(&event); - } - // check if button released - if (!(mouse_state & (1 << i)) && (old_mouse_state & (1 << i))) - { - event.type = ev_keyup; - event.key = KEY_MOUSE1 + i; - D_PostEvent(&event); - } - } - old_mouse_state = mouse_state; - - // proceed mouse movements - GetCursorPos(&c_pos); - xmickeys = c_pos.x - center_x; - ymickeys = c_pos.y - center_y; - - if (xmickeys || ymickeys) - { - event.type = ev_mouse; - event.key = 0; - event.x = xmickeys; - event.y = -ymickeys; - D_PostEvent(&event); - SetCursorPos(center_x, center_y); - } -} - -// This is called just before entering the main game loop, -// when we are going fullscreen and the loading screen has finished. -VOID I_DoStartupMouse(VOID) -{ - DIPROPDWORD dip; - - // mouse detection may be skipped by setting usemouse false - if (!cv_usemouse.value || M_CheckParm("-nomouse")) - { - mouse_enabled = false; - return; - } - - if (nodinput) - { - CONS_Printf(M_GetText("\tMouse will not use DirectInput.\n")); - // System mouse input will be initiated by VID_SetMode - I_AddExitFunc(I_ShutdownMouse); - - MSHWheelMessage = RegisterWindowMessage(MSH_MOUSEWHEEL); - } - else if (!lpDIM) // acquire the mouse only once - { - CreateDevice2A(lpDI, &GUID_SysMouse, &lpDIM, NULL); - - if (lpDIM) - { - if (FAILED(IDirectInputDevice_SetDataFormat(lpDIM, &c_dfDIMouse))) - I_Error("Couldn't set mouse data format"); - - // create buffer for buffered data - dip.diph.dwSize = sizeof (dip); - dip.diph.dwHeaderSize = sizeof (dip.diph); - dip.diph.dwObj = 0; - dip.diph.dwHow = DIPH_DEVICE; - dip.dwData = DI_MOUSE_BUFFERSIZE; - if (FAILED(IDirectInputDevice_SetProperty(lpDIM, DIPROP_BUFFERSIZE, &dip.diph))) - I_Error("Couldn't set mouse buffer size"); - - if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIM, hWndMain, - DISCL_EXCLUSIVE|DISCL_FOREGROUND))) - { - I_Error("Couldn't set mouse coop level"); - } - I_AddExitFunc(I_ShutdownMouse); - } - else - I_Error("Couldn't create mouse input"); - } - - // if re-enabled while running, just set mouse_enabled true again, - // do not acquire the mouse more than once - mouse_enabled = true; -} - -// -// Shutdown Mouse DirectInput device -// -static void I_ShutdownMouse(void) -{ - int i; - event_t event; - - CONS_Printf("I_ShutdownMouse()\n"); - - if (lpDIM) - { - IDirectInputDevice_Unacquire(lpDIM); - IDirectInputDevice_Release(lpDIM); - lpDIM = NULL; - } - - // emulate the up of all mouse buttons - for (i = 0; i < MOUSEBUTTONS; i++) - { - event.type = ev_keyup; - event.key = KEY_MOUSE1 + i; - D_PostEvent(&event); - } - if (nodinput) - I_ShutdownSysMouse(); - - mouse_enabled = false; -} - -// -// Get buffered data from the mouse -// -void I_GetMouseEvents(void) -{ - DIDEVICEOBJECTDATA rgdod[DI_MOUSE_BUFFERSIZE]; - DWORD dwItems, d; - HRESULT hr; - - event_t event; - int xmickeys, ymickeys; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - { - //mouse movement - static UINT8 lastbuttons2 = 0; - - I_PoolMouse2(); - // post key event for buttons - if (handlermouse2buttons != lastbuttons2) - { - int i, j = 1, k; - k = handlermouse2buttons ^ lastbuttons2; // only changed bit to 1 - lastbuttons2 = (UINT8)handlermouse2buttons; - - for (i = 0; i < MOUSEBUTTONS; i++, j <<= 1) - if (k & j) - { - if (handlermouse2buttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_2MOUSE1 + i; - D_PostEvent(&event); - } - } - - if (handlermouse2x || handlermouse2y) - { - event.type = ev_mouse2; - event.key = 0; - event.x = handlermouse2x<<1; - event.y = -handlermouse2y<<1; - handlermouse2x = 0; - handlermouse2y = 0; - - D_PostEvent(&event); - } - } - - if (!mouse_enabled || nodinput) - return; - -getBufferedData: - dwItems = DI_MOUSE_BUFFERSIZE; - hr = IDirectInputDevice_GetDeviceData(lpDIM, sizeof (DIDEVICEOBJECTDATA), rgdod, &dwItems, 0); - - // If data stream was interrupted, reacquire the device and try again. - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - hr = IDirectInputDevice_Acquire(lpDIM); - if (SUCCEEDED(hr)) - goto getBufferedData; - } - - // We got buffered input, act on it - if (SUCCEEDED(hr)) - { - xmickeys = ymickeys = 0; - - // dwItems contains number of elements read (could be 0) - for (d = 0; d < dwItems; d++) - { - if (rgdod[d].dwOfs >= DIMOFS_BUTTON0 && - rgdod[d].dwOfs < DIMOFS_BUTTON0 + MOUSEBUTTONS) - { - if (rgdod[d].dwData & 0x80) // Button down - event.type = ev_keydown; - else - event.type = ev_keyup; // Button up - - event.key = rgdod[d].dwOfs - DIMOFS_BUTTON0 + KEY_MOUSE1; - D_PostEvent(&event); - } - else if (rgdod[d].dwOfs == DIMOFS_X) - xmickeys += rgdod[d].dwData; - else if (rgdod[d].dwOfs == DIMOFS_Y) - ymickeys += rgdod[d].dwData; - - else if (rgdod[d].dwOfs == DIMOFS_Z) - { - // z-axes the wheel - if ((int)rgdod[d].dwData > 0) - event.key = KEY_MOUSEWHEELUP; - else - event.key = KEY_MOUSEWHEELDOWN; - event.type = ev_keydown; - D_PostEvent(&event); - } - - } - - if (xmickeys || ymickeys) - { - event.type = ev_mouse; - event.key = 0; - event.x = xmickeys; - event.y = -ymickeys; - D_PostEvent(&event); - } - } -} - -void I_UpdateMouseGrab(void) {} - -// =========================================================================================== -// DIRECT INPUT JOYSTICK -// =========================================================================================== - -struct DIJoyInfo_s -{ - BYTE X,Y,Z,Rx,Ry,Rz,U,V; - LONG ForceAxises; -}; -typedef struct DIJoyInfo_s DIJoyInfo_t; - -// private info - static BYTE iJoyNum; // used by enumeration - static DIJoyInfo_t JoyInfo; - static BYTE iJoy2Num; - static DIJoyInfo_t JoyInfo2; - -//----------------------------------------------------------------------------- -// Name: EnumAxesCallback() -// Desc: Callback function for enumerating the axes on a joystick and counting -// each force feedback enabled axis -//----------------------------------------------------------------------------- -static BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCEA* pdidoi, - VOID* pContext) -{ - DWORD* pdwNumForceFeedbackAxis = (DWORD*) pContext; - - if ((pdidoi->dwFlags & DIDOI_FFACTUATOR) != 0) - (*pdwNumForceFeedbackAxis)++; - - return DIENUM_CONTINUE; -} - - -static HRESULT SetupForceTacile(LPDIRECTINPUTDEVICE2A DJI, LPDIRECTINPUTEFFECT *DJE, DWORD FFAXIS, FFType EffectType,REFGUID EffectGUID) -{ - HRESULT hr; - DIEFFECT eff; - DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y }; - LONG rglDirection[2] = { 0, 0 }; - DICONSTANTFORCE cf = { 0 }; // LONG lMagnitude - DIRAMPFORCE rf = {0,0}; // LONG lStart, lEnd; - DIPERIODIC pf = {0,0,0,0}; - ZeroMemory(&eff, sizeof (eff)); - if (FFAXIS > 2) - FFAXIS = 2; //up to 2 FFAXIS - eff.dwSize = sizeof (DIEFFECT); - eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; // Cartesian and data format offsets - eff.dwDuration = INFINITE; - eff.dwSamplePeriod = 0; - eff.dwGain = DI_FFNOMINALMAX; - eff.dwTriggerButton = DIEB_NOTRIGGER; - eff.dwTriggerRepeatInterval = 0; - eff.cAxes = FFAXIS; - eff.rgdwAxes = rgdwAxes; - eff.rglDirection = rglDirection; - eff.lpEnvelope = NULL; - eff.lpvTypeSpecificParams = NULL; - if (EffectType == ConstantForce) - { - eff.cbTypeSpecificParams = sizeof (cf); - eff.lpvTypeSpecificParams = &cf; - } - else if (EffectType == RampForce) - { - eff.cbTypeSpecificParams = sizeof (rf); - eff.lpvTypeSpecificParams = &rf; - } - else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType) - { - eff.cbTypeSpecificParams = sizeof (pf); - eff.lpvTypeSpecificParams = &pf; - } - - // Create the prepared effect - if (FAILED(hr = IDirectInputDevice2_CreateEffect(DJI, EffectGUID, - &eff, DJE, NULL))) - { - return hr; - } - - if (NULL == *DJE) - return E_FAIL; - - return hr; -} - -static BOOL CALLBACK DIEnumEffectsCallback1(LPCDIEFFECTINFOA pdei, LPVOID pvRef) -{ - LPDIRECTINPUTEFFECT *DJE = pvRef; - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_CONSTANTFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJA,DJE, JoyInfo.ForceAxises, ConstantForce, &pdei->guid))) - return DIENUM_STOP; - } - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_RAMPFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJA,DJE, JoyInfo.ForceAxises, RampForce, &pdei->guid))) - return DIENUM_STOP; - } - return DIENUM_CONTINUE; -} - -static BOOL CALLBACK DIEnumEffectsCallback2(LPCDIEFFECTINFOA pdei, LPVOID pvRef) -{ - LPDIRECTINPUTEFFECT *DJE = pvRef; - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_CONSTANTFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJ2A,DJE, JoyInfo2.ForceAxises, ConstantForce, &pdei->guid))) - return DIENUM_STOP; - } - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_RAMPFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJ2A,DJE, JoyInfo2.ForceAxises, RampForce, &pdei->guid))) - return DIENUM_STOP; - } - return DIENUM_CONTINUE; -} - -static REFGUID DIETable[] = -{ - &GUID_ConstantForce, //ConstantForce - &GUID_RampForce, //RampForce - &GUID_Square, //SquareForce - &GUID_Sine, //SineForce - &GUID_Triangle, //TriangleForce - &GUID_SawtoothUp, //SawtoothUpForce - &GUID_SawtoothDown, //SawtoothDownForce - (REFGUID)-1, //NumberofForces -}; - -static HRESULT SetupAllForces(LPDIRECTINPUTDEVICE2A DJI, LPDIRECTINPUTEFFECT DJE[], DWORD FFAXIS) -{ - FFType ForceType = EvilForce; - if (DJI == lpDIJA) - { - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback1,&DJE[ConstantForce],DIEFT_CONSTANTFORCE); - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback1,&DJE[RampForce],DIEFT_RAMPFORCE); - } - else if (DJI == lpDIJA) - { - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback2,&DJE[ConstantForce],DIEFT_CONSTANTFORCE); - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback2,&DJE[RampForce],DIEFT_RAMPFORCE); - } - for (ForceType = SquareForce; ForceType > NumberofForces && DIETable[ForceType] != (REFGUID)-1; ForceType++) - if (DIETable[ForceType]) - SetupForceTacile(DJI,&DJE[ForceType], FFAXIS, ForceType, DIETable[ForceType]); - return S_OK; -} - -static inline VOID LimitEffect(LPDIEFFECT eff, FFType EffectType) -{ - LPDICONSTANTFORCE pCF = eff->lpvTypeSpecificParams; - LPDIPERIODIC pDP= eff->lpvTypeSpecificParams; - if (eff->rglDirection) - { - } -/* if (eff->dwDuration != INFINITE && eff->dwDuration < 0) - { - eff->dwDuration = 0; - }*/ - if (eff->dwGain != 0) - { - if (eff->dwGain > DI_FFNOMINALMAX) - eff->dwGain = DI_FFNOMINALMAX; - //else if (eff->dwGain < -DI_FFNOMINALMAX) - // eff->dwGain = DI_FFNOMINALMAX; - } - if (EffectType == ConstantForce && pCF->lMagnitude) - { - } - else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType && pDP) - { - } - -} - -static HRESULT SetForceTacile(LPDIRECTINPUTEFFECT SDIE, const JoyFF_t *FF,DWORD FFAXIS, FFType EffectType) -{ - DIEFFECT eff; - HRESULT hr; - LONG Magnitude; - LONG rglDirection[2] = { 0, 0 }; - DICONSTANTFORCE cf = { 0 }; // LONG lMagnitude - DIRAMPFORCE rf = {0,0}; // LONG lStart, lEnd; - DIPERIODIC pf = {0,0,0,0}; - if (!FF) - IDirectInputEffect_Stop(SDIE); - Magnitude = FF->Magnitude; - ZeroMemory(&eff, sizeof (eff)); - eff.dwSize = sizeof (eff); - //DIEP_START - eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; // Cartesian and data format offsets - //DIEP_DURATION - eff.dwDuration = FF->Duration; - //DIEP_GAIN - eff.dwGain = FF->Gain; - //DIEP_DIRECTION - eff.rglDirection = rglDirection; - //DIEP_TYPESPECIFICPARAMS - if (FFAXIS > 1) - { - double dMagnitude; - dMagnitude = (double)Magnitude; - dMagnitude = hypot(dMagnitude, dMagnitude); - Magnitude = (DWORD)dMagnitude; - rglDirection[0] = FF->ForceX; - rglDirection[1] = FF->ForceY; - } - if (EffectType == ConstantForce) - { - cf.lMagnitude = Magnitude; - eff.cbTypeSpecificParams = sizeof (cf); - eff.lpvTypeSpecificParams = &cf; - } - else if (EffectType == RampForce) - { - rf.lStart = FF->Start; - rf.lEnd = FF->End; - eff.cbTypeSpecificParams = sizeof (rf); - eff.lpvTypeSpecificParams = &rf; - } - else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType) - { - pf.dwMagnitude = Magnitude; - pf.lOffset = FF->Offset; - pf.dwPhase = FF->Phase; - pf.dwPeriod = FF->Period; - eff.cbTypeSpecificParams = sizeof (pf); - eff.lpvTypeSpecificParams = &pf; - } - - LimitEffect(&eff, EffectType); - - hr = IDirectInputEffect_SetParameters(SDIE, &eff, - DIEP_START|DIEP_DURATION|DIEP_GAIN|DIEP_DIRECTION|DIEP_TYPESPECIFICPARAMS); - return hr; -} - -void I_Tactile(FFType Type, const JoyFF_t *Effect) -{ - if (!lpDIJA) return; - if (FAILED(IDirectInputDevice2_Acquire(lpDIJA))) - return; - if (Type == EvilForce) - IDirectInputDevice2_SendForceFeedbackCommand(lpDIJA,DISFFC_STOPALL); - if (Type <= EvilForce || Type > NumberofForces || !lpDIE[Type]) - return; - SetForceTacile(lpDIE[Type], Effect, JoyInfo.ForceAxises, Type); -} - -void I_Tactile2(FFType Type, const JoyFF_t *Effect) -{ - if (!lpDIJ2A) return; - if (FAILED(IDirectInputDevice2_Acquire(lpDIJ2A))) - return; - if (Type == EvilForce) - IDirectInputDevice2_SendForceFeedbackCommand(lpDIJ2A,DISFFC_STOPALL); - if (Type <= EvilForce || Type > NumberofForces || !lpDIE2[Type]) - return; - SetForceTacile(lpDIE2[Type],Effect, JoyInfo2.ForceAxises, Type); -} - -// ------------------ -// SetDIDwordProperty (HELPER) -// Set a DWORD property on a DirectInputDevice. -// ------------------ -static HRESULT SetDIDwordProperty(LPDIRECTINPUTDEVICEA pdev, - REFGUID guidProperty, - DWORD dwObject, - DWORD dwHow, - DWORD dwValue) -{ - DIPROPDWORD dipdw; - - dipdw.diph.dwSize = sizeof (dipdw); - dipdw.diph.dwHeaderSize = sizeof (dipdw.diph); - dipdw.diph.dwObj = dwObject; - dipdw.diph.dwHow = dwHow; - dipdw.dwData = dwValue; - - return IDirectInputDevice_SetProperty(pdev, guidProperty, &dipdw.diph); -} - -#define DIDEADZONE 0000 //2500 - -// --------------- -// DIEnumJoysticks -// There is no such thing as a 'system' joystick, contrary to mouse, -// we must enumerate and choose one joystick device to use -// --------------- -static BOOL CALLBACK DIEnumJoysticks (LPCDIDEVICEINSTANCEA lpddi, - LPVOID pvRef) //cv_usejoystick -{ - LPDIRECTINPUTDEVICEA pdev; - DIPROPRANGE diprg; - DIDEVCAPS caps; - BOOL bUseThisOne = FALSE; - - iJoyNum++; - - //faB: if cv holds a string description of joystick, the value from atoi() is 0 - // else, the value was probably set by user at console to one of the previously - // enumerated joysticks - if (((consvar_t *)pvRef)->value == iJoyNum || !strcmp(((consvar_t *)pvRef)->string, lpddi->tszProductName)) - bUseThisOne = TRUE; - - //I_OutputMsg(" cv joy is %s\n", ((consvar_t *)pvRef)->string); - - // print out device name - CONS_Printf("%c%d: %s\n", - (bUseThisOne) ? '\2' : ' ', // show name in white if this is the one we will use - iJoyNum, - //(GET_DIDEVICE_SUBTYPE(lpddi->dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD) ? "Gamepad " : "Joystick", - lpddi->tszProductName); //, lpddi->tszInstanceName); - - // use specified joystick (cv_usejoystick.value in pvRef) - if (!bUseThisOne) - return DIENUM_CONTINUE; - - ((consvar_t *)pvRef)->value = iJoyNum; - if (IDirectInput_CreateDevice(lpDI, &lpddi->guidInstance, - &pdev, NULL) != DI_OK) - { - // if it failed, then we can't use this joystick for some - // bizarre reason. (Maybe the user unplugged it while we - // were in the middle of enumerating it.) So continue enumerating - I_OutputMsg("DIEnumJoysticks(): CreateDevice FAILED\n"); - return DIENUM_CONTINUE; - } - - // get the Device capabilities - // - caps.dwSize = sizeof (DIDEVCAPS_DX3); - if (FAILED(IDirectInputDevice_GetCapabilities (pdev, &caps))) - { - I_OutputMsg("DIEnumJoysticks(): GetCapabilities FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - if (!(caps.dwFlags & DIDC_ATTACHED)) // should be, since we enumerate only attached devices - return DIENUM_CONTINUE; - - Joystick.bJoyNeedPoll = ((caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0); - - if (caps.dwFlags & DIDC_FORCEFEEDBACK) - JoyInfo.ForceAxises = 0; - else - JoyInfo.ForceAxises = -1; - - Joystick.bGamepadStyle = (GET_DIDEVICE_SUBTYPE(caps.dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD); - //I_OutputMsg("Gamepad: %d\n", Joystick.bGamepadStyle); - - - CONS_Printf(M_GetText("Capabilities: %lu axes, %lu buttons, %lu POVs, poll %u, Gamepad %d\n"), caps.dwAxes, caps.dwButtons, caps.dwPOVs, Joystick.bJoyNeedPoll, Joystick.bGamepadStyle); - - // Set the data format to "simple joystick" - a predefined data format - // - // A data format specifies which controls on a device we - // are interested in, and how they should be reported. - // - // This tells DirectInput that we will be passing a - // DIJOYSTATE structure to IDirectInputDevice::GetDeviceState. - if (IDirectInputDevice_SetDataFormat (pdev, &c_dfDIJoystick) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks(): SetDataFormat FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // Set the cooperativity level to let DirectInput know how - // this device should interact with the system and with other - // DirectInput applications. - if (IDirectInputDevice_SetCooperativeLevel (pdev, hWndMain, - DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks(): SetCooperativeLevel FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // set the range of the joystick axis - diprg.diph.dwSize = sizeof (DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof (DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = -JOYAXISRANGE; // value for extreme left - diprg.lMax = +JOYAXISRANGE; // value for extreme right - - diprg.diph.dwObj = DIJOFS_X; // set the x-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //goto SetPropFail; - JoyInfo.X = FALSE; - } - else JoyInfo.X = TRUE; - - diprg.diph.dwObj = DIJOFS_Y; // set the y-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { -//SetPropFail: -// I_OutputMsg("DIEnumJoysticks(): SetProperty FAILED\n"); -// IDirectInputDevice_Release (pdev); -// return DIENUM_CONTINUE; - JoyInfo.Y = FALSE; - } - else JoyInfo.Y = TRUE; - - diprg.diph.dwObj = DIJOFS_Z; // set the z-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_Z not found\n"); - JoyInfo.Z = FALSE; - } - else JoyInfo.Z = TRUE; - - diprg.diph.dwObj = DIJOFS_RX; // set the x-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RX (x-rudder) not found\n"); - JoyInfo.Rx = FALSE; - } - else JoyInfo.Rx = TRUE; - - diprg.diph.dwObj = DIJOFS_RY; // set the y-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RY (y-rudder) not found\n"); - JoyInfo.Ry = FALSE; - } - else JoyInfo.Ry = TRUE; - - diprg.diph.dwObj = DIJOFS_RZ; // set the z-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (z-rudder) not found\n"); - JoyInfo.Rz = FALSE; - } - else JoyInfo.Rz = TRUE; - diprg.diph.dwObj = DIJOFS_SLIDER(0); // set the x-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (x-misc) not found\n"); - JoyInfo.U = FALSE; - } - else JoyInfo.U = TRUE; - - diprg.diph.dwObj = DIJOFS_SLIDER(1); // set the y-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (y-misc) not found\n"); - JoyInfo.V = FALSE; - } - else JoyInfo.V = TRUE; - - // set X axis dead zone to 25% (to avoid accidental turning) - if (!Joystick.bGamepadStyle) - { - if (JoyInfo.X) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_X, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for X DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Y) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Y, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for Y DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Z) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Z, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for Z DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Rx) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RX, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for RX DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Ry) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RY, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for RY DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Rz) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RZ, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for RZ DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.U) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(0), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for U DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.V) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(1), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for V DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - } - - // query for IDirectInputDevice2 - we need this to poll the joystick - if (bDX0300) - { - FFType i = EvilForce; - // we won't use the poll - lpDIJA = NULL; - for (i = 0; i > NumberofForces; i++) - lpDIE[i] = NULL; - } - else - { - LPDIRECTINPUTDEVICE2A *rp = &lpDIJA; - LPVOID *tp = (LPVOID *)rp; - if (FAILED(IDirectInputDevice_QueryInterface(pdev, &IID_IDirectInputDevice2, tp))) - { - I_OutputMsg("DIEnumJoysticks(): QueryInterface FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - if (lpDIJA && JoyInfo.ForceAxises != -1) - { - // Since we will be playing force feedback effects, we should disable the - // auto-centering spring. - if (FAILED(SetDIDwordProperty(pdev, DIPROP_AUTOCENTER, 0, DIPH_DEVICE, FALSE))) - { - //NOP - } - - // Enumerate and count the axes of the joystick - if (FAILED(IDirectInputDevice_EnumObjects(pdev, EnumAxesCallback, - (LPVOID)&JoyInfo.ForceAxises, DIDFT_AXIS))) - { - JoyInfo.ForceAxises = -1; - } - else - { - SetupAllForces(lpDIJA,lpDIE,JoyInfo.ForceAxises); - } - } - } - - // we successfully created an IDirectInputDevice. So stop looking - // for another one. - lpDIJ = pdev; - return DIENUM_STOP; -} - -// -------------- -// I_InitJoystick -// This is called everytime the 'use_joystick' variable changes -// It is normally called at least once at startup when the config is loaded -// -------------- -void I_InitJoystick(void) -{ - HRESULT hr; - - // cleanup - I_ShutdownJoystick(); - - //joystick detection can be skipped by setting use_joystick to 0 - if (!lpDI || M_CheckParm("-nojoy")) - { - CONS_Printf(M_GetText("Joystick disabled\n")); - return; - } - else - // don't do anything at the registration of the joystick cvar, - // until config is loaded - if (!strcmp(cv_usejoystick.string, "0")) - return; - - // acquire the joystick only once - if (!lpDIJ) - { - joystick_detected = false; - - CONS_Printf(M_GetText("Looking for joystick devices:\n")); - iJoyNum = 0; - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, DIEnumJoysticks, - (void *)&cv_usejoystick, // our user parameter is joystick number - DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - CONS_Alert(CONS_WARNING, M_GetText("Joystick initialize failed.\n")); - cv_usejoystick.value = 0; - return; - } - - if (!lpDIJ) - { - if (!iJoyNum) - CONS_Printf(M_GetText("none found\n")); - else - { - CONS_Printf(M_GetText("none used\n")); - if (cv_usejoystick.value > 0 && cv_usejoystick.value > iJoyNum) - { - CONS_Alert(CONS_WARNING, M_GetText("Set the use_joystick variable to one of the enumerated joystick numbers\n")); - } - } - cv_usejoystick.value = 0; - return; - } - - I_AddExitFunc(I_ShutdownJoystick); - - // set coop level - if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIJ, hWndMain, - DISCL_NONEXCLUSIVE|DISCL_FOREGROUND))) - { - I_Error("I_InitJoystick: SetCooperativeLevel FAILED"); - } - } - else - CONS_Printf(M_GetText("Joystick already initialized\n")); - - // we don't unacquire joystick, so let's just pretend we re-acquired it - joystick_detected = true; -} -//Joystick 2 - -// --------------- -// DIEnumJoysticks2 -// There is no such thing as a 'system' joystick, contrary to mouse, -// we must enumerate and choose one joystick device to use -// --------------- -static BOOL CALLBACK DIEnumJoysticks2 (LPCDIDEVICEINSTANCEA lpddi, - LPVOID pvRef) //cv_usejoystick -{ - LPDIRECTINPUTDEVICEA pdev; - DIPROPRANGE diprg; - DIDEVCAPS caps; - BOOL bUseThisOne = FALSE; - - iJoy2Num++; - - //faB: if cv holds a string description of joystick, the value from atoi() is 0 - // else, the value was probably set by user at console to one of the previsouly - // enumerated joysticks - if (((consvar_t *)pvRef)->value == iJoy2Num || !strcmp(((consvar_t *)pvRef)->string, lpddi->tszProductName)) - bUseThisOne = TRUE; - - //I_OutputMsg(" cv joy2 is %s\n", ((consvar_t *)pvRef)->string); - - // print out device name - CONS_Printf("%c%d: %s\n", - (bUseThisOne) ? '\2' : ' ', // show name in white if this is the one we will use - iJoy2Num, - //(GET_DIDEVICE_SUBTYPE(lpddi->dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD) ? "Gamepad " : "Joystick", - lpddi->tszProductName); //, lpddi->tszInstanceName); - - // use specified joystick (cv_usejoystick.value in pvRef) - if (!bUseThisOne) - return DIENUM_CONTINUE; - - ((consvar_t *)pvRef)->value = iJoy2Num; - if (IDirectInput_CreateDevice (lpDI, &lpddi->guidInstance, - &pdev, NULL) != DI_OK) - { - // if it failed, then we can't use this joystick for some - // bizarre reason. (Maybe the user unplugged it while we - // were in the middle of enumerating it.) So continue enumerating - I_OutputMsg("DIEnumJoysticks2(): CreateDevice FAILED\n"); - return DIENUM_CONTINUE; - } - - - // get the Device capabilities - // - caps.dwSize = sizeof (DIDEVCAPS_DX3); - if (FAILED(IDirectInputDevice_GetCapabilities (pdev, &caps))) - { - I_OutputMsg("DIEnumJoysticks2(): GetCapabilities FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - if (!(caps.dwFlags & DIDC_ATTACHED)) // should be, since we enumerate only attached devices - return DIENUM_CONTINUE; - - Joystick2.bJoyNeedPoll = ((caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0); - - if (caps.dwFlags & DIDC_FORCEFEEDBACK) - JoyInfo2.ForceAxises = 0; - else - JoyInfo2.ForceAxises = -1; - - Joystick2.bGamepadStyle = (GET_DIDEVICE_SUBTYPE(caps.dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD); - //I_OutputMsg("Gamepad: %d\n", Joystick2.bGamepadStyle); - - CONS_Printf(M_GetText("Capabilities: %lu axes, %lu buttons, %lu POVs, poll %u, Gamepad %d\n"), caps.dwAxes, caps.dwButtons, caps.dwPOVs, Joystick2.bJoyNeedPoll, Joystick2.bGamepadStyle); - - // Set the data format to "simple joystick" - a predefined data format - // - // A data format specifies which controls on a device we - // are interested in, and how they should be reported. - // - // This tells DirectInput that we will be passing a - // DIJOYSTATE structure to IDirectInputDevice::GetDeviceState. - if (IDirectInputDevice_SetDataFormat (pdev, &c_dfDIJoystick) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks2(): SetDataFormat FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // Set the cooperativity level to let DirectInput know how - // this device should interact with the system and with other - // DirectInput applications. - if (IDirectInputDevice_SetCooperativeLevel (pdev, hWndMain, - DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks2(): SetCooperativeLevel FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // set the range of the joystick axis - diprg.diph.dwSize = sizeof (DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof (DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = -JOYAXISRANGE; // value for extreme left - diprg.lMax = +JOYAXISRANGE; // value for extreme right - - diprg.diph.dwObj = DIJOFS_X; // set the x-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //goto SetPropFail; - JoyInfo2.X = FALSE; - } - else JoyInfo2.X = TRUE; - - diprg.diph.dwObj = DIJOFS_Y; // set the y-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { -//SetPropFail: -// I_OutputMsg("DIEnumJoysticks(): SetProperty FAILED\n"); -// IDirectInputDevice_Release (pdev); -// return DIENUM_CONTINUE; - JoyInfo2.Y = FALSE; - } - else JoyInfo2.Y = TRUE; - - diprg.diph.dwObj = DIJOFS_Z; // set the z-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_Z not found\n"); - JoyInfo2.Z = FALSE; - } - else JoyInfo2.Z = TRUE; - - diprg.diph.dwObj = DIJOFS_RX; // set the x-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RX (x-rudder) not found\n"); - JoyInfo2.Rx = FALSE; - } - else JoyInfo2.Rx = TRUE; - - diprg.diph.dwObj = DIJOFS_RY; // set the y-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RY (y-rudder) not found\n"); - JoyInfo2.Ry = FALSE; - } - else JoyInfo2.Ry = TRUE; - - diprg.diph.dwObj = DIJOFS_RZ; // set the z-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (z-rudder) not found\n"); - JoyInfo2.Rz = FALSE; - } - else JoyInfo2.Rz = TRUE; - diprg.diph.dwObj = DIJOFS_SLIDER(0); // set the x-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (x-misc) not found\n"); - JoyInfo2.U = FALSE; - } - else JoyInfo2.U = TRUE; - - diprg.diph.dwObj = DIJOFS_SLIDER(1); // set the y-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (y-misc) not found\n"); - JoyInfo2.V = FALSE; - } - else JoyInfo2.V = TRUE; - - // set X axis dead zone to 25% (to avoid accidental turning) - if (!Joystick2.bGamepadStyle) - { - if (JoyInfo2.X) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_X, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for X DEAD ZONE"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Y) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Y, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for Y DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Z) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Z, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for Z DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Rx) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RX, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for RX DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Ry) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RY, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for RY DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Rz) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RZ, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for RZ DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.U) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(0), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for U DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.V) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(1), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for V DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - } - - // query for IDirectInputDevice2 - we need this to poll the joystick - if (bDX0300) - { - FFType i = EvilForce; - // we won't use the poll - lpDIJA = NULL; - for (i = 0; i > NumberofForces; i++) - lpDIE[i] = NULL; - } - else - { - LPDIRECTINPUTDEVICE2A *rp = &lpDIJ2A; - LPVOID *tp = (LPVOID *)rp; - if (FAILED(IDirectInputDevice_QueryInterface(pdev, &IID_IDirectInputDevice2, tp))) - { - I_OutputMsg("DIEnumJoysticks2(): QueryInterface FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - if (lpDIJ2A && JoyInfo2.ForceAxises != -1) - { - // Since we will be playing force feedback effects, we should disable the - // auto-centering spring. - if (FAILED(SetDIDwordProperty(pdev, DIPROP_AUTOCENTER, 0, DIPH_DEVICE, FALSE))) - { - //NOP - } - - // Enumerate and count the axes of the joystick - if (FAILED(IDirectInputDevice_EnumObjects(pdev, EnumAxesCallback, - (LPVOID)&JoyInfo2.ForceAxises, DIDFT_AXIS))) - { - JoyInfo2.ForceAxises = -1; - } - else - { - SetupAllForces(lpDIJ2A,lpDIE2,JoyInfo2.ForceAxises); - } - } - } - - // we successfully created an IDirectInputDevice. So stop looking - // for another one. - lpDIJ2 = pdev; - return DIENUM_STOP; -} - - -// -------------- -// I_InitJoystick2 -// This is called everytime the 'use_joystick2' variable changes -// It is normally called at least once at startup when the config is loaded -// -------------- -void I_InitJoystick2 (void) -{ - HRESULT hr; - - // cleanup - I_ShutdownJoystick2 (); - - joystick2_detected = false; - - // joystick detection can be skipped by setting use_joystick to 0 - if (!lpDI || M_CheckParm("-nojoy")) - { - CONS_Printf(M_GetText("Joystick2 disabled\n")); - return; - } - else - // don't do anything at the registration of the joystick cvar, - // until config is loaded - if (!strcmp(cv_usejoystick2.string, "0")) - return; - - // acquire the joystick only once - if (!lpDIJ2) - { - joystick2_detected = false; - - CONS_Printf(M_GetText("Looking for joystick devices:\n")); - iJoy2Num = 0; - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, - DIEnumJoysticks2, - (LPVOID)&cv_usejoystick2, // our user parameter is joystick number - DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - CONS_Alert(CONS_WARNING, M_GetText("Joystick initialize failed.\n")); - cv_usejoystick2.value = 0; - return; - } - - if (!lpDIJ2) - { - if (iJoy2Num == 0) - CONS_Printf(M_GetText("none found\n")); - else - { - CONS_Printf(M_GetText("none used\n")); - if (cv_usejoystick2.value > 0 && - cv_usejoystick2.value > iJoy2Num) - { - CONS_Alert(CONS_WARNING, M_GetText("Set the use_joystick2 variable to one of the enumerated joysticks number\n")); - } - } - cv_usejoystick2.value = 0; - return; - } - - I_AddExitFunc (I_ShutdownJoystick2); - - // set coop level - if (FAILED(IDirectInputDevice_SetCooperativeLevel (lpDIJ2, hWndMain, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND))) - I_Error("I_InitJoystick2: SetCooperativeLevel FAILED"); - - // later - //if (FAILED(IDirectInputDevice_Acquire (lpDIJ2))) - // I_Error("Couldn't acquire Joystick2"); - - joystick2_detected = true; - } - else - CONS_Printf(M_GetText("Joystick already initialized\n")); - - //faB: we don't unacquire joystick, so let's just pretend we re-acquired it - joystick2_detected = true; -} - -/** \brief Joystick 1 buttons states -*/ -static UINT64 lastjoybuttons = 0; - -/** \brief Joystick 1 hats state -*/ -static UINT64 lastjoyhats = 0; - -static VOID I_ShutdownJoystick(VOID) -{ - int i; - event_t event; - - lastjoybuttons = lastjoyhats = 0; - - event.type = ev_keyup; - - // emulate the up of all joystick buttons - for (i = 0;i < JOYBUTTONS;i++) - { - event.key = KEY_JOY1+i; - D_PostEvent(&event); - } - - // emulate the up of all joystick hats - for (i = 0;i < JOYHATS*4;i++) - { - event.key = KEY_HAT1+i; - D_PostEvent(&event); - } - - // reset joystick position - event.type = ev_joystick; - for (i = 0;i < JOYAXISSET; i++) - { - event.key = i; - D_PostEvent(&event); - } - - if (joystick_detected) - CONS_Printf("I_ShutdownJoystick()\n"); - - for (i = 0; i > NumberofForces; i++) - { - if (lpDIE[i]) - { - IDirectInputEffect_Release(lpDIE[i]); - lpDIE[i] = NULL; - - } - } - if (lpDIJ) - { - IDirectInputDevice_Unacquire(lpDIJ); - IDirectInputDevice_Release(lpDIJ); - lpDIJ = NULL; - } - if (lpDIJA) - { - IDirectInputDevice2_Release(lpDIJA); - lpDIJA = NULL; - } - joystick_detected = false; -} - -/** \brief Joystick 2 buttons states -*/ -static UINT64 lastjoy2buttons = 0; - -/** \brief Joystick 2 hats state -*/ -static UINT64 lastjoy2hats = 0; - -static VOID I_ShutdownJoystick2(VOID) -{ - int i; - event_t event; - - lastjoy2buttons = lastjoy2hats = 0; - - event.type = ev_keyup; - - // emulate the up of all joystick buttons - for (i = 0;i < JOYBUTTONS;i++) - { - event.key = KEY_2JOY1+i; - D_PostEvent(&event); - } - - // emulate the up of all joystick hats - for (i = 0;i < JOYHATS*4;i++) - { - event.key = KEY_2HAT1+i; - D_PostEvent(&event); - } - - // reset joystick position - event.type = ev_joystick2; - for (i = 0;i < JOYAXISSET; i++) - { - event.key = i; - D_PostEvent(&event); - } - - if (joystick2_detected) - CONS_Printf("I_ShutdownJoystick2()\n"); - - for (i = 0; i > NumberofForces; i++) - { - if (lpDIE2[i]) - { - IDirectInputEffect_Release(lpDIE2[i]); - lpDIE2[i] = NULL; - } - } - if (lpDIJ2) - { - IDirectInputDevice_Unacquire(lpDIJ2); - IDirectInputDevice_Release(lpDIJ2); - lpDIJ2 = NULL; - } - if (lpDIJ2A) - { - IDirectInputDevice2_Release(lpDIJ2A); - lpDIJ2A = NULL; - } - joystick2_detected = false; -} - -// ------------------- -// I_GetJoystickEvents -// Get current joystick axis and button states -// ------------------- -void I_GetJoystickEvents(void) -{ - HRESULT hr; - DIJOYSTATE js; // DirectInput joystick state - int i; - UINT64 joybuttons = 0; - UINT64 joyhats = 0; - event_t event; - - if (!lpDIJ) - return; - - // if input is lost then acquire and keep trying - for (;;) - { - // poll the joystick to read the current state - // if the device doesn't require polling, this function returns almost instantly - if (lpDIJA) - { - hr = IDirectInputDevice2_Poll(lpDIJA); - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - goto acquire; - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystickEvents(): Poll FAILED\n"); - return; - } - } - - // get the input's device state, and put the state in dims - hr = IDirectInputDevice_GetDeviceState(lpDIJ, sizeof (DIJOYSTATE), &js); - - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - // DirectInput is telling us that the input stream has - // been interrupted. We aren't tracking any state - // between polls, so we don't have any special reset - // that needs to be done. We just re-acquire and - // try again. - goto acquire; - } - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystickEvents(): GetDeviceState FAILED\n"); - return; - } - - break; -acquire: - if (FAILED(IDirectInputDevice_Acquire(lpDIJ))) - return; - } - - // look for as many buttons as g_input code supports, we don't use the others - for (i = JOYBUTTONS_MIN - 1; i >= 0; i--) - { - joybuttons <<= 1; - if (js.rgbButtons[i]) - joybuttons |= 1; - } - - for (i = JOYHATS_MIN -1; i >=0; i--) - { - if (js.rgdwPOV[i] != 0xffff && js.rgdwPOV[i] != 0xffffffff) - { - if (js.rgdwPOV[i] > 270 * DI_DEGREES || js.rgdwPOV[i] < 90 * DI_DEGREES) - joyhats |= (UINT64)1<<(0 + 4*(UINT64)i); // UP - else if (js.rgdwPOV[i] > 90 * DI_DEGREES && js.rgdwPOV[i] < 270 * DI_DEGREES) - joyhats |= (UINT64)1<<(1 + 4*(UINT64)i); // DOWN - if (js.rgdwPOV[i] > 0 * DI_DEGREES && js.rgdwPOV[i] < 180 * DI_DEGREES) - joyhats |= (UINT64)1<<(3 + 4*(UINT64)i); // LEFT - else if (js.rgdwPOV[i] > 180 * DI_DEGREES && js.rgdwPOV[i] < 360 * DI_DEGREES) - joyhats |= (UINT64)1<<(2 + 4*(UINT64)i); // RIGHT - } - } - - if (joybuttons != lastjoybuttons) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newbuttons = joybuttons ^ lastjoybuttons; - lastjoybuttons = joybuttons; - - for (i = 0; i < JOYBUTTONS_MIN; i++, j <<= 1) - { - if (newbuttons & j) // button changed state? - { - if (joybuttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_JOY1 + i; - D_PostEvent(&event); - } - } - } - - if (joyhats != lastjoyhats) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newhats = joyhats ^ lastjoyhats; - lastjoyhats = joyhats; - - for (i = 0; i < JOYHATS_MIN*4; i++, j <<= 1) - { - if (newhats & j) // button changed state? - { - if (joyhats & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_HAT1 + i; - D_PostEvent(&event); - } - } - - } - - // send joystick axis positions - event.type = ev_joystick; - event.key = event.x = event.y = 0; - - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.X) - { - if (js.lX < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lX > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.Y) - { - if (js.lY < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lY > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.X) event.x = js.lX; // x axis - if (JoyInfo.Y) event.y = js.lY; // y axis - } - - D_PostEvent(&event); -#if JOYAXISSET > 1 - event.key = 1; - event.x = event.y = 0; - - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.Z) - { - if (js.lZ < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lZ > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.Rx) - { - if (js.lRx < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRx > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.Z) event.x = js.lZ; // z axis - if (JoyInfo.Rx) event.y = js.lRx; // rx axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 2 - event.key = 2; - event.x = event.y = 0; - - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.Rx) - { - if (js.lRy < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lRy > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.Rz) - { - if (js.lRz < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRz > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.Ry) event.x = js.lRy; // ry axis - if (JoyInfo.Rz) event.y = js.lRz; // rz axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 3 - event.key = 3; - event.x = event.y = 0; - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.U) - { - if (js.rglSlider[0] < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.rglSlider[0] > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.V) - { - if (js.rglSlider[1] < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.rglSlider[1] > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.U) event.x = js.rglSlider[0]; // U axis - if (JoyInfo.V) event.y = js.rglSlider[1]; // V axis - } - D_PostEvent(&event); -#endif -} - -// ------------------- -// I_GetJoystickEvents -// Get current joystick axis and button states -// ------------------- -void I_GetJoystick2Events(void) -{ - HRESULT hr; - DIJOYSTATE js; // DirectInput joystick state - int i; - UINT64 joybuttons = 0; - UINT64 joyhats = 0; - event_t event; - - if (!lpDIJ2) - return; - - // if input is lost then acquire and keep trying - for (;;) - { - // poll the joystick to read the current state - // if the device doesn't require polling, this function returns almost instantly - if (lpDIJ2A) - { - hr = IDirectInputDevice2_Poll(lpDIJ2A); - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - goto acquire; - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystick2Events(): Poll FAILED\n"); - return; - } - } - - // get the input's device state, and put the state in dims - hr = IDirectInputDevice_GetDeviceState(lpDIJ2, sizeof (DIJOYSTATE), &js); - - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - // DirectInput is telling us that the input stream has - // been interrupted. We aren't tracking any state - // between polls, so we don't have any special reset - // that needs to be done. We just re-acquire and - // try again. - goto acquire; - } - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystickEvents2(): GetDeviceState FAILED\n"); - return; - } - - break; -acquire: - if (FAILED(IDirectInputDevice_Acquire(lpDIJ2))) - return; - } - - // look for as many buttons as g_input code supports, we don't use the others - for (i = JOYBUTTONS_MIN - 1; i >= 0; i--) - { - joybuttons <<= 1; - if (js.rgbButtons[i]) - joybuttons |= 1; - } - - for (i = JOYHATS_MIN -1; i >=0; i--) - { - if (js.rgdwPOV[i] != 0xffff && js.rgdwPOV[i] != 0xffffffff) - { - if (js.rgdwPOV[i] > 270 * DI_DEGREES || js.rgdwPOV[i] < 90 * DI_DEGREES) - joyhats |= (UINT64)1<<(0 + 4*(UINT64)i); // UP - else if (js.rgdwPOV[i] > 90 * DI_DEGREES && js.rgdwPOV[i] < 270 * DI_DEGREES) - joyhats |= (UINT64)1<<(1 + 4*(UINT64)i); // DOWN - if (js.rgdwPOV[i] > 0 * DI_DEGREES && js.rgdwPOV[i] < 180 * DI_DEGREES) - joyhats |= (UINT64)1<<(3 + 4*(UINT64)i); // LEFT - else if (js.rgdwPOV[i] > 180 * DI_DEGREES && js.rgdwPOV[i] < 360 * DI_DEGREES) - joyhats |= (UINT64)1<<(2 + 4*(UINT64)i); // RIGHT - } - } - - if (joybuttons != lastjoy2buttons) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newbuttons = joybuttons ^ lastjoy2buttons; - lastjoy2buttons = joybuttons; - - for (i = 0; i < JOYBUTTONS_MIN; i++, j <<= 1) - { - if (newbuttons & j) // button changed state? - { - if (joybuttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_2JOY1 + i; - D_PostEvent(&event); - } - } - } - - if (joyhats != lastjoy2hats) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newhats = joyhats ^ lastjoy2hats; - lastjoy2hats = joyhats; - - for (i = 0; i < JOYHATS_MIN*4; i++, j <<= 1) - { - if (newhats & j) // button changed state? - { - if (joyhats & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_2HAT1 + i; - D_PostEvent(&event); - } - } - - } - - // send joystick axis positions - event.type = ev_joystick2; - event.key = event.x = event.y = 0; - - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.X) - { - if (js.lX < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lX > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.Y) - { - if (js.lY < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lY > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.X) event.x = js.lX; // x axis - if (JoyInfo2.Y) event.y = js.lY; // y axis - } - - D_PostEvent(&event); -#if JOYAXISSET > 1 - event.key = 1; - event.x = event.y = 0; - - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.Z) - { - if (js.lZ < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lZ > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.Rx) - { - if (js.lRx < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRx > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.Z) event.x = js.lZ; // z axis - if (JoyInfo2.Rx) event.y = js.lRx; // rx axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 2 - event.key = 2; - event.x = event.y = 0; - - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.Rx) - { - if (js.lRy < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lRy > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.Rz) - { - if (js.lRz < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRz > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.Ry) event.x = js.lRy; // ry axis - if (JoyInfo2.Rz) event.y = js.lRz; // rz axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 3 - event.key = 3; - event.x = event.y = 0; - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.U) - { - if (js.rglSlider[0] < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.rglSlider[0] > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.V) - { - if (js.rglSlider[1] < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.rglSlider[1] > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.U) event.x = js.rglSlider[0]; // U axis - if (JoyInfo2.V) event.y = js.rglSlider[1]; // V axis - } - D_PostEvent(&event); -#endif -} - -static int numofjoy = 0; -static char joyname[MAX_PATH]; -static int needjoy = -1; - -static BOOL CALLBACK DIEnumJoysticksCount (LPCDIDEVICEINSTANCEA lpddi, - LPVOID pvRef) //joyname -{ - numofjoy++; - if (needjoy == numofjoy && pvRef && pvRef == (void *)joyname && lpddi - && lpddi->tszProductName) - { - sprintf(joyname,"%s",lpddi->tszProductName); - return DIENUM_STOP; - } - //else I_OutputMsg("DIEnumJoysticksCount need help!\n"); - return DIENUM_CONTINUE; -} - -INT32 I_NumJoys(void) -{ - HRESULT hr; - needjoy = -1; - numofjoy = 0; - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, - DIEnumJoysticksCount, (LPVOID)&numofjoy, DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - I_OutputMsg("\nI_NumJoys(): EnumDevices FAILED\n"); - } - return numofjoy; - -} - -const char *I_GetJoyName(INT32 joyindex) -{ - HRESULT hr; - needjoy = joyindex; - numofjoy = 0; - ZeroMemory(joyname,sizeof (joyname)); - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, - DIEnumJoysticksCount, (LPVOID)joyname, DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - I_OutputMsg("\nI_GetJoyName(): EnumDevices FAILED\n"); - } - if (joyname[0] == 0) return NULL; - return joyname; -} - -#ifndef NOMUMBLE -// Best Mumble positional audio settings: -// Minimum distance 3.0 m -// Bloom 175% -// Maximum distance 80.0 m -// Minimum volume 50% -#define DEG2RAD (0.017453292519943295769236907684883l) // TAU/360 or PI/180 -#define MUMBLEUNIT (64.0f) // FRACUNITS in a Meter - -static struct { - UINT32 uiVersion; - DWORD uiTick; - float fAvatarPosition[3]; - float fAvatarFront[3]; - float fAvatarTop[3]; // defaults to Y-is-up (only used for leaning) - wchar_t name[256]; // game name - float fCameraPosition[3]; - float fCameraFront[3]; - float fCameraTop[3]; // defaults to Y-is-up (only used for leaning) - wchar_t identity[256]; // player id - UINT32 context_len; - unsigned char context[256]; // server/team - wchar_t description[2048]; // game description -} *mumble = NULL; - -static inline void I_SetupMumble(void) -{ - HANDLE hMap = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink"); - if (!hMap) - return; - - mumble = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(*mumble)); - if (!mumble) - CloseHandle(hMap); -} - -void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) -{ - double angle; - fixed_t anglef; - - if (!mumble) - return; - - if(mumble->uiVersion != 2) { - wcsncpy(mumble->name, L"SRB2 "VERSIONSTRINGW, 256); - wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048); - mumble->uiVersion = 2; - } - mumble->uiTick++; - - if (!netgame || gamestate != GS_LEVEL) { // Zero out, but never delink. - mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f; - mumble->fAvatarFront[0] = 1.0f; - mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f; - mumble->fCameraPosition[0] = mumble->fCameraPosition[1] = mumble->fCameraPosition[2] = 0.0f; - mumble->fCameraFront[0] = 1.0f; - mumble->fCameraFront[1] = mumble->fCameraFront[2] = 0.0f; - return; - } - - { - UINT8 *p = mumble->context; - WRITEMEM(p, server_context, 8); - WRITEINT16(p, gamemap); - mumble->context_len = p - mumble->context; - } - - if (mobj) { - mumble->fAvatarPosition[0] = FIXED_TO_FLOAT(mobj->x) / MUMBLEUNIT; - mumble->fAvatarPosition[1] = FIXED_TO_FLOAT(mobj->z) / MUMBLEUNIT; - mumble->fAvatarPosition[2] = FIXED_TO_FLOAT(mobj->y) / MUMBLEUNIT; - - anglef = AngleFixed(mobj->angle); - angle = FIXED_TO_FLOAT(anglef)*DEG2RAD; - mumble->fAvatarFront[0] = (float)cos(angle); - mumble->fAvatarFront[1] = 0.0f; - mumble->fAvatarFront[2] = (float)sin(angle); - } else { - mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f; - mumble->fAvatarFront[0] = 1.0f; - mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f; - } - - mumble->fCameraPosition[0] = FIXED_TO_FLOAT(listener.x) / MUMBLEUNIT; - mumble->fCameraPosition[1] = FIXED_TO_FLOAT(listener.z) / MUMBLEUNIT; - mumble->fCameraPosition[2] = FIXED_TO_FLOAT(listener.y) / MUMBLEUNIT; - - anglef = AngleFixed(listener.angle); - angle = FIXED_TO_FLOAT(anglef)*DEG2RAD; - mumble->fCameraFront[0] = (float)cos(angle); - mumble->fCameraFront[1] = 0.0f; - mumble->fCameraFront[2] = (float)sin(angle); -} -#endif - -// =========================================================================================== -// DIRECT INPUT KEYBOARD -// =========================================================================================== - -static UINT8 ASCIINames[256] = -{ - // 0 1 2 3 4 5 6 7 - // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', KEY_MINUS,KEY_EQUALS,KEY_BACKSPACE, KEY_TAB, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']',KEY_ENTER,KEY_LCTRL,'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'', '`', KEY_LSHIFT,'\\', 'z', 'x', 'c', 'v', - 'b', 'n', 'm', ',', '.', '/', KEY_RSHIFT,'*', - KEY_LALT,KEY_SPACE,KEY_CAPSLOCK,KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5, - KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10,KEY_NUMLOCK,KEY_SCROLLLOCK,KEY_KEYPAD7, - KEY_KEYPAD8,KEY_KEYPAD9,KEY_MINUSPAD,KEY_KEYPAD4,KEY_KEYPAD5,KEY_KEYPAD6,KEY_PLUSPAD,KEY_KEYPAD1, - KEY_KEYPAD2,KEY_KEYPAD3,KEY_KEYPAD0,KEY_KPADDEL,0,0,0, KEY_F11, - KEY_F12,0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - // 0 1 2 3 4 5 6 7 - // 8 9 A B C D E F - - 0, 0, 0, 0, 0, 0, 0, 0, // 0x80 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, KEY_ENTER,KEY_RCTRL,0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, KEY_KPADDEL, 0,KEY_KPADSLASH,0, 0, - KEY_RALT, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, KEY_HOME, // 0xc0 - KEY_UPARROW,KEY_PGUP,0,KEY_LEFTARROW,0,KEY_RIGHTARROW,0,KEY_END, - KEY_DOWNARROW,KEY_PGDN, KEY_INS,KEY_DEL,0,0,0,0, - 0, 0, 0,KEY_LEFTWIN,KEY_RIGHTWIN,KEY_MENU, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, // 0xe0 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -// Return a key that has been pushed, or 0 (replace getchar() at game startup) -// -INT32 I_GetKey(void) -{ - event_t *ev; - - if (eventtail != eventhead) - { - ev = &events[eventtail]; - eventtail = (eventtail+1) & (MAXEVENTS-1); - if (ev->type == ev_keydown || ev->type == ev_console) - return ev->key; - else - return 0; - } - return 0; -} - -// ----------------- -// I_StartupKeyboard -// Installs DirectInput keyboard -// ----------------- -#define DI_KEYBOARD_BUFFERSIZE 32 // number of data elements in keyboard buffer - -static void I_StartupKeyboard(void) -{ - DIPROPDWORD dip; - - if (dedicated || !lpDI) - return; - - // make sure the app window has the focus or DirectInput acquire keyboard won't work - if (hWndMain) - { - SetFocus(hWndMain); - ShowWindow(hWndMain, SW_SHOW); - UpdateWindow(hWndMain); - } - - // detect error - if (lpDIK) - { - I_OutputMsg("I_StartupKeyboard(): called twice\n"); - return; - } - - CreateDevice2A(lpDI, &GUID_SysKeyboard, &lpDIK, NULL); - - if (lpDIK) - { - if (FAILED(IDirectInputDevice_SetDataFormat(lpDIK, &c_dfDIKeyboard))) - I_Error("Couldn't set keyboard data format"); - - // create buffer for buffered data - dip.diph.dwSize = sizeof (dip); - dip.diph.dwHeaderSize = sizeof (dip.diph); - dip.diph.dwObj = 0; - dip.diph.dwHow = DIPH_DEVICE; - dip.dwData = DI_KEYBOARD_BUFFERSIZE; - if (FAILED(IDirectInputDevice_SetProperty(lpDIK, DIPROP_BUFFERSIZE, &dip.diph))) - I_Error("Couldn't set keyboard buffer size"); - - if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIK, hWndMain, - DISCL_NONEXCLUSIVE|DISCL_FOREGROUND))) - { - I_Error("Couldn't set keyboard coop level"); - } - } - else - I_Error("Couldn't create keyboard input"); - - I_AddExitFunc(I_ShutdownKeyboard); - hacktics = 0; // see definition - keyboard_started = true; -} - -// ------------------ -// I_ShutdownKeyboard -// Release DirectInput keyboard. -// ------------------ -static VOID I_ShutdownKeyboard(VOID) -{ - if (!keyboard_started) - return; - - CONS_Printf("I_ShutdownKeyboard()\n"); - - if (lpDIK) - { - IDirectInputDevice_Unacquire(lpDIK); - IDirectInputDevice_Release(lpDIK); - lpDIK = NULL; - } - - keyboard_started = false; -} - -// ------------------- -// I_GetKeyboardEvents -// Get buffered data from the keyboard -// ------------------- -static VOID I_GetKeyboardEvents(VOID) -{ - static BOOL KeyboardLost = false; - - // simply repeat the last pushed key every xx tics, - // make more user friendly input for Console and game Menus -#define KEY_REPEAT_DELAY (NEWTICRATE/17) // TICRATE tics, repeat every 1/3 second - static LONG RepeatKeyTics = 0; - static int RepeatKeyCode = 0; - - DIDEVICEOBJECTDATA rgdod[DI_KEYBOARD_BUFFERSIZE]; - DWORD dwItems, d; - HRESULT hr; - int ch; - - event_t event; - ZeroMemory(&event,sizeof (event)); - - if (!keyboard_started) - return; - - if (!appActive && RepeatKeyCode) // Stop when lost focus - { - event.type = ev_keyup; - event.key = RepeatKeyCode; - D_PostEvent(&event); - RepeatKeyCode = 0; - } -getBufferedData: - dwItems = DI_KEYBOARD_BUFFERSIZE; - hr = IDirectInputDevice_GetDeviceData(lpDIK, sizeof (DIDEVICEOBJECTDATA), rgdod, &dwItems, 0); - - // If data stream was interrupted, reacquire the device and try again. - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - // why it succeeds to acquire just after I don't understand.. so I set the flag BEFORE - KeyboardLost = true; - - hr = IDirectInputDevice_Acquire(lpDIK); - if (SUCCEEDED(hr)) - goto getBufferedData; - return; - } - - // we lost data, get device actual state to recover lost information - if (hr == DI_BUFFEROVERFLOW) - { - /// \note either uncomment or delete block - //I_Error("DI buffer overflow (keyboard)"); - //I_RecoverKeyboardState (); - - //hr = IDirectInputDevice_GetDeviceState (lpDIM, sizeof (keys), &diMouseState); - } - - // We got buffered input, act on it - if (SUCCEEDED(hr)) - { - // if we previously lost keyboard data, recover its current state - if (KeyboardLost) - { - /// \bug hack simply clears the keys so we don't have the last pressed keys - /// still active.. to have to re-trigger it is not much trouble for the user. - ZeroMemory(gamekeydown, NUMKEYS); - KeyboardLost = false; - } - - // dwItems contains number of elements read (could be 0) - for (d = 0; d < dwItems; d++) - { - // dwOfs member is DIK_* value - // dwData member 0x80 bit set press down, clear is release - - if (rgdod[d].dwData & 0x80) - event.type = ev_keydown; - else - event.type = ev_keyup; - - ch = rgdod[d].dwOfs & 0xFF; - if (ASCIINames[ch]) - event.key = ASCIINames[ch]; - else - event.key = 0x80; - - D_PostEvent(&event); - } - - // Key Repeat - if (dwItems) - { - // new key events, so stop repeating key - RepeatKeyCode = 0; - // delay is tripled for first repeating key - RepeatKeyTics = hacktics + (KEY_REPEAT_DELAY*3); - if (event.type == ev_keydown) // use the last event! - RepeatKeyCode = event.key; - } - else - { - // no new keys, repeat last pushed key after some time - if (RepeatKeyCode && hacktics - RepeatKeyTics > KEY_REPEAT_DELAY) - { - event.type = ev_keydown; - event.key = RepeatKeyCode; - D_PostEvent(&event); - - RepeatKeyTics = hacktics; - } - } - } -} - -static HINSTANCE DInputDLL = NULL; -typedef HRESULT (WINAPI *DICreateA)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); -static DICreateA pfnDirectInputCreateA = NULL; - -BOOL LoadDirectInput(VOID) -{ - // load dinput.dll - DInputDLL = LoadLibraryA("DINPUT.DLL"); - if (DInputDLL == NULL) - return false; - pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA"); - if (pfnDirectInputCreateA == NULL) - return false; - return true; -} - -static inline VOID UnLoadDirectInput(VOID) -{ - if (!DInputDLL) - return; - FreeLibrary(DInputDLL); - pfnDirectInputCreateA = NULL; - DInputDLL = NULL; -} - - -// -// Closes DirectInput -// -static VOID I_ShutdownDirectInput(VOID) -{ - if (lpDI) - IDirectInput_Release(lpDI); - lpDI = NULL; - UnLoadDirectInput(); -} - -// This stuff should get rid of the exception and page faults when -// SRB2 bugs out with an error. Now it should exit cleanly. -// -INT32 I_StartupSystem(void) -{ - HRESULT hr; - HINSTANCE myInstance = GetModuleHandle(NULL); - - // some 'more global than globals' things to initialize here ? - graphics_started = keyboard_started = sound_started = cdaudio_started = false; - - I_StartupKeyboard(); - -#ifdef NDEBUG - -#ifdef BUGTRAP - if(!IsBugTrapLoaded()) - { -#endif - signal(SIGABRT, signal_handler); - signal(SIGFPE, signal_handler); - signal(SIGILL, signal_handler); - signal(SIGSEGV, signal_handler); - signal(SIGTERM, signal_handler); - signal(SIGINT, signal_handler); -#ifdef BUGTRAP - } -#endif - -#endif - -#ifndef NOMUMBLE - I_SetupMumble(); -#endif - - if (!pfnDirectInputCreateA) - return 1; - // create DirectInput - so that I_StartupKeyboard/Mouse can be called later on - // from D_SRB2Main just like DOS version - hr = pfnDirectInputCreateA(myInstance, DIRECTINPUT_VERSION, &lpDI, NULL); - - if (SUCCEEDED(hr)) - bDX0300 = FALSE; - else - { - // try opening DirectX3 interface for NT compatibility - hr = pfnDirectInputCreateA(myInstance, DXVERSION_NTCOMPATIBLE, &lpDI, NULL); - - if (FAILED(hr)) - { - const char *sErr; - switch (hr) - { - case DIERR_BETADIRECTINPUTVERSION: - sErr = "DIERR_BETADIRECTINPUTVERSION"; - break; - case DIERR_INVALIDPARAM: - sErr = "DIERR_INVALIDPARAM"; - break; - case DIERR_OLDDIRECTINPUTVERSION : - sErr = "DIERR_OLDDIRECTINPUTVERSION"; - break; - case DIERR_OUTOFMEMORY: - sErr = "DIERR_OUTOFMEMORY"; - break; - default: - sErr = "UNKNOWN"; - break; - } - I_Error("Couldn't create DirectInput (reason: %s)", sErr); - } - else - CONS_Printf("\x82%s", M_GetText("Using DirectX3 interface\n")); - - // only use DirectInput3 compatible structures and calls - bDX0300 = TRUE; - } - I_AddExitFunc(I_ShutdownDirectInput); - return 0; -} - -// Closes down everything. This includes restoring the initial -// palette and video mode, and removing whatever mouse, keyboard, and -// timer routines have been installed. -// -/// \bug doesn't restore wave/midi device volume -// -// Shutdown user funcs are effectively called in reverse order. -// -void I_ShutdownSystem(void) -{ - int c; - - for (c = MAX_QUIT_FUNCS - 1; c >= 0; c--) - if (quit_funcs[c]) - (*quit_funcs[c])(); -} - -// my god how win32 suck -typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); - -void I_GetDiskFreeSpace(INT64* freespace) -{ - static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; - static boolean testwin95 = false; - ULARGE_INTEGER usedbytes, lfreespace; - - if (!testwin95) - { - pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); - testwin95 = true; - } - if (pfnGetDiskFreeSpaceEx) - { - if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL)) - *freespace = lfreespace.QuadPart; - else - *freespace = INT32_MAX; - } - else - { - DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters; - GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector, - &NumberOfFreeClusters, &TotalNumberOfClusters); - *freespace = BytesPerSector * SectorsPerCluster * NumberOfFreeClusters; - } -} - -char *I_GetUserName(void) -{ - static char username[MAXPLAYERNAME+1]; - char *p; - DWORD i = MAXPLAYERNAME; - - if (!GetUserNameA(username, &i)) - { - p = getenv("USER"); - if (!p) - { - p = getenv("user"); - if (!p) - { - p = getenv("USERNAME"); - if (!p) - { - p = getenv("username"); - if (!p) - { - return NULL; - } - } - } - } - strlcpy(username, p, sizeof (username)); - } - - if (!strlen(username)) - return NULL; - return username; -} - -INT32 I_mkdir(const char *dirname, INT32 unixright) -{ - UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt... - return CreateDirectoryA(dirname, NULL); -} - -char * I_GetEnv(const char *name) -{ - return getenv(name); -} - -INT32 I_PutEnv(char *variable) -{ - return putenv(variable); -} - -INT32 I_ClipboardCopy(const char *data, size_t size) -{ - (void)data; - (void)size; - return -1; -} - -const char *I_ClipboardPaste(void) -{ - return NULL; -} - -typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD); - -const CPUInfoFlags *I_CPUInfo(void) -{ - static CPUInfoFlags WIN_CPUInfo; - SYSTEM_INFO SI; - p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); - - ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo)); - if (pfnCPUID) - { - WIN_CPUInfo.FPPE = pfnCPUID( 0); //PF_FLOATING_POINT_PRECISION_ERRATA - WIN_CPUInfo.FPE = pfnCPUID( 1); //PF_FLOATING_POINT_EMULATED - WIN_CPUInfo.cmpxchg = pfnCPUID( 2); //PF_COMPARE_EXCHANGE_DOUBLE - WIN_CPUInfo.MMX = pfnCPUID( 3); //PF_MMX_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.PPCMM64 = pfnCPUID( 4); //PF_PPC_MOVEMEM_64BIT_OK - WIN_CPUInfo.ALPHAbyte = pfnCPUID( 5); //PF_ALPHA_BYTE_INSTRUCTIONS - WIN_CPUInfo.SSE = pfnCPUID( 6); //PF_XMMI_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.AMD3DNow = pfnCPUID( 7); //PF_3DNOW_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.RDTSC = pfnCPUID( 8); //PF_RDTSC_INSTRUCTION_AVAILABLE - WIN_CPUInfo.PAE = pfnCPUID( 9); //PF_PAE_ENABLED - WIN_CPUInfo.SSE2 = pfnCPUID(10); //PF_XMMI64_INSTRUCTIONS_AVAILABLE - //WIN_CPUInfo.blank = pfnCPUID(11); //PF_SSE_DAZ_MODE_AVAILABLE - WIN_CPUInfo.DEP = pfnCPUID(12); //PF_NX_ENABLED - WIN_CPUInfo.SSE3 = pfnCPUID(13); //PF_SSE3_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.cmpxchg16b = pfnCPUID(14); //PF_COMPARE_EXCHANGE128 - WIN_CPUInfo.cmp8xchg16 = pfnCPUID(15); //PF_COMPARE64_EXCHANGE128 - WIN_CPUInfo.PFC = pfnCPUID(16); //PF_CHANNELS_ENABLED - } - GetSystemInfo(&SI); - WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors; - WIN_CPUInfo.IA64 = (SI.dwProcessorType == 2200); // PROCESSOR_INTEL_IA64 - WIN_CPUInfo.AMD64 = (SI.dwProcessorType == 8664); // PROCESSOR_AMD_X8664 - return &WIN_CPUInfo; -} - -static void CPUAffinity_OnChange(void); -static consvar_t cv_cpuaffinity = CVAR_INIT ("cpuaffinity", "-1", CV_CALL, NULL, CPUAffinity_OnChange); - -typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID); -static p_GetCurrentProcess pfnGetCurrentProcess = NULL; -typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR); -static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL; -typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR); -static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL; - -static inline VOID GetAffinityFuncs(VOID) -{ - HMODULE h = GetModuleHandleA("kernel32.dll"); - pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess"); - pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask"); - pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask"); -} - -static void CPUAffinity_OnChange(void) -{ - DWORD_PTR dwProcMask, dwSysMask; - HANDLE selfpid; - - if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask) - return; - else - selfpid = pfnGetCurrentProcess(); - - pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask); - - /* If resulting mask is zero, don't change anything and fall back to - * actual mask. - */ - if(dwSysMask & cv_cpuaffinity.value) - { - pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value); - CV_StealthSetValue(&cv_cpuaffinity, (int)(dwSysMask & cv_cpuaffinity.value)); - } - else - CV_StealthSetValue(&cv_cpuaffinity, (int)dwProcMask); -} - -void I_RegisterSysCommands(void) -{ - GetAffinityFuncs(); - CV_RegisterVar(&cv_cpuaffinity); -} -#endif diff --git a/src/win32/win_vid.c b/src/win32/win_vid.c deleted file mode 100644 index 7a33e1931..000000000 --- a/src/win32/win_vid.c +++ /dev/null @@ -1,1113 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief win32 video driver for Doom Legacy - -#include "../doomdef.h" - -#ifdef _WINDOWS - -#include -#include - -#include "../d_clisrv.h" -#include "../i_system.h" -#include "../m_argv.h" -#include "../v_video.h" -#include "../st_stuff.h" -#include "../i_video.h" -#include "../z_zone.h" -#include "fabdxlib.h" -#include "../doomstat.h" -#include "win_main.h" -#include "../command.h" -#include "../screen.h" - -#ifdef HWRENDER -#include "win_dll.h" // loading the render DLL -#include "../hardware/hw_drv.h" // calling driver init & shutdown -#include "../hardware/hw_main.h" // calling HWR module init & shutdown -#endif - -// ------- -// Globals -// ------- - -// this is the CURRENT rendermode!! very important: used by w_wad, and much other code -rendermode_t rendermode = render_soft; -rendermode_t chosenrendermode = render_none; // set by command line arguments -static void OnTop_OnChange(void); -// synchronize page flipping with screen refresh -static CV_PossibleValue_t CV_NeverOnOff[] = {{-1, "Never"}, {0, "Off"}, {1, "On"}, {0, NULL}}; -consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, OnTop_OnChange); -static consvar_t cv_stretch = CVAR_INIT ("stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL); -static consvar_t cv_ontop = CVAR_INIT ("ontop", "Never", 0, CV_NeverOnOff, NULL); - -boolean highcolor; - -static BOOL bDIBMode; // means we are using DIB instead of DirectDraw surfaces -static LPBITMAPINFO bmiMain = NULL; -static HDC hDCMain = NULL; - -// ----------------- -// Video modes stuff -// ----------------- - -#define MAX_EXTRA_MODES 36 -static vmode_t extra_modes[MAX_EXTRA_MODES] = {{NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, 0}}; -static char names[MAX_EXTRA_MODES][10]; - -static INT32 numvidmodes; // total number of DirectDraw display modes -static vmode_t *pvidmodes; // start of videomodes list. -static vmode_t *pcurrentmode; // the current active videomode. -static BOOL bWinParm; -static INT32 WINAPI VID_SetWindowedDisplayMode(viddef_t *lvid, vmode_t *currentmode); - -// this holds description of the startup video mode, -// the resolution is 320x200, windowed on the desktop -static char winmodenames[NUMSPECIALMODES][11] = { - // W to make sure it's the windowed mode - "320x200W", - "640x400W", - "960x600W", - "1280x800W" -}; -vmode_t specialmodes[NUMSPECIALMODES] = -{ - { - NULL, - winmodenames[0], // hehe - 320, 200, //(200.0/320.0)*(320.0/240.0), - 320, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - }, - { - NULL, - winmodenames[1], // haha - 640, 400, - 640, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - }, - { - NULL, - winmodenames[2], // hihi? - 960, 600, - 960, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - }, - { - NULL, - winmodenames[3], // hoho! - 1280, 800, - 1280, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - } -}; - -// ------ -// Protos -// ------ -static void VID_Command_NumModes_f(void); -static void VID_Command_ModeInfo_f(void); -static void VID_Command_ModeList_f(void); -static void VID_Command_Mode_f(void); -static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode); -static vmode_t *VID_GetModePtr(int modenum); -static VOID VID_Init(VOID); -static BOOL VID_FreeAndAllocVidbuffer(viddef_t *lvid); - -#if 0 - // Disable Composition in Vista DWM (Desktop Window Manager) ---------------- -static HMODULE DMdll = NULL; -typedef HRESULT (CALLBACK *P_DwmIsCompositionEnabled) (BOOL *pfEnabled); -static P_DwmIsCompositionEnabled pfnDwmIsCompositionEnabled = NULL; -typedef HRESULT (CALLBACK *P_DwmEnableComposition) (BOOL fEnable); -static P_DwmEnableComposition pfnDwmEnableComposition = NULL; -static BOOL AeroWasEnabled = FALSE; - -static inline VOID UnloadDM(VOID) -{ - pfnDwmEnableComposition = NULL; - pfnDwmIsCompositionEnabled = NULL; - if (DMdll) FreeLibrary(DMdll); - DMdll = NULL; -} - -static inline BOOL LoadDM(VOID) -{ - if (DMdll) - return TRUE; - - DMdll = LoadLibraryA("dwmapi.dll"); - if (DMdll) - I_OutputMsg("dmwapi.dll loaded, Vista's Desktop Window Manager API\n"); - else - return FALSE; - - pfnDwmIsCompositionEnabled = (P_DwmIsCompositionEnabled)GetProcAddress(DMdll, "DwmIsCompositionEnabled"); - if (pfnDwmIsCompositionEnabled) - I_OutputMsg("Composition Aero API found, DwmIsCompositionEnabled\n"); - - pfnDwmEnableComposition = (P_DwmEnableComposition)GetProcAddress(DMdll, "DwmEnableComposition"); - if (pfnDwmEnableComposition) - I_OutputMsg("Composition Aero API found, DwmEnableComposition\n"); - - return TRUE; -} - -static inline VOID DisableAero(VOID) -{ - BOOL pfnDwmEnableCompositiond = FALSE; - AeroWasEnabled = FALSE; - - if (!LoadDM()) - return; - - if (pfnDwmIsCompositionEnabled && SUCCEEDED(pfnDwmIsCompositionEnabled(&pfnDwmEnableCompositiond))) - I_OutputMsg("Got the result of DwmIsCompositionEnabled, %i\n", pfnDwmEnableCompositiond); - else - return; - - if ((AeroWasEnabled = pfnDwmEnableCompositiond)) - I_OutputMsg("Disable the Aero rendering\n"); - else - return; - - if (pfnDwmEnableComposition && SUCCEEDED(pfnDwmEnableComposition(FALSE))) - I_OutputMsg("Aero rendering disabled\n"); - else - I_OutputMsg("We failed to disable the Aero rendering\n"); -} - -static inline VOID ResetAero(VOID) -{ - if (pfnDwmEnableComposition && AeroWasEnabled) - { - if (SUCCEEDED(pfnDwmEnableComposition(AeroWasEnabled))) - I_OutputMsg("Aero rendering setting restored\n"); - else - I_OutputMsg("We failed to restore Aero rendering\n"); - } - UnloadDM(); -} -#endif - -// ----------------- -// I_StartupGraphics -// Initialize video mode, setup dynamic screen size variables, -// and allocate screens. -// ----------------- -void I_StartupGraphics(void) -{ - if (graphics_started) - return; - -#ifdef HWRENDER - else if (M_CheckParm("-opengl")) - rendermode = render_opengl; - else -#endif - rendermode = render_soft; - - if (dedicated) - rendermode = render_none; - else - VID_Init(); - - // register exit code for graphics - I_AddExitFunc(I_ShutdownGraphics); - if (!dedicated) graphics_started = true; -} - -void VID_StartupOpenGL(void){} - -// ------------------ -// I_ShutdownGraphics -// Close the screen, restore previous video mode. -// ------------------ -void I_ShutdownGraphics(void) -{ -#ifdef HWRENDER - const rendermode_t oldrendermode = rendermode; -#endif - -// This is BAD because it makes the I_Error box screw up! -// rendermode = render_none; - - if (!graphics_started) - return; - - CONS_Printf("I_ShutdownGraphics: "); - - //FreeConsole(); - - //ResetAero(); - - // release windowed startup stuff - if (hDCMain) - { - ReleaseDC(hWndMain, hDCMain); - hDCMain = NULL; - } - if (bmiMain) - { - GlobalFree(bmiMain); - bmiMain = NULL; - } - -#ifdef HWRENDER - if (oldrendermode != render_soft) - { - HWR_Shutdown(); // free stuff from the hardware renderer - HWD.pfnShutdown(); // close 3d card display - Shutdown3DDriver(); // free the driver DLL - } -#endif - - // free the last video mode screen buffers - if (vid.buffer) - { - GlobalFree(vid.buffer); - vid.buffer = NULL; - } - -#ifdef HWRENDER - if (rendermode == render_soft) -#endif - CloseDirectDraw(); - - graphics_started = false; -} - -// -------------- -// I_UpdateNoBlit -// -------------- -void I_UpdateNoBlit(void) -{ - // what is this? -} - -// I_SkipFrame -// -// Returns true if it thinks we can afford to skip this frame -// from PrBoom's src/SDL/i_video.c -static inline boolean I_SkipFrame(void) -{ - static boolean skip = false; - - if (render_soft != rendermode) - return false; - - skip = !skip; - switch (gamestate) - { - case GS_LEVEL: - if (!paused) - return false; - //case GS_TIMEATTACK: -- sorry optimisation but now we have a cool level platter and that being laggardly looks terrible -#ifndef NONET - /* FALLTHRU */ - case GS_WAITINGPLAYERS: -#endif - return skip; // Skip odd frames - default: - return false; - } -} - -static void OnTop_OnChange(void) -{ - const UINT uFlags = SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER; - RECT bounds; - int x = 0, y = 0, w = 0, h = 0; - - if (!hWndMain || bAppFullScreen || cv_ontop.value == -1) - return; - - GetWindowRect(hWndMain, &bounds); - AdjustWindowRectEx(&bounds, GetWindowLong(hWndMain, GWL_STYLE), 0, 0); - w = bounds.right - (x = bounds.left); h = bounds.bottom - (y = bounds.top); - - if (cv_ontop.value && !paused) - SetWindowPos(hWndMain, HWND_TOP , x, y, w, h, uFlags); - else - SetWindowPos(hWndMain, HWND_NOTOPMOST, x, y, w, h, uFlags); -} - -// -------------- -// I_FinishUpdate -// -------------- -void I_FinishUpdate(void) -{ - if (rendermode == render_none) - return; - - if (I_SkipFrame()) - return; - - if (marathonmode) - SCR_DisplayMarathonInfo(); - - // draw captions if enabled - if (cv_closedcaptioning.value) - SCR_ClosedCaptions(); - - // display a graph of ticrate - if (cv_ticrate.value) - SCR_DisplayTicRate(); - - if (cv_showping.value && netgame && consoleplayer != serverplayer) - SCR_DisplayLocalPing(); - - // - if (bDIBMode) - { - // paranoia - if (!hDCMain || !bmiMain || !vid.buffer) - return; - // main game loop, still in a window (-win parm) - SetDIBitsToDevice(hDCMain, 0, 0, vid.width, vid.height, 0, 0, 0, vid.height, vid.buffer, bmiMain, - DIB_RGB_COLORS); - } - else -#ifdef HWRENDER - if (rendermode != render_soft) - HWD.pfnFinishUpdate(cv_vidwait.value); - else -#endif - { - // DIRECT DRAW - // copy virtual screen to real screen - // can fail when not active (alt-tab) - if (LockScreen()) - { - /// \todo use directX blit here!!? a blit might use hardware with access - /// to main memory on recent hardware, and software blit of directX may be - /// optimized for p2 or mmx?? - if (ScreenHeight > vid.height) - { - UINT8 *ptr = (UINT8 *)ScreenPtr; - size_t half_excess = ScreenPitch*(ScreenHeight-vid.height)/2; - memset(ptr, 0x1F, half_excess); - ptr += half_excess; - VID_BlitLinearScreen(screens[0], ptr, vid.width*vid.bpp, vid.height, - vid.width*vid.bpp, ScreenPitch); - ptr += vid.height*ScreenPitch; - memset(ptr, 0x1F, half_excess); - } - else - VID_BlitLinearScreen(screens[0], (UINT8 *)ScreenPtr, vid.width*vid.bpp, vid.height, - vid.width*vid.bpp, ScreenPitch); - - UnlockScreen(); - - // swap screens - ScreenFlip(cv_vidwait.value); - } - } -} - -// --------------- -// I_UpdateNoVsync -// --------------- -void I_UpdateNoVsync(void) -{ - int real_vidwait = cv_vidwait.value; - cv_vidwait.value = 0; - I_FinishUpdate(); - cv_vidwait.value = real_vidwait; -} - -// -// This is meant to be called only by CONS_Printf() while game startup -// -void I_LoadingScreen(LPCSTR msg) -{ - RECT rect; - - // paranoia - if (!hDCMain || !bmiMain || !vid.buffer) - return; - - GetClientRect(vid.WndParent, &rect); - - SetDIBitsToDevice(hDCMain, 0, 0, vid.width, vid.height, 0, 0, 0, vid.height, vid.buffer, bmiMain, DIB_RGB_COLORS); - - if (msg) - { - if (rect.bottom - rect.top > 32) - rect.top = rect.bottom - 32; // put msg on bottom of window - SetBkMode(hDCMain, TRANSPARENT); - SetTextColor(hDCMain, RGB(0x00, 0x00, 0x00)); - DrawTextA(hDCMain, msg, -1, &rect, DT_WORDBREAK|DT_CENTER); - } -} - -// ------------ -// I_ReadScreen -// ------------ -void I_ReadScreen(UINT8 *scr) -{ - // DEBUGGING - if (rendermode != render_soft) - I_Error("I_ReadScreen: called while in non-software mode"); - VID_BlitLinearScreen(screens[0], scr, vid.width*vid.bpp, vid.height, vid.width*vid.bpp, - vid.rowbytes); -} - -// ------------ -// I_SetPalette -// ------------ -void I_SetPalette(RGBA_t *palette) -{ - int i; - - if (bDIBMode) - { - // set palette in RGBQUAD format, NOT THE SAME ORDER as PALETTEENTRY, grmpf! - RGBQUAD *pColors; - pColors = (RGBQUAD *)((LPBYTE)bmiMain + bmiMain->bmiHeader.biSize); - ZeroMemory(pColors, sizeof (RGBQUAD)*256); - for (i = 0; i < 256; i++, pColors++, palette++) - { - pColors->rgbRed = palette->s.red; - pColors->rgbGreen = palette->s.green; - pColors->rgbBlue = palette->s.blue; - } - } - else -#ifdef HWRENDER - if (rendermode == render_soft) -#endif - { - PALETTEENTRY mainpal[256]; - - // this clears the 'flag' for each color in palette - ZeroMemory(mainpal, sizeof mainpal); - - // set palette in PALETTEENTRY format - for (i = 0; i < 256; i++, palette++) - { - mainpal[i].peRed = palette->s.red; - mainpal[i].peGreen = palette->s.green; - mainpal[i].peBlue = palette->s.blue; - } - SetDDPalette(mainpal); // set DirectDraw palette - } -} - -// -// return number of video modes in pvidmodes list -// MODES ARE ZERO INDEXED. DO NOT USE (n > nummodes). USE >= INSTEAD. -// -INT32 VID_NumModes(void) -{ - return numvidmodes; -} - -// return a video mode number from the dimensions -// returns any available video mode if the mode was not found -INT32 VID_GetModeForSize(INT32 w, INT32 h) -{ - vmode_t *pv = pvidmodes; - int modenum = 0; - - // Fullscreen resolutions exist - if (numvidmodes > NUMSPECIALMODES) - { - // skip the special modes so that it finds only fullscreen modes - for (; pv && modenum < NUMSPECIALMODES; pv = pv->pnext, ++modenum); - for (; pv; pv = pv->pnext, ++modenum) - if (pv->width == (unsigned)w && pv->height == (unsigned)h) - return modenum; - - // Try default video mode first - if (w != cv_scr_width.value || h != cv_scr_height.value) - return VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value); - - // didn't find, return first fullscreen mode - return NUMSPECIALMODES; - } - - // rely only on special (windowed) modes - for (; pv && modenum < NUMSPECIALMODES; pv = pv->pnext, ++modenum) - if (pv->width == (unsigned)w && pv->height == (unsigned)h) - return modenum; - - // Try default video mode first - if (w != cv_scr_width.value || h != cv_scr_height.value) - return VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value); - - // didn't find, return first windowed mode - return 0; -} - -// -// Enumerate DirectDraw modes available -// -static int nummodes = 0; -static BOOL GetExtraModesCallback(int width, int height, int bpp) -{ -#ifdef _DEBUG - CONS_Printf("mode %d x %d x %d bpp\n", width, height, bpp); -#endif - - // skip all unwanted modes - if (highcolor && bpp != 15) - goto skip; - if (!highcolor && bpp != 8) - goto skip; - - if (bpp > 16 || width > MAXVIDWIDTH || height > MAXVIDHEIGHT) - goto skip; - - // check if we have space for this mode - if (nummodes >= MAX_EXTRA_MODES) - { -#ifdef _DEBUG - CONS_Printf("mode skipped (too many)\n"); -#endif - return FALSE; - } - - // store mode info - extra_modes[nummodes].pnext = &extra_modes[nummodes+1]; - memset(names[nummodes], 0, 10); - snprintf(names[nummodes], 9, "%dx%d", width, height); - - extra_modes[nummodes].name = names[nummodes]; - extra_modes[nummodes].width = width; - extra_modes[nummodes].height = height; - - // exactly, the current FinishUdpate() gets the rowbytes itself after locking the video buffer - // so for now we put anything here - extra_modes[nummodes].rowbytes = width; - extra_modes[nummodes].windowed = false; - extra_modes[nummodes].misc = 0; // unused - extra_modes[nummodes].pextradata = NULL; - extra_modes[nummodes].setmode = VID_SetDirectDrawMode; - - extra_modes[nummodes].numpages = 3; // triple-buffer (but this value is unused) - - extra_modes[nummodes].bytesperpixel = (bpp+1)>>3; - - nummodes++; -skip: - return TRUE; -} - -// -// Collect info about DirectDraw display modes we use -// -static inline VOID VID_GetExtraModes(VOID) -{ - nummodes = 0; - EnumDirectDrawDisplayModes(GetExtraModesCallback); - - // add the extra modes (not 320x200) at the start of the mode list (if there are any) - if (nummodes) - { - extra_modes[nummodes-1].pnext = NULL; - pvidmodes = &extra_modes[0]; - numvidmodes += nummodes; - } -} - -// --------------- -// WindowMode_Init -// Add windowed modes to the start of the list, -// mode 0 is used for windowed console startup (works on all computers with no DirectX) -// --------------- -static VOID WindowMode_Init(VOID) -{ - int modenum; - - for (modenum = 0; modenum < NUMSPECIALMODES - 1; modenum++) - specialmodes[modenum].pnext = &specialmodes[modenum + 1]; - specialmodes[NUMSPECIALMODES-1].pnext = pvidmodes; - - pvidmodes = specialmodes; - numvidmodes += NUMSPECIALMODES; -} - -// ************************************************************************************* -// VID_Init -// Initialize Video modes subsystem -// ************************************************************************************* -static VOID VID_Init(VOID) -{ -#ifdef _DEBUG - vmode_t *pv; - int iMode; -#endif - - // if '-win' is specified on the command line, do not add DirectDraw modes - bWinParm = M_CheckParm("-win"); - - COM_AddCommand("vid_nummodes", VID_Command_NumModes_f); - COM_AddCommand("vid_modeinfo", VID_Command_ModeInfo_f); - COM_AddCommand("vid_modelist", VID_Command_ModeList_f); - COM_AddCommand("vid_mode", VID_Command_Mode_f); - - CV_RegisterVar(&cv_vidwait); - CV_RegisterVar(&cv_stretch); - CV_RegisterVar(&cv_ontop); - - // setup the videmodes list, - // note that mode 0 must always be VGA mode 0x13 - pvidmodes = pcurrentmode = NULL; - numvidmodes = 0; - - //DisableAero(); - - // store the main window handle in viddef struct - SetWindowPos(hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSENDCHANGING|SWP_NOSIZE|SWP_NOMOVE); - vid.WndParent = hWndMain; - vid.buffer = NULL; - - // we startup in windowed mode using DIB bitmap - // we will use DirectDraw when switching fullScreen and entering main game loop - bDIBMode = TRUE; - bAppFullScreen = FALSE; - -#ifdef HWRENDER - // initialize the appropriate display device - if (rendermode != render_soft) - { - const char *drvname = NULL; - - switch (rendermode) - { - case render_opengl: - drvname = "r_opengl.dll"; - break; - default: - I_Error("Unknown hardware render mode"); - } - - // load the DLL - if (drvname && Init3DDriver(drvname)) - { - int hwdversion = HWD.pfnGetRenderVersion(); - if (hwdversion != VERSION) - CONS_Alert(CONS_WARNING, M_GetText("This r_opengl version is not supported, use it at your own risk!\n")); - - // perform initialisations - HWD.pfnInit(I_Error); - // get available display modes for the device - HWD.pfnGetModeList(&pvidmodes, &numvidmodes); - } - else - { - switch (rendermode) - { - case render_opengl: - I_Error("Error initializing OpenGL"); - default: - break; - } - rendermode = render_soft; - } - } - - if (rendermode == render_soft) -#endif - if (!bWinParm) - { - if (!CreateDirectDrawInstance()) - bWinParm = TRUE; - else // get available display modes for the device - VID_GetExtraModes(); - } - - // the game boots in 320x200 standard VGA, but - // we need a highcolor mode to run the game in highcolor - if (highcolor && !numvidmodes) - I_Error("Cannot run in highcolor - No 15bit highcolor DirectX video mode found."); - - // add windowed mode at the start of the list, very important! - WindowMode_Init(); - - if (!numvidmodes) - I_Error("No display modes available."); - -#ifdef _DEBUG // DEBUG - for (iMode = 0, pv = pvidmodes; pv; pv = pv->pnext, iMode++) - I_OutputMsg("#%02d: %dx%dx%dbpp (desc: '%s')\n", iMode, pv->width, pv->height, pv->bytesperpixel, pv->name); -#endif - - // set the startup screen in a window - VID_SetMode(0); -} - -// -------------------------- -// VID_SetWindowedDisplayMode -// Display the startup 320x200 console screen into a window on the desktop, -// switching to fullscreen display only when we will enter the main game loop. -// - we can display error message boxes for startup errors -// - we can set the last used resolution only once, when entering the main game loop -// -------------------------- -static INT32 WINAPI VID_SetWindowedDisplayMode(viddef_t *lvid, vmode_t *currentmode) -{ - RECT bounds; - int x = 0, y = 0, w = 0, h = 0; - - UNREFERENCED_PARAMETER(currentmode); - - I_OutputMsg("VID_SetWindowedDisplayMode()\n"); - - - lvid->u.numpages = 1; // not used - lvid->direct = NULL; // DOS remains - lvid->buffer = NULL; - - // allocate screens - if (!VID_FreeAndAllocVidbuffer(lvid)) - return -1; - - // lvid->buffer should be NULL here! - - bmiMain = GlobalAlloc(GPTR, sizeof (BITMAPINFO) + (sizeof (RGBQUAD)*256)); - if (!bmiMain) - I_Error("VID_SWDM(): No mem"); - - // setup a BITMAPINFO to allow copying our video buffer to the desktop, - // with color conversion as needed - bmiMain->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); - bmiMain->bmiHeader.biWidth = lvid->width; - bmiMain->bmiHeader.biHeight= -(lvid->height); - bmiMain->bmiHeader.biPlanes = 1; - bmiMain->bmiHeader.biBitCount = 8; - bmiMain->bmiHeader.biCompression = BI_RGB; - - // center window on the desktop - bounds.left = 0; - bounds.right = lvid->width; - bounds.top = 0; - bounds.bottom = lvid->height; - AdjustWindowRectEx(&bounds, GetWindowLong(hWndMain, GWL_STYLE), FALSE, GetWindowLong(hWndMain, GWL_EXSTYLE)); - - w = bounds.right-bounds.left; - h = bounds.bottom-bounds.top; - x = (GetSystemMetrics(SM_CXSCREEN)-w)/2; - y = (GetSystemMetrics(SM_CYSCREEN)-h)/2; - - if (devparm) - MoveWindow(hWndMain, x<<1, y<<1, w, h, TRUE); - else - MoveWindow(hWndMain, x, y, w, h, TRUE); - - SetFocus(hWndMain); - ShowWindow(hWndMain, SW_SHOW); - - hDCMain = GetDC(hWndMain); - if (!hDCMain) - I_Error("VID_SWDM(): GetDC FAILED"); - - return 1; -} - -// ======================================================================== -// Returns a vmode_t from the video modes list, given a video mode number. -// ======================================================================== -vmode_t *VID_GetModePtr(int modenum) -{ - vmode_t *pv; - - pv = pvidmodes; - if (!pv) - I_Error("VID_error: No video mode found\n"); - - while (modenum--) - { - pv = pv->pnext; - if (!pv) - I_Error("VID_error: Mode not available\n"); - } - return pv; -} - -// -// return the name of a video mode -// -const char *VID_GetModeName(INT32 modenum) -{ - return (VID_GetModePtr(modenum))->name; -} - -// ======================================================================== -// Sets a video mode -// ======================================================================== -INT32 VID_SetMode(INT32 modenum) -{ - int vstat; - vmode_t *pnewmode; - - if (dedicated) - return 0; - - I_OutputMsg("VID_SetMode(%d)\n", modenum); - - // if mode 0 (windowed) we must not be fullscreen already, - // if other mode, check it is not mode 0 and existing - if (modenum >= numvidmodes) - { - if (!pcurrentmode) - modenum = 0; // revert to the default base vid mode - else - I_Error("Unknown video mode: %d\n", modenum); - } - else if (bAppFullScreen && modenum < NUMSPECIALMODES) - I_Error("Tried to switch from fullscreen back to windowed mode %d\n", modenum); - - pnewmode = VID_GetModePtr(modenum); - - // dont switch to the same display mode - if (pnewmode == pcurrentmode) - return 1; - - // initialize the new mode - pcurrentmode = pnewmode; - - // initialize vidbuffer size for setmode - vid.width = pcurrentmode->width; - vid.height = pcurrentmode->height; - vid.rowbytes = pcurrentmode->rowbytes; - vid.bpp = pcurrentmode->bytesperpixel; - if (modenum) // if not 320x200 windowed mode, it's actually a hack - { - if (rendermode == render_opengl) - { - // don't accept depth < 16 for OpenGL mode (too much ugly) - if (cv_scr_depth.value < 16) - CV_SetValue(&cv_scr_depth, 16); - vid.bpp = cv_scr_depth.value/8; - vid.u.windowed = (bWinParm || !cv_fullscreen.value); - pcurrentmode->bytesperpixel = vid.bpp; - pcurrentmode->windowed = vid.u.windowed; - } - } - - vstat = (*pcurrentmode->setmode)(&vid, pcurrentmode); - - if (vstat == -1) - I_Error("Not enough mem for VID_SetMode\n"); - else if (vstat == -2) - I_Error("Couldn't set video mode because it failed the test\n"); - else if (vstat == -3) - I_Error("Couldn't set video mode because it failed the change?\n"); - else if (!vstat) - I_Error("Couldn't set video mode %d (%dx%d %d bits)\n", modenum, vid.width, vid.height, (vid.bpp*8));// hardware could not setup mode - else - CONS_Printf(M_GetText("Mode changed to %d (%s)\n"), modenum, pcurrentmode->name); - - vid.modenum = modenum; - - // tell game engine to recalc all tables and realloc buffers based on new values - vid.recalc = 1; - - if (modenum < NUMSPECIALMODES) - { - // we are in startup windowed mode - bAppFullScreen = FALSE; - bDIBMode = TRUE; - } - else - { - // we switch to fullscreen - bAppFullScreen = TRUE; - bDIBMode = FALSE; -#ifdef HWRENDER - if (rendermode != render_soft) - { - // purge all patch graphics stored in software format - //Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100); - HWR_Startup(); - } -#endif - } - - I_RestartSysMouse(); - return 1; -} - -boolean VID_CheckRenderer(void) -{ - return false; -} - -void VID_CheckGLLoaded(rendermode_t oldrender) -{ - (void)oldrender; -} - -// ======================================================================== -// Free the video buffer of the last video mode, -// allocate a new buffer for the video mode to set. -// ======================================================================== -static BOOL VID_FreeAndAllocVidbuffer(viddef_t *lvid) -{ - const DWORD vidbuffersize = (lvid->width * lvid->height * lvid->bpp * NUMSCREENS); - - // free allocated buffer for previous video mode - if (lvid->buffer) - GlobalFree(lvid->buffer); - - // allocate & clear the new screen buffer - lvid->buffer = GlobalAlloc(GPTR, vidbuffersize); - if (!lvid->buffer) - return FALSE; - - ZeroMemory(lvid->buffer, vidbuffersize); - I_OutputMsg("VID_FreeAndAllocVidbuffer done, vidbuffersize: %x\n",(UINT32)vidbuffersize); - - return TRUE; -} - -// ======================================================================== -// Set video mode routine for DirectDraw display modes -// Out: 1 ok, -// 0 hardware could not set mode, -// -1 no mem -// ======================================================================== -static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode) -{ - UNREFERENCED_PARAMETER(currentmode); - - I_OutputMsg("VID_SetDirectDrawMode...\n"); - - - // DD modes do double-buffer page flipping, but the game engine doesn't need this.. - lvid->u.numpages = 2; - - // release ddraw surfaces etc.. - ReleaseChtuff(); - - // clean up any old vid buffer lying around, alloc new if needed - if (!VID_FreeAndAllocVidbuffer(lvid)) - return -1; // no mem - - // should clear video mem here - - // note use lvid->bpp instead of 8...will this be needed? will we support other than 256color - // in software ? - if (!InitDirectDrawe(hWndMain, lvid->width, lvid->height, 8, TRUE)) // TRUE currently always full screen - return 0; // could not set mode - - // this is NOT used with DirectDraw modes, game engine should never use this directly - // but rather render to memory bitmap buffer - lvid->direct = NULL; - - if (!cv_stretch.value && fabsf((float)vid.width/vid.height - ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) > 1.0E-36f) - vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match - - return 1; -} - -// ======================================================================== -// VIDEO MODE CONSOLE COMMANDS -// ======================================================================== - -// vid_nummodes -// -static void VID_Command_NumModes_f(void) -{ - CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes()); -} - -// vid_modeinfo -// -static void VID_Command_ModeInfo_f(void) -{ - vmode_t *pv; - int modenum; - - if (COM_Argc() != 2) - modenum = vid.modenum; // describe the current mode - else - modenum = atoi(COM_Argv(1)); // the given mode number - - if (modenum >= VID_NumModes() - || (!bWinParm && modenum < NUMSPECIALMODES)) // don't accept the windowed modes - { - CONS_Printf(M_GetText("Video mode not present\n")); - return; - } - - pv = VID_GetModePtr(modenum); - - CONS_Printf("\x82" "%s\n", VID_GetModeName(modenum)); - CONS_Printf(M_GetText("width: %d\nheight: %d\n"), - pv->width, pv->height); - if (rendermode == render_soft) - CONS_Printf(M_GetText("bytes per scanline: %d\nbytes per pixel: %d\nnumpages: %d\n"), - pv->rowbytes, pv->bytesperpixel, pv->numpages); -} - -// vid_modelist -// -static void VID_Command_ModeList_f(void) -{ - int i, numodes; - const char *pinfo; - vmode_t *pv; - - numodes = VID_NumModes(); - - // hide windowed modes unless using them - i = (!bWinParm) ? NUMSPECIALMODES : 0; - - for (; i < numodes; i++) - { - pv = VID_GetModePtr(i); - pinfo = VID_GetModeName(i); - - if (pv->bytesperpixel == 1) - CONS_Printf("%d: %s\n", i, pinfo); - else - CONS_Printf("%d: %s (hicolor)\n", i, pinfo); - } -} - -// vid_mode -// -static void VID_Command_Mode_f(void) -{ - int modenum; - - if (COM_Argc() != 2) - { - CONS_Printf(M_GetText("vid_mode : set video mode, current video mode %i\n"), vid.modenum); - return; - } - - modenum = atoi(COM_Argv(1)); - - if (modenum >= VID_NumModes() - || (!bWinParm && modenum < NUMSPECIALMODES)) // don't accept the windowed modes - CONS_Printf(M_GetText("Video mode not present\n")); - else - setmodeneeded = modenum + 1; // request vid mode change -} -#endif diff --git a/tools/PHP/RSS1.0.php b/tools/PHP/RSS1.0.php deleted file mode 100644 index 30eb32585..000000000 --- a/tools/PHP/RSS1.0.php +++ /dev/null @@ -1,55 +0,0 @@ -'; -echo "\n"; -echo ''; -echo "\n"; -echo "\n"; -echo ' '; -echo "\n"; -echo ' SRB2 Master Server RSS Feed'; -echo "\n"; -echo ' http://srb2.servegame.org/'; -echo "\n"; -echo ' Playing around with RSS'; -echo "\n"; -//echo ' en-us'; -//echo "\n"; - $fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5); -// $fd = 0; - if ($fd) - { - $buff = "000012400000"; - fwrite($fd, $buff); - while (1) - { - $content=fgets($fd, 13); // skip 13 first bytes - $content=fgets($fd, 1024); - echo "$content"; - if (feof($fd)) break; - } - fclose($fd); - } - else - { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo "\n"; - echo ' '; - echo 'No master serverThe master server is not running'; - } -?> - \ No newline at end of file diff --git a/tools/PHP/RSS92.php b/tools/PHP/RSS92.php deleted file mode 100644 index 4dd194089..000000000 --- a/tools/PHP/RSS92.php +++ /dev/null @@ -1,37 +0,0 @@ -'; -echo "\n"; -echo ''; -echo "\n"; -echo ' '; -echo "\n"; -echo ' SRB2 Master Server RSS Feed'; -echo "\n"; -echo ' Playing around with RSS'; -echo "\n"; -echo ' http://srb2.servegame.org/'; -echo "\n"; -echo ' en-us'; -echo "\n"; - $fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5); - if ($fd) - { - $buff = "000012380000"; - fwrite($fd, $buff); - while (1) - { - $content=fgets($fd, 13); // skip the next 13 bytes - $content=fgets($fd, 1024); - echo "$content"; - if (feof($fd)) break; - } - fclose($fd); - } - else - { - echo "No master serverThe master server is not running"; - } -?> - - \ No newline at end of file diff --git a/tools/PHP/index.php b/tools/PHP/index.php deleted file mode 100644 index 93bb7c92b..000000000 --- a/tools/PHP/index.php +++ /dev/null @@ -1,90 +0,0 @@ - - - - -SRB2 Master Server Status - - -
- - - - - - - - - -
-
- SRB2 logo. -
- SRB2's HomePage
-
-
-
- Chompy World logo. -
- Chompy World
-
-
-
- SRB2 World logo. -
- SRB2 World
-
-
- -
-
-
- -SRB2 Master Server Status\nCurrent host: $host_addr
"; - $buff = "000043210000"; - fwrite($fd, $buff); - while (1) - { - $content=fgets($fd, 13); // skip 13 first bytes - $content=fgets($fd, 1024); - echo "$content"; - if (feof($fd)) break; - } - fclose($fd); - - } - else - { - echo 'The master server is not running
'; - echo "ERROR: $errno - $errstr
\n"; - } -?> -
-

Info:

-Win32 SRB2MSLauncher Great job, "Gregor Dick"/Oogaland of Gregorsoft Software -
-

-

Version Info:

-srb2dos.exe (DOS/Allegro/WATTCP32 version)
-srb2.exe (Windows/DirectX/FMOD version)
-srb2sdl.exe (Windows/SDL/SDL_mixer version)
-lsdlsrb2 (GNU/Linux/SDL/SDL_mixer version)
-
-Srb2win.exe v1.09.4 (use Internet search menu)
- - - diff --git a/tools/PHP/text.php b/tools/PHP/text.php deleted file mode 100644 index 282b812b7..000000000 --- a/tools/PHP/text.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/tools/SDL-1.2.14-gc/README b/tools/SDL-1.2.14-gc/README deleted file mode 100644 index 8ce488fa9..000000000 --- a/tools/SDL-1.2.14-gc/README +++ /dev/null @@ -1 +0,0 @@ -Once patched, run autogen.sh, configure with "./configure --without-x --disable-video-x11 --disable-video-fbcon --disable-video-aalib --disable-video-directfb --disable-video-opengl --enable-video-gc" and then compile. diff --git a/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch b/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch deleted file mode 100644 index 5b2b2cfa0..000000000 --- a/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch +++ /dev/null @@ -1,641 +0,0 @@ -From 8e6ada7bc33e3cc4e1c17821ea171bf0815a505d Mon Sep 17 00:00:00 2001 -From: Alam Arias -Date: Tue, 1 Dec 2009 19:31:57 -0500 -Subject: [PATCH] SDL GC hack - ---- - configure.in | 17 ++ - include/SDL_config.h.in | 1 + - src/video/fbcon/SDL_fbgc.c | 471 +++++++++++++++++++++++++++++++++++++++++ - src/video/fbcon/SDL_fbgc.h | 35 +++ - src/video/fbcon/SDL_fbvideo.c | 10 + - src/video/fbcon/SDL_fbvideo.h | 11 + - 6 files changed, 545 insertions(+), 0 deletions(-) - create mode 100644 src/video/fbcon/SDL_fbgc.c - create mode 100644 src/video/fbcon/SDL_fbgc.h - -diff --git a/configure.in b/configure.in -index a7e9b18..a8961ba 100644 ---- a/configure.in -+++ b/configure.in -@@ -1227,6 +1227,22 @@ AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[d - fi - } - -+dnl See if we're running on Linux for the Nintendo GameCube/Wii -+dnl FIXME, perform a real test here... -+CheckGC() -+{ -+ AC_ARG_ENABLE(video-gc, -+AC_HELP_STRING([--enable-video-gc], [enable GameCube video support in FB [[default=no]]]), -+ , enable_video_gc=no) -+ if test x$enable_video = xyes -a x$enable_video_gc = xyes -a x$video_fbcon = xyes; then -+ video_gc=yes -+ AC_MSG_RESULT($video_gc) -+ if test x$video_gc = xyes; then -+ AC_DEFINE(SDL_VIDEO_DRIVER_GC) -+ fi -+ fi -+} -+ - dnl Find DirectFB - CheckDirectFB() - { -@@ -2322,6 +2338,7 @@ case "$host" in - CheckX11 - CheckNANOX - CheckFBCON -+ CheckGC - CheckDirectFB - CheckPS2GS - CheckPS3 -diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in -index 58593ca..e523e9b 100644 ---- a/include/SDL_config.h.in -+++ b/include/SDL_config.h.in -@@ -262,6 +262,7 @@ - #undef SDL_VIDEO_DRIVER_DUMMY - #undef SDL_VIDEO_DRIVER_FBCON - #undef SDL_VIDEO_DRIVER_GAPI -+#undef SDL_VIDEO_DRIVER_GC - #undef SDL_VIDEO_DRIVER_GEM - #undef SDL_VIDEO_DRIVER_GGI - #undef SDL_VIDEO_DRIVER_IPOD -diff --git a/src/video/fbcon/SDL_fbgc.c b/src/video/fbcon/SDL_fbgc.c -new file mode 100644 -index 0000000..b3b72bb ---- /dev/null -+++ b/src/video/fbcon/SDL_fbgc.c -@@ -0,0 +1,471 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997-2009 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+#include "SDL_config.h" -+ -+#ifdef SDL_VIDEO_DRIVER_GC -+#include -+#include "SDL_video.h" -+#include "../SDL_blit.h" -+#include "SDL_fbgc.h" -+ -+static Uint32 r_Yr[256]; -+static Uint32 g_Yg_[256]; -+static Uint32 b_Yb[256]; -+static Uint32 r_Ur[256]; -+static Uint32 g_Ug_[256]; -+static Uint32 b_Ub[256]; -+/* static Uint32 r_Vr[256]; // space and cache optimisation */ -+#define r_Vr b_Ub -+static Uint32 g_Vg_[256]; -+static Uint32 b_Vb[256]; -+ -+static Uint8 RGB16toY[1 << 16]; -+static Uint8 RGB16toU[1 << 16]; -+static Uint8 RGB16toV[1 << 16]; -+ -+#ifndef FBIOFLIPHACK -+#define FBIOFLIPHACK 0x4623 /* gc-linux */ -+#endif -+ -+#ifndef GC_BLACK -+#define GC_BLACK 0x00800080 -+#endif -+ -+#ifdef GC_DEBUG -+# define GC_DPRINTF(fmt, args...) \ -+ fprintf(stderr,"DDD|%s: " fmt, __FUNCTION__ , ## args) -+#else -+# define GC_DPRINTF(fmt, args...) -+#endif -+ -+SDL_bool GC_Test(_THIS) -+{ -+ int fliptest; -+ if (ioctl(console_fd, FBIOFLIPHACK, &fliptest)) -+ return SDL_TRUE; -+ return SDL_FALSE; -+} -+ -+SDL_bool GC_Available(void) -+{ -+ if (access("/sys/bus/of_platform/drivers/gcn-vifb", 0) == 0) -+ return SDL_TRUE; -+ -+ return SDL_FALSE; -+} -+ -+/* -+ * -+ * Color space handling. -+ */ -+ -+#define RGB2YUV_SHIFT 16 -+#define RGB2YUV_LUMA 16 -+#define RGB2YUV_CHROMA 128 -+ -+#define Yr ((int)( 0.299*(1< y) ? y : z)) -+ -+static void GC_InitRGB2YUVTables(void) -+{ -+ unsigned int i; -+ unsigned int r, g, b; -+ -+ for (i = 0; i < 256; i++) { -+ r_Yr[i] = Yr * i; -+ g_Yg_[i] = Yg * i + (RGB2YUV_LUMA << RGB2YUV_SHIFT); -+ b_Yb[i] = Yb * i; -+ r_Ur[i] = Ur * i; -+ g_Ug_[i] = Ug * i + (RGB2YUV_CHROMA << RGB2YUV_SHIFT); -+ b_Ub[i] = Ub * i; -+ r_Vr[i] = Vr * i; -+ g_Vg_[i] = Vg * i + (RGB2YUV_CHROMA << RGB2YUV_SHIFT); -+ b_Vb[i] = Vb * i; -+ } -+ -+ for (i = 0; i < 1 << 16; i++) { -+ /* RGB565 */ -+ r = ((i >> 8) & 0xf8); -+ g = ((i >> 3) & 0xfc); -+ b = ((i << 3) & 0xf8); -+ /* extend to 8bit */ -+ r |= (r >> 5); -+ g |= (g >> 6); -+ b |= (b >> 5); -+ -+ RGB16toY[i] = -+ clamp(16, 235, -+ (r_Yr[r] + g_Yg_[g] + b_Yb[b]) >> RGB2YUV_SHIFT); -+ RGB16toU[i] = -+ clamp(16, 240, -+ (r_Ur[r] + g_Ug_[g] + b_Ub[b]) >> RGB2YUV_SHIFT); -+ RGB16toV[i] = -+ clamp(16, 240, -+ (r_Vr[r] + g_Vg_[g] + b_Vb[b]) >> RGB2YUV_SHIFT); -+ } -+} -+ -+static inline Uint32 rgbrgb16toyuy2(Uint16 rgb1, Uint16 rgb2) -+{ -+ register int Y1, Cb, Y2, Cr; -+ Uint16 rgb; -+ -+ /* fast path, thanks to bohdy */ -+ if (!(rgb1 | rgb2)) { -+ return GC_BLACK; /* black, black */ -+ } -+ -+ if (rgb1 == rgb2) { -+ /* fast path, thanks to isobel */ -+ Y1 = Y2 = RGB16toY[rgb1]; -+ Cb = RGB16toU[rgb1]; -+ Cr = RGB16toV[rgb1]; -+ } else { -+ Y1 = RGB16toY[rgb1]; -+ Y2 = RGB16toY[rgb2]; -+ -+ /* RGB565 average */ -+ rgb = ((rgb1 >> 1) & 0xFBEF) + ((rgb2 >> 1) & 0xFBEF) + -+ ((rgb1 & rgb2) & 0x0821); -+ -+ Cb = RGB16toU[rgb]; -+ Cr = RGB16toV[rgb]; -+ } -+ -+ return (((char)Y1) << 24) | (((char)Cb) << 16) | (((char)Y2) << 8) -+ | (((char)Cr) << 0); -+} -+ -+/* -+ * -+ * Blitters. -+ */ -+static void GC_UpdateRectRGB16(_THIS, SDL_Rect * rect, int pitch) -+{ -+ int width, height, left, i, mod, mod32; -+ Uint8 *src, *dst; -+ Uint32 *src32, *dst32; -+ Uint16 *rgb; -+ -+ /* XXX case width < 2 needs special treatment */ -+ -+ /* in pixel units */ -+ left = rect->x & ~1; /* 2 pixel align */ -+ width = (rect->w + 1) & ~1; /* 2 pixel align in excess */ -+ height = rect->h; -+ -+ /* in bytes, src and dest are 16bpp */ -+ src = shadow_mem + (rect->y * pitch) + left * 2; -+ dst = flip_address[back_page] + page_offset + -+ (rect->y * pitch) + left * 2; -+ mod = pitch - width * 2; -+ -+ src32 = (Uint32 *) src; -+ dst32 = (Uint32 *) dst; -+ mod32 = mod / 4; -+ -+ while (height--) { -+ i = width / 2; -+ -+ while (i--) { -+ rgb = (Uint16 *) src32; -+ *dst32++ = rgbrgb16toyuy2(rgb[0], rgb[1]); -+ src32++; -+ } -+ src32 += mod32; -+ dst32 += mod32; -+ } -+} -+ -+void GC_Init(_THIS, SDL_PixelFormat *vformat) -+{ -+ GC_InitRGB2YUVTables(); -+ -+ /* 16 bits per pixel */ -+ vformat->BitsPerPixel = 16; -+ vformat->BytesPerPixel = 2; -+ /* RGB565 */ -+ vformat->Rmask = 0x0000f800; -+ vformat->Gmask = 0x000007e0; -+ vformat->Bmask = 0x0000001f; -+ -+ shadow_fb = 1; -+} -+ -+/* -+ * -+ * Video mode handling. -+ */ -+ -+/* only 640x480 16bpp is currently supported */ -+const static SDL_Rect RECT_640x480 = { 0, 0, 640, 480 }; -+const static SDL_Rect *vid_modes[] = { -+ &RECT_640x480, -+ NULL -+}; -+ -+static SDL_Rect **GC_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) -+{ -+ switch (format->BitsPerPixel) { -+ case 16: -+ return (SDL_Rect **) vid_modes; -+ default: -+ return NULL; -+ } -+} -+ -+SDL_Surface *GC_SetVideoMode(_THIS, SDL_Surface * current, -+ int width, int height, int bpp, Uint32 flags) -+{ -+ struct fb_fix_screeninfo finfo; -+ struct fb_var_screeninfo vinfo; -+ int i; -+ Uint32 Rmask; -+ Uint32 Gmask; -+ Uint32 Bmask; -+ Uint32 *p, *q; -+ Uint32 yres; -+ -+ GC_DPRINTF("Setting %dx%d %dbpp %smode\n", width, height, bpp, -+ (flags & SDL_DOUBLEBUF)?"(doublebuf) ":""); -+ -+ /* Set the terminal into graphics mode */ -+ if (FB_EnterGraphicsMode(this) < 0) { -+ return (NULL); -+ } -+ -+ /* Restore the original palette */ -+ //FB_RestorePalette(this); -+ -+ /* Set the video mode and get the final screen format */ -+ if (ioctl(console_fd, FBIOGET_VSCREENINFO, &vinfo) < 0) { -+ SDL_SetError("Couldn't get console screen info"); -+ return (NULL); -+ } -+ -+ yres = vinfo.yres; -+ -+ /* hack to center 640x480 resolution on PAL cubes */ -+ if (vinfo.xres == 640 && vinfo.yres == 576) { -+ page_offset = ((576 - 480) / 2) * 640 * ((bpp + 7) / 8); -+ } else { -+ page_offset = 0; -+ } -+ -+ /* clear all video memory */ -+ p = (Uint32 *)mapped_mem; -+ q = (Uint32 *)(mapped_mem + mapped_memlen); -+ while (p < q) -+ *p++ = GC_BLACK; -+ -+ if ((vinfo.xres != width) || (vinfo.yres != height) || -+ (vinfo.bits_per_pixel != bpp)) { -+ vinfo.activate = FB_ACTIVATE_NOW; -+ vinfo.accel_flags = 0; -+ vinfo.bits_per_pixel = bpp; -+ vinfo.xres = width; -+ vinfo.xres_virtual = width; -+ /* do not modify yres*, we use a fake 640x480 mode in PAL */ -+ //vinfo.yres = height; -+ //vinfo.yres_virtual = 2*height; -+ vinfo.xoffset = 0; -+ vinfo.yoffset = 0; -+ vinfo.red.length = vinfo.red.offset = 0; -+ vinfo.green.length = vinfo.green.offset = 0; -+ vinfo.blue.length = vinfo.blue.offset = 0; -+ vinfo.transp.length = vinfo.transp.offset = 0; -+ -+ if (ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo) < 0) { -+ SDL_SetError("Couldn't set console screen info"); -+ return (NULL); -+ } -+ } else { -+ int maxheight; -+ -+ /* Figure out how much video memory is available */ -+ maxheight = 2*yres; -+ if (vinfo.yres_virtual > maxheight) { -+ vinfo.yres_virtual = maxheight; -+ } -+ } -+ cache_vinfo = vinfo; -+ -+ Rmask = 0; -+ for (i = 0; i < vinfo.red.length; ++i) { -+ Rmask <<= 1; -+ Rmask |= (0x00000001 << vinfo.red.offset); -+ } -+ Gmask = 0; -+ for (i = 0; i < vinfo.green.length; ++i) { -+ Gmask <<= 1; -+ Gmask |= (0x00000001 << vinfo.green.offset); -+ } -+ Bmask = 0; -+ for (i = 0; i < vinfo.blue.length; ++i) { -+ Bmask <<= 1; -+ Bmask |= (0x00000001 << vinfo.blue.offset); -+ } -+ if (!SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0)) { -+ return (NULL); -+ } -+ -+ /* Get the fixed information about the console hardware. -+ This is necessary since finfo.line_length changes. -+ */ -+ if (ioctl(console_fd, FBIOGET_FSCREENINFO, &finfo) < 0) { -+ SDL_SetError("Couldn't get console hardware info"); -+ return (NULL); -+ } -+ -+ /* Save hardware palette, if needed */ -+ //FB_SavePalette(this, &finfo, &vinfo); -+ -+ /* Set up the new mode framebuffer */ -+ current->flags = SDL_FULLSCREEN; -+ current->w = width; -+ current->h = height; -+ current->pitch = width * ((bpp + 7) / 8); -+ current->pixels = shadow_mem; -+ -+ flip_address[0] = mapped_mem; -+ flip_address[1] = mapped_mem + current->pitch * yres; -+ -+ back_page = 1; -+ if (flags & SDL_DOUBLEBUF) { -+ current->flags |= SDL_DOUBLEBUF; -+ flip_pending = 1; -+ } else { -+ flip_pending = 0; -+ /* make page 0 both the visible and back page */ -+ back_page = ioctl(console_fd, FBIOFLIPHACK, &back_page); -+ if (back_page < 0) -+ back_page = 0; -+ } -+ -+ /* Set the update rectangle function */ -+ switch (bpp) { -+ case 16: -+ GC_DPRINTF("Using 16bpp blitter\n"); -+ this->hidden->UpdateRect = GC_UpdateRectRGB16; -+ break; -+ default: -+ GC_DPRINTF("Using NO blitter\n"); -+ this->hidden->UpdateRect = NULL; -+ break; -+ } -+ -+ /* Handle OpenGL support */ -+#ifdef HAVE_OPENGL -+ if (flags & SDL_OPENGL) { -+ if (GC_GL_CreateWindow(this, width, height) == 0) { -+ current->flags |= (SDL_OPENGL | SDL_FULLSCREEN); -+ } else { -+ current = NULL; -+ } -+ } -+#endif /* HAVE_OPENGL */ -+ -+ /* We're done */ -+ return (current); -+} -+ -+static int GC_FlipHWSurface(_THIS, SDL_Surface * surface) -+{ -+ if (flip_pending) { -+ /* SDL_UpdateRect was not called */ -+ SDL_UpdateRect(this->screen, 0, 0, 0, 0); -+ } -+ -+ /* flip video page as soon as possible */ -+ ioctl(console_fd, FBIOFLIPHACK, NULL); -+ flip_pending = 1; -+ -+ return (0); -+} -+ -+static void GC_WaitForFlipCompletion(_THIS) -+{ -+ int visible_page; -+ int result; -+ -+ if (flip_pending) { -+ flip_pending = 0; -+ back_page ^= 1; -+ visible_page = back_page; -+ while (visible_page == back_page) { -+ /* wait until back_page is not visible */ -+ result = ioctl(console_fd, FBIOFLIPHACK, &back_page); -+ if (result < 0) { -+ if ((errno == EINTR) || (errno == EAGAIN)) -+ continue; -+ return; /* ioctl unsupported ... */ -+ } -+ visible_page = result; -+ } -+ /* -+ * At this point the back_page is not visible. We can safely -+ * write to it without tearing. -+ */ -+ } -+} -+ -+static void GC_UpdateRects(_THIS, int numrects, SDL_Rect * rects) -+{ -+ SDL_Surface *screen; -+ int pitch; -+ -+ /* external yuy2 fb is 16bpp */ -+ -+ screen = this->screen; -+ pitch = screen->pitch; /* this is the pitch of the shadow buffer */ -+ -+ if (this->hidden->UpdateRect) { -+ GC_WaitForFlipCompletion(this); -+ while (numrects--) { -+ if (rects->w <= 0 || rects->h <= 0) -+ continue; -+ this->hidden->UpdateRect(this, rects, pitch); -+ rects++; -+ } -+ } -+} -+ -+void GC_CreateDevice(SDL_VideoDevice *this) -+{ -+ this->ListModes = GC_ListModes; -+ this->SetVideoMode = GC_SetVideoMode; -+ this->FlipHWSurface = GC_FlipHWSurface; -+ this->UpdateRects = GC_UpdateRects; -+} -+ -+#endif -diff --git a/src/video/fbcon/SDL_fbgc.h b/src/video/fbcon/SDL_fbgc.h -new file mode 100644 -index 0000000..534a73e ---- /dev/null -+++ b/src/video/fbcon/SDL_fbgc.h -@@ -0,0 +1,35 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997-2009 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+#include "SDL_config.h" -+ -+ -+#ifdef SDL_VIDEO_DRIVER_GC -+/* Gamecube/Wii hardware setup for the SDL framebuffer console driver */ -+ -+#include "SDL_fbvideo.h" -+ -+extern SDL_bool GC_Available(void); -+extern void GC_CreateDevice(SDL_VideoDevice *this); -+ -+extern SDL_bool GC_Test(_THIS); -+extern void GC_Init(_THIS, SDL_PixelFormat *vformat); -+#endif -diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c -index 81a89da..328790e 100644 ---- a/src/video/fbcon/SDL_fbvideo.c -+++ b/src/video/fbcon/SDL_fbvideo.c -@@ -272,6 +272,11 @@ static SDL_VideoDevice *FB_CreateDevice(int devindex) - - this->free = FB_DeleteDevice; - -+#ifdef SDL_VIDEO_DRIVER_GC -+ if (GC_Available(this)) -+ GC_CreateDevice(this); -+#endif -+ - return this; - } - -@@ -784,6 +789,11 @@ static int FB_VideoInit(_THIS, SDL_PixelFormat *vformat) - } - } - -+#ifdef SDL_VIDEO_DRIVER_GC -+ if (GC_Test(this)) -+ GC_Init(this, vformat); -+#endif -+ - if (shadow_fb) { - shadow_mem = (char *)SDL_malloc(mapped_memlen); - if (shadow_mem == NULL) { -diff --git a/src/video/fbcon/SDL_fbvideo.h b/src/video/fbcon/SDL_fbvideo.h -index 03b9e94..74d1460 100644 ---- a/src/video/fbcon/SDL_fbvideo.h -+++ b/src/video/fbcon/SDL_fbvideo.h -@@ -106,6 +106,12 @@ struct SDL_PrivateVideoData { - - void (*wait_vbl)(_THIS); - void (*wait_idle)(_THIS); -+#ifdef SDL_VIDEO_DRIVER_GC -+ void (*UpdateRect) (_THIS, SDL_Rect * rect, int pitch); -+ int back_page; -+ int page_offset; -+ int flip_pending; -+#endif - }; - /* Old variable names */ - #define console_fd (this->hidden->console_fd) -@@ -147,6 +153,11 @@ struct SDL_PrivateVideoData { - #define screen_palette (this->hidden->screen_palette) - #define wait_vbl (this->hidden->wait_vbl) - #define wait_idle (this->hidden->wait_idle) -+#ifdef SDL_VIDEO_DRIVER_GC -+#define back_page (this->hidden->back_page) -+#define page_offset (this->hidden->page_offset) -+#define flip_pending (this->hidden->flip_pending) -+#endif - - /* Accelerator types that are supported by the driver, but are not - necessarily in the kernel headers on the system we compile on. --- -1.6.5 - diff --git a/tools/SDL1.2.7_CE/SDL-1.27_CE.diff b/tools/SDL1.2.7_CE/SDL-1.27_CE.diff deleted file mode 100644 index 196329b84..000000000 --- a/tools/SDL1.2.7_CE/SDL-1.27_CE.diff +++ /dev/null @@ -1,2260 +0,0 @@ -diff -ruN SDL-1.2.7-orig/src/audio/windib/SDL_dibaudio.c SDL-1.2.7/src/audio/windib/SDL_dibaudio.c ---- SDL-1.2.7-orig/src/audio/windib/SDL_dibaudio.c Wed Feb 18 09:22:00 2004 -+++ SDL-1.2.7/src/audio/windib/SDL_dibaudio.c Thu Nov 18 12:07:29 2004 -@@ -146,8 +146,16 @@ - - /* Set high priority for the audio thread */ - static void DIB_ThreadInit(_THIS) --{ -- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); -+{ -+#ifdef _WIN32_WCE -+#ifdef SH3 -+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); -+#else -+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); -+#endif -+#else -+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); -+#endif - } - - void DIB_WaitAudio(_THIS) -diff -ruN SDL-1.2.7-orig/src/cpuinfo/SDL_cpuinfo.c SDL-1.2.7/src/cpuinfo/SDL_cpuinfo.c ---- SDL-1.2.7-orig/src/cpuinfo/SDL_cpuinfo.c Tue Feb 10 07:31:36 2004 -+++ SDL-1.2.7/src/cpuinfo/SDL_cpuinfo.c Fri Nov 19 20:53:01 2004 -@@ -38,6 +38,10 @@ - - #ifdef MACOSX - #include /* For AltiVec check */ -+#endif -+ -+#if defined(_MSC_VER) && (defined(ARM) || defined(MIPS) || defined(SHx)) -+#undef _MSC_VER - #endif - - #define CPU_HAS_RDTSC 0x00000001 -diff -ruN SDL-1.2.7-orig/src/joystick/win32/SDL_mmjoystick.c SDL-1.2.7/src/joystick/win32/SDL_mmjoystick.c ---- SDL-1.2.7-orig/src/joystick/win32/SDL_mmjoystick.c Wed Feb 18 09:22:02 2004 -+++ SDL-1.2.7/src/joystick/win32/SDL_mmjoystick.c Fri Nov 19 20:47:22 2004 -@@ -37,6 +37,7 @@ - - #include - #include -+#include - - #define MAX_JOYSTICKS 16 - #define MAX_AXES 6 /* each joystick can have up to 6 axes */ -@@ -51,6 +52,7 @@ - /* array to hold joystick ID values */ - static UINT SYS_JoystickID[MAX_JOYSTICKS]; - static JOYCAPS SYS_Joystick[MAX_JOYSTICKS]; -+static char *SYS_JoystickName[MAX_JOYSTICKS]; - - /* The private structure used to keep track of a joystick */ - struct joystick_hwdata -@@ -69,6 +71,78 @@ - /* Convert a win32 Multimedia API return code to a text message */ - static void SetMMerror(char *function, int code); - -+static char *GetJoystickName(int index, const char *szRegKey) -+{ -+ /* added 7/24/2004 by Eckhard Stolberg */ -+ /* -+ see if there is a joystick for the current -+ index (1-16) listed in the registry -+ */ -+ char *name = NULL; -+ HKEY hKey; -+ DWORD regsize; -+ LONG regresult; -+ unsigned char regkey[256]; -+ unsigned char regvalue[256]; -+ unsigned char regname[256]; -+ -+ sprintf(regkey, "%s\\%s\\%s", -+ REGSTR_PATH_JOYCONFIG, -+ szRegKey, -+ REGSTR_KEY_JOYCURR); -+ regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE, -+ (LPTSTR) ®key, 0, KEY_READ, &hKey); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* -+ find the registry key name for the -+ joystick's properties -+ */ -+ regsize = sizeof(regname); -+ sprintf(regvalue, -+ "Joystick%d%s", index+1, -+ REGSTR_VAL_JOYOEMNAME); -+ regresult = RegQueryValueExA(hKey, -+ regvalue, 0, 0, (LPBYTE) ®name, -+ (LPDWORD) ®size); -+ RegCloseKey(hKey); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* open that registry key */ -+ sprintf(regkey, "%s\\%s", -+ REGSTR_PATH_JOYOEM, regname); -+ regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE, -+ regkey, 0, KEY_READ, &hKey); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* find the size for the OEM name text */ -+ regsize = sizeof(regvalue); -+ regresult = -+ RegQueryValueExA(hKey, -+ REGSTR_VAL_JOYOEMNAME, -+ 0, 0, NULL, -+ (LPDWORD) ®size); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* -+ allocate enough memory -+ for the OEM name text ... -+ */ -+ name = (char *) malloc(regsize); -+ /* ... and read it from the registry */ -+ regresult = -+ RegQueryValueExA(hKey, -+ REGSTR_VAL_JOYOEMNAME, 0, 0, -+ (LPBYTE) name, -+ (LPDWORD) ®size); -+ RegCloseKey(hKey); -+ } -+ } -+ } -+ } -+ return(name); -+} -+ - - /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available -@@ -94,6 +168,7 @@ - - for ( i = 0; i < MAX_JOYSTICKS; i++ ) { - SYS_JoystickID[i] = JOYSTICKID1 + i; -+ SYS_JoystickName[i] = NULL; - } - - -@@ -110,6 +185,7 @@ - if ( result == JOYERR_NOERROR ) { - SYS_JoystickID[numdevs] = SYS_JoystickID[i]; - SYS_Joystick[numdevs] = joycaps; -+ SYS_JoystickName[numdevs] = GetJoystickName(numdevs, joycaps.szRegKey); - numdevs++; - } - } -@@ -120,8 +196,11 @@ - /* Function to get the device-dependent name of a joystick */ - const char *SDL_SYS_JoystickName(int index) - { -- /***-> test for invalid index ? */ -+ if ( SYS_JoystickName[index] != NULL ) { -+ return(SYS_JoystickName[index]); -+ } else { - return(SYS_Joystick[index].szPname); -+ } - } - - /* Function to open a joystick for use. -@@ -292,7 +371,12 @@ - /* Function to perform any system-specific joystick related cleanup */ - void SDL_SYS_JoystickQuit(void) - { -- return; -+ int i; -+ for (i = 0; i < MAX_JOYSTICKS; i++) { -+ if ( SYS_JoystickName[i] != NULL ) { -+ free(SYS_JoystickName[i]); -+ } -+ } - } - - -diff -ruN SDL-1.2.7-orig/src/video/SDL_sysvideo.h SDL-1.2.7/src/video/SDL_sysvideo.h ---- SDL-1.2.7-orig/src/video/SDL_sysvideo.h Wed Feb 18 09:22:04 2004 -+++ SDL-1.2.7/src/video/SDL_sysvideo.h Thu Nov 18 12:08:48 2004 -@@ -361,6 +361,9 @@ - #endif - #ifdef ENABLE_WINDIB - extern VideoBootStrap WINDIB_bootstrap; -+#endif -+#ifdef ENABLE_WINGAPI -+extern VideoBootStrap WINGAPI_bootstrap; - #endif - #ifdef ENABLE_DIRECTX - extern VideoBootStrap DIRECTX_bootstrap; -diff -ruN SDL-1.2.7-orig/src/video/SDL_video.c SDL-1.2.7/src/video/SDL_video.c ---- SDL-1.2.7-orig/src/video/SDL_video.c Wed Feb 18 09:22:04 2004 -+++ SDL-1.2.7/src/video/SDL_video.c Thu Nov 18 12:11:01 2004 -@@ -80,6 +80,9 @@ - #endif - #ifdef ENABLE_DIRECTX - &DIRECTX_bootstrap, -+#endif -+#ifdef ENABLE_WINGAPI -+ &WINGAPI_bootstrap, - #endif - #ifdef ENABLE_WINDIB - &WINDIB_bootstrap, -diff -ruN SDL-1.2.7-orig/src/video/wincommon/SDL_sysevents.c SDL-1.2.7/src/video/wincommon/SDL_sysevents.c ---- SDL-1.2.7-orig/src/video/wincommon/SDL_sysevents.c Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/wincommon/SDL_sysevents.c Thu Nov 18 12:28:03 2004 -@@ -40,6 +40,9 @@ - #include "SDL_lowvideo.h" - #include "SDL_syswm_c.h" - #include "SDL_main.h" -+#ifdef _WIN32_CE -+#include "SDL_dibvideo.h" -+#endif - - #ifdef WMMSG_DEBUG - #include "wmmsg.h" -@@ -173,6 +176,39 @@ - SDL_SetModState(state); - #endif /* !NO_GETKEYBOARDSTATE */ - } -+ -+#ifdef _WIN32_CE -+void transform(SDL_RotateAttr rotate, char ozone, Sint16 *x, Sint16 *y) { -+ Sint16 rotatedX; -+ Sint16 rotatedY; -+ -+ if (ozone) { -+ *x = *x * 2; -+ *y = *y * 2; -+ } -+ -+ switch(rotate) { -+ case SDL_ROTATE_NONE: -+ break; -+ case SDL_ROTATE_LEFT: -+ if (!SDL_VideoSurface) -+ break; -+ rotatedX = SDL_VideoSurface->w - *y; -+ rotatedY = *x; -+ *x = rotatedX; -+ *y = rotatedY; -+ break; -+ case SDL_ROTATE_RIGHT: -+ if (!SDL_VideoSurface) -+ break; -+ rotatedX = *y; -+ rotatedY = SDL_VideoSurface->h - *x; -+ *x = rotatedX; -+ *y = rotatedY; -+ break; -+ } -+} -+#endif - - /* The main Win32 event handler - DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it -@@ -273,7 +309,11 @@ - SetCursorPos(center.x, center.y); - posted = SDL_PrivateMouseMotion(0, 1, x, y); - } -- } else { -+ } else { -+#ifdef _WIN32_CE -+ if (SDL_VideoSurface) -+ transform(rotation, ozoneHack, &x, &y); -+#endif - posted = SDL_PrivateMouseMotion(0, 0, x, y); - } - } -@@ -361,8 +401,16 @@ - x = 0; y = 0; - } else { - x = (Sint16)LOWORD(lParam); -- y = (Sint16)HIWORD(lParam); -- } -+ y = (Sint16)HIWORD(lParam); -+#ifdef _WIN32_CE -+ if (SDL_VideoSurface) -+ transform(rotation, ozoneHack, &x, &y); -+#endif -+ } -+#ifdef _WIN32_WCE -+ /* Since stylus movements are not continuous */ -+ posted = SDL_PrivateMouseMotion(0, 0, x, y); -+#endif - posted = SDL_PrivateMouseButton( - state, button, x, y); - } -diff -ruN SDL-1.2.7-orig/src/video/wincommon/SDL_sysmouse.c SDL-1.2.7/src/video/wincommon/SDL_sysmouse.c ---- SDL-1.2.7-orig/src/video/wincommon/SDL_sysmouse.c Sat Aug 30 13:13:12 2003 -+++ SDL-1.2.7/src/video/wincommon/SDL_sysmouse.c Thu Nov 18 12:29:20 2004 -@@ -250,12 +250,16 @@ - - /* Check to see if we need to enter or leave mouse relative mode */ - void WIN_CheckMouseMode(_THIS) --{ -+{ -+#ifdef _WIN32_WCE -+ mouse_relative = 0; -+#else - /* If the mouse is hidden and input is grabbed, we use relative mode */ - if ( !(SDL_cursorstate & CURSOR_VISIBLE) && - (this->input_grab != SDL_GRAB_OFF) ) { - mouse_relative = 1; - } else { - mouse_relative = 0; -- } -+ } -+#endif - } -diff -ruN SDL-1.2.7-orig/src/video/windib/SDL_dibevents.c SDL-1.2.7/src/video/windib/SDL_dibevents.c ---- SDL-1.2.7-orig/src/video/windib/SDL_dibevents.c Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/windib/SDL_dibevents.c Thu Nov 18 13:12:28 2004 -@@ -58,6 +58,29 @@ - /* DJM: If the user setup the window for us, we want to save his window proc, - and give him a chance to handle some messages. */ - static WNDPROC userWindowProc = NULL; -+ -+#ifdef _WIN32_WCE -+ -+WPARAM rotateKey(WPARAM key, SDL_RotateAttr direction) { -+ if (direction != SDL_ROTATE_LEFT) -+ return key; -+ -+ switch (key) { -+ case 0x26: /* up */ -+ return 0x27; -+ case 0x27: /* right */ -+ return 0x28; -+ case 0x28: /* down */ -+ return 0x25; -+ case 0x25: /* left */ -+ return 0x26; -+ } -+ -+ return key; -+} -+ -+#endif -+ - - /* The main Win32 event handler */ - LONG -@@ -69,6 +92,16 @@ - case WM_SYSKEYDOWN: - case WM_KEYDOWN: { - SDL_keysym keysym; -+ -+#ifdef _WIN32_WCE -+ // Drop GAPI artefacts -+ if (wParam == 0x84 || wParam == 0x5B) -+ return 0; -+ -+ // Rotate key if necessary -+ if (rotation != SDL_ROTATE_NONE) -+ wParam = rotateKey(wParam, rotation); -+#endif - - /* Ignore repeated keys */ - if ( lParam&REPEATED_KEYMASK ) { -@@ -129,6 +162,16 @@ - case WM_KEYUP: { - SDL_keysym keysym; - -+#ifdef _WIN32_WCE -+ // Drop GAPI artefacts -+ if (wParam == 0x84 || wParam == 0x5B) -+ return 0; -+ -+ // Rotate key if necessary -+ if (rotation != SDL_ROTATE_NONE) -+ wParam = rotateKey(wParam, rotation); -+#endif -+ - switch (wParam) { - case VK_CONTROL: - if ( lParam&EXTENDED_KEYMASK ) -@@ -333,7 +376,16 @@ - VK_keymap[VK_APPS] = SDLK_MENU; - - prev_shiftstates[0] = FALSE; -- prev_shiftstates[1] = FALSE; -+ prev_shiftstates[1] = FALSE; -+ -+#ifdef _WIN32_WCE -+ /* Hardcode the 4 magic keys to F1 F2 F3 F4 - the actual location of the keys varies ... */ -+ VK_keymap[0xC1] = SDLK_F1; -+ VK_keymap[0xC2] = SDLK_F2; -+ VK_keymap[0xC3] = SDLK_F3; -+ VK_keymap[0xC4] = SDLK_F4; -+#endif -+ - } - - static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed) -@@ -364,9 +416,15 @@ - { - #ifndef CS_BYTEALIGNCLIENT - #define CS_BYTEALIGNCLIENT 0 -+#endif -+#ifdef _WIN32_CE -+ SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW, 0); -+#else -+ SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); - #endif -- SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); -- if ( SDL_windowid ) { -+ if ( SDL_windowid ) { -+// FIXME -+#ifndef _WIN32_WCE - SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); - - /* DJM: we want all event's for the user specified -@@ -375,11 +433,19 @@ - if (SDL_Window) { - userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); -- } -- } else { -+ } -+ #endif -+ } else { -+#ifdef _WIN32_WCE -+ -+ SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), -+ 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), -+ NULL, NULL, SDL_Instance, NULL); -+#else - SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, - (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), -- CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); -+ CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); -+#endif - if ( SDL_Window == NULL ) { - SDL_SetError("Couldn't create window"); - return(-1); -diff -ruN SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.c SDL-1.2.7/src/video/windib/SDL_dibvideo.c ---- SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.c Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/windib/SDL_dibvideo.c Mon Aug 8 18:27:52 2005 -@@ -29,15 +29,26 @@ - #include - #include - #include --#if defined(WIN32_PLATFORM_PSPC) -+#if (defined (UNDER_CE) && (UNDER_CE >= 420)) - #include // Add Pocket PC includes - #pragma comment( lib, "aygshell" ) // Link Pocket PC library - #endif -+ -+#ifdef _MSC_VER -+#pragma warning(disable: 4244) -+#define inline __inline -+#endif -+ - - /* Not yet in the mingw32 cross-compile headers */ - #ifndef CDS_FULLSCREEN - #define CDS_FULLSCREEN 4 - #endif -+ -+#ifndef WS_THICKFRAME -+#define WS_THICKFRAME 0 -+#endif -+ - - #include "SDL.h" - #include "SDL_mutex.h" -@@ -55,7 +66,18 @@ - #ifdef _WIN32_WCE - #define NO_GETDIBITS - #define NO_CHANGEDISPLAYSETTINGS --#define NO_GAMMA_SUPPORT -+#define NO_GAMMA_SUPPORT -+ -+/* uncomment this line if you target WinCE 3.x platform: */ -+//#define NO_SETDIBCOLORTABLE -+ -+/* these 2 variables are used to suport paletted DIBs on WinCE 3.x that -+ does not implement SetDIBColorTable, and when SetDIBColorTable is not working. -+ Slow. DIB is recreated every time. -+*/ -+static BITMAPINFO *last_bitmapinfo; -+static void** last_bits; -+ - #endif - #ifndef WS_MAXIMIZE - #define WS_MAXIMIZE 0 -@@ -96,6 +118,13 @@ - - /* helper fn */ - static int DIB_SussScreenDepth(); -+ -+#ifdef _WIN32_WCE -+void DIB_ShowTaskBar(BOOL taskBarShown); -+#ifdef ENABLE_WINGAPI -+extern void GAPI_GrabHardwareKeys(BOOL grab); -+#endif -+#endif - - /* DIB driver bootstrap functions */ - -@@ -352,6 +381,9 @@ - - /* Fill in some window manager capabilities */ - this->info.wm_available = 1; -+ -+ /* Rotation information */ -+ rotation = SDL_ROTATE_NONE; - - /* We're done! */ - return(0); -@@ -370,7 +402,43 @@ - } - #endif - } -- -+ -+#ifdef _WIN32_WCE -+ -+void DIB_ShowTaskBar(BOOL taskBarShown) { -+#if (UNDER_CE < 420) -+ // Hide taskbar, WinCE 2.x style - from EasyCE -+ HKEY hKey=0; -+ DWORD dwValue = 0; -+ unsigned long lSize = sizeof( DWORD ); -+ DWORD dwType = REG_DWORD; -+ HWND hWnd; -+ -+ RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT("\\software\\microsoft\\shell"), 0, KEY_ALL_ACCESS, &hKey ); -+ RegQueryValueEx( hKey, TEXT("TBOpt"), 0, &dwType, (BYTE*)&dwValue, &lSize ); -+ if (taskBarShown) -+ dwValue &= 0xFFFFFFFF - 8; // reset bit to show taskbar -+ else -+ dwValue |= 8; // set bit to hide taskbar -+ RegSetValueEx( hKey, TEXT("TBOpt"), 0, REG_DWORD, (BYTE*)&dwValue, lSize ); -+ hWnd = FindWindow( TEXT("HHTaskBar"), NULL ); -+ SendMessage(hWnd, WM_COMMAND, 0x03EA, 0 ); -+ SetForegroundWindow(SDL_Window); -+#else -+ if (taskBarShown) -+ SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); -+ else -+ SHFullScreen(SDL_Window, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON); -+#endif -+ if (FindWindow(TEXT("HHTaskBar"), NULL)) { // is it valid for HPC ? -+ if (taskBarShown) -+ ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ else -+ ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); -+ } -+} -+ -+#endif - - /* - Helper fn to work out which screen depth windows is currently using. -@@ -444,7 +512,8 @@ - - - /* Various screen update functions available */ --static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects); -+static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects); -+static void DIB_RotatedUpdate(_THIS, int numrects, SDL_Rect *rects); - - SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, - int width, int height, int bpp, Uint32 flags) -@@ -463,12 +532,20 @@ - HDC hdc; - RECT bounds; - int x, y; -- Uint32 Rmask, Gmask, Bmask; -- -+ Uint32 Rmask, Gmask, Bmask; -+#ifdef _WIN32_CE -+ int screenWidth, screenHeight; -+#endif -+#ifdef UNDER_CE -+ int i; -+#endif -+ -+#ifdef HAVE_OPENGL - /* Clean up any GL context that may be hanging around */ - if ( current->flags & SDL_OPENGL ) { - WIN_GL_ShutDown(this); -- } -+ } -+#endif - - /* Recalculate the bitmasks if necessary */ - if ( bpp == current->format->BitsPerPixel ) { -@@ -517,20 +594,16 @@ - video->h = height; - video->pitch = SDL_CalculatePitch(video); - --#ifdef WIN32_PLATFORM_PSPC -+#ifdef _WIN32_CE - /* Stuff to hide that $#!^%#$ WinCE taskbar in fullscreen... */ - if ( flags & SDL_FULLSCREEN ) { - if ( !(prev_flags & SDL_FULLSCREEN) ) { -- SHFullScreen(SDL_Window, SHFS_HIDETASKBAR); -- SHFullScreen(SDL_Window, SHFS_HIDESIPBUTTON); -- ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); -+ DIB_ShowTaskBar(FALSE); - } - video->flags |= SDL_FULLSCREEN; - } else { - if ( prev_flags & SDL_FULLSCREEN ) { -- SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR); -- SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON); -- ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ DIB_ShowTaskBar(TRUE); - } - } - #endif -@@ -640,28 +713,82 @@ - ((Uint32*)binfo->bmiColors)[0] = video->format->Rmask; - ((Uint32*)binfo->bmiColors)[1] = video->format->Gmask; - ((Uint32*)binfo->bmiColors)[2] = video->format->Bmask; -- } else { -+ } else { -+#ifdef UNDER_CE -+ binfo->bmiHeader.biCompression = BI_RGB; /* 332 */ -+ if ( video->format->palette ) { -+ binfo->bmiHeader.biClrUsed = video->format->palette->ncolors; -+ for(i=0; iformat->palette->ncolors; i++) -+ { -+ binfo->bmiColors[i].rgbRed=i&(7<<5); -+ binfo->bmiColors[i].rgbGreen=(i&(7<<2))<<3; -+ binfo->bmiColors[i].rgbBlue=(i&3)<<5; -+ binfo->bmiColors[i].rgbReserved=0; -+ } -+ } -+#else - binfo->bmiHeader.biCompression = BI_RGB; /* BI_BITFIELDS for 565 vs 555 */ - if ( video->format->palette ) { - memset(binfo->bmiColors, 0, - video->format->palette->ncolors*sizeof(RGBQUAD)); -- } -+ } -+#endif - } - - /* Create the offscreen bitmap buffer */ -- hdc = GetDC(SDL_Window); -+ hdc = GetDC(SDL_Window); -+#ifdef _WIN32_CE -+ /* See if we need to rotate the buffer (WinCE specific) */ -+ screenWidth = GetDeviceCaps(hdc, HORZRES); -+ screenHeight = GetDeviceCaps(hdc, VERTRES); -+ rotation = SDL_ROTATE_NONE; -+ work_pixels = NULL; -+ if (rotation_pixels) { -+ free(rotation_pixels); -+ rotation_pixels = NULL; -+ } -+ -+ if ((flags & SDL_FULLSCREEN) && (width>height) && (width > screenWidth) ) { -+ /* OK, we rotate the screen */ -+ video->pixels = malloc(video->h * video->pitch); -+ rotation_pixels = video->pixels; -+ if (video->pixels) -+ rotation = SDL_ROTATE_LEFT; -+ OutputDebugString(TEXT("will rotate\r\n")); -+ } -+ screen_bmp = CreateDIBSection(hdc, binfo, DIB_RGB_COLORS, -+ (rotation == SDL_ROTATE_NONE ? (void **)(&video->pixels) : (void**)&work_pixels), NULL, 0); -+#else - screen_bmp = CreateDIBSection(hdc, binfo, DIB_RGB_COLORS, -- (void **)(&video->pixels), NULL, 0); -- ReleaseDC(SDL_Window, hdc); -- free(binfo); -+ (void **)(&video->pixels), NULL, 0); -+#endif -+ ReleaseDC(SDL_Window, hdc); -+#ifdef UNDER_CE -+/* keep bitmapinfo for palette in 8-bit modes for devices that don't have SetDIBColorTable */ -+ last_bits = (rotation == SDL_ROTATE_NONE ? (void **)(&video->pixels) : (void**)&work_pixels); -+ if(last_bitmapinfo) -+ free(last_bitmapinfo); -+ if(is16bitmode) -+ { -+ last_bitmapinfo = 0; -+ free(binfo); -+ } else -+ last_bitmapinfo = binfo; -+#else -+ free(binfo); -+#endif - if ( screen_bmp == NULL ) { - if ( video != current ) { - SDL_FreeSurface(video); - } - SDL_SetError("Couldn't create DIB section"); - return(NULL); -- } -- this->UpdateRects = DIB_NormalUpdate; -+ } -+#ifdef _WIN32_CE -+ this->UpdateRects = (work_pixels ? DIB_RotatedUpdate : DIB_NormalUpdate); -+#else -+ this->UpdateRects = DIB_NormalUpdate; -+#endif - - /* Set video surface flags */ - if ( bpp <= 8 ) { -@@ -695,7 +822,15 @@ - bounds.left = SDL_windowX; - bounds.top = SDL_windowY; - bounds.right = SDL_windowX+video->w; -- bounds.bottom = SDL_windowY+video->h; -+ bounds.bottom = SDL_windowY+video->h; -+#ifdef UNDER_CE -+ if(rotation != SDL_ROTATE_NONE) -+ { -+ int t=bounds.right; -+ bounds.right = bounds.bottom; -+ bounds.bottom=t; -+ } -+#endif - AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); - width = bounds.right-bounds.left; - height = bounds.bottom-bounds.top; -@@ -709,8 +844,10 @@ - x = (GetSystemMetrics(SM_CXSCREEN)-width)/2; - y = (GetSystemMetrics(SM_CYSCREEN)-height)/2; - } else { -- x = y = -1; -- swp_flags |= SWP_NOMOVE; -+ x = y = -1; -+#ifndef UNDER_CE -+ swp_flags |= SWP_NOMOVE; -+#endif - } - if ( y < 0 ) { /* Cover up title bar for more client area */ - y -= GetSystemMetrics(SM_CYCAPTION)/2; -@@ -719,19 +856,44 @@ - top = HWND_TOPMOST; - } else { - top = HWND_NOTOPMOST; -- } -- SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+ } -+#ifdef _WIN32_CE -+ if (flags & SDL_FULLSCREEN) { -+/* When WinCE program switches resolution from larger to smaller we should move its window so it would be visible in fullscreen */ -+// SetWindowPos(SDL_Window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -+ DIB_ShowTaskBar(FALSE); -+ if(x>0) x=0; // remove space from the left side of a screen in 320x200 mode -+ if(y>0) y=0; -+ SetWindowPos(SDL_Window, HWND_TOPMOST, x, y, width, height, SWP_NOCOPYBITS); -+ ShowWindow(SDL_Window, SW_SHOW); -+ } -+ else -+ SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+#else -+ SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+#endif - SDL_resizing = 0; - SetForegroundWindow(SDL_Window); - } - - /* Set up for OpenGL */ -- if ( flags & SDL_OPENGL ) { -+ if ( flags & SDL_OPENGL ) { -+#ifdef HAVE_OPENGL - if ( WIN_GL_SetupWindow(this) < 0 ) { - return(NULL); - } -- video->flags |= SDL_OPENGL; -- } -+ video->flags |= SDL_OPENGL; -+#else -+ return NULL; -+#endif -+ } -+ -+#ifdef ENABLE_WINGAPI -+ /* Grab hardware keys if necessary */ -+ if ( flags & SDL_FULLSCREEN ) { -+ GAPI_GrabHardwareKeys(TRUE); -+ } -+#endif - - /* We're live! */ - return(video); -@@ -754,22 +916,169 @@ - { - return; - } -+ -+#ifdef _WIN32_CE -+ -+static inline void rotateBlit(unsigned short *src, unsigned short *dest, SDL_Rect *rect, int pitch) { -+ int i=rect->w, j=rect->h; -+ src+=i; -+ -+ for (;i--;) { -+ register unsigned short *S=src--; -+// I use loop unrolling to spedup things a little -+ int cnt = j; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ for (; cnt--; ) { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ } -+/* tiny optimization -+ int i, j; -+ src+=rect->w; -+ -+ for (i=0; iw; i++) { -+ register unsigned short *S=src--; -+ for (j=0; jh; j++) { -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ } -+*/ -+/* original unoptimized version -+ int i, j; -+ -+ for (i=0; iw; i++) { -+ for (j=0; jh; j++) { -+ dest[i * rect->h + j] = src[pitch * j + (rect->w - i)]; -+ } -+ } -+*/ -+} -+ -+static inline void rotateBlit8(unsigned char *src, unsigned char *dest, SDL_Rect *rect, int pitch) { -+ int i=rect->w, j=rect->h; -+ src+=i; -+ -+ for (;i--;) { -+ register unsigned char *S=src--; -+// I use loop unrolling to spedup things a little -+ int cnt = j; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ for (; cnt--; ) { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ } -+} -+ -+static void DIB_RotatedUpdate(_THIS, int numrects, SDL_Rect *rects) -+{ -+ HDC hdc, mdc; -+ HBITMAP hb, old; -+ int i; -+ -+ hdc = GetDC(SDL_Window); -+ if ( screen_pal ) { -+ SelectPalette(hdc, screen_pal, FALSE); -+ } -+ mdc = CreateCompatibleDC(hdc); -+ /*SelectObject(mdc, screen_bmp);*/ -+ if(this->screen->format->BytesPerPixel == 2) { -+ for ( i=0; iscreen->pixels; -+ rotateBlit(src + (this->screen->w * rects[i].y) + rects[i].x, work_pixels, &rects[i], this->screen->w); -+ hb = CreateBitmap(rects[i].h, rects[i].w, 1, 16, work_pixels); -+ old = (HBITMAP)SelectObject(mdc, hb); -+ BitBlt(hdc, rects[i].y, this->screen->w - (rects[i].x + rects[i].w), rects[i].h, rects[i].w, -+ mdc, 0, 0, SRCCOPY); -+ SelectObject(mdc, old); -+ DeleteObject(hb); -+ } -+ } else { -+ if ( screen_pal ) { -+ SelectPalette(mdc, screen_pal, FALSE); -+ } -+ for ( i=0; iscreen->pixels; -+ rotateBlit8(src + (this->screen->w * rects[i].y) + rects[i].x, work_pixels, &rects[i], this->screen->w); -+ hb = CreateBitmap(rects[i].h, rects[i].w, 1, 8, work_pixels); -+ old = (HBITMAP)SelectObject(mdc, hb); -+ BitBlt(hdc, rects[i].y, this->screen->w - (rects[i].x + rects[i].w), rects[i].h, rects[i].w, -+ mdc, 0, 0, SRCCOPY); -+ SelectObject(mdc, old); -+ DeleteObject(hb); -+ } -+ } -+ DeleteDC(mdc); -+ ReleaseDC(SDL_Window, hdc); -+} -+#endif -+ - - static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) - { - HDC hdc, mdc; -- int i; -+ int i; -+#ifdef _WIN32_CE -+ HBITMAP old; -+#endif - - hdc = GetDC(SDL_Window); - if ( screen_pal ) { - SelectPalette(hdc, screen_pal, FALSE); - } -- mdc = CreateCompatibleDC(hdc); -- SelectObject(mdc, screen_bmp); -+ mdc = CreateCompatibleDC(hdc); -+#ifdef _WIN32_CE -+ old = (HBITMAP)SelectObject(mdc, screen_bmp); -+#else -+ SelectObject(mdc, screen_bmp); -+#endif - for ( i=0; ibmiHeader.biClrUsed=256; -+ for ( i=firstcolor; ibmiColors[i]=pal[i]; -+ screen_bmp = CreateDIBSection(hdc, last_bitmapinfo, DIB_RGB_COLORS, -+ last_bits, NULL, 0); -+ } -+#else - SelectObject(mdc, screen_bmp); -- SetDIBColorTable(mdc, firstcolor, ncolors, pal); -+ SetDIBColorTable(mdc, firstcolor, ncolors, pal); -+#endif -+#ifndef UNDER_CE - BitBlt(hdc, 0, 0, this->screen->w, this->screen->h, -- mdc, 0, 0, SRCCOPY); -+ mdc, 0, 0, SRCCOPY); -+#else -+ { -+ SDL_Rect rect; -+ rect.x=0; rect.y=0; -+ rect.w=this->screen->w; rect.h=this->screen->h; -+// Fixme: screen flickers: (this->UpdateRects)(this, 1, &rect) ; -+ } -+#endif - DeleteDC(mdc); --#endif - ReleaseDC(SDL_Window, hdc); - return(1); - } -@@ -937,27 +1270,27 @@ - - void DIB_VideoQuit(_THIS) - { -- /* Destroy the window and everything associated with it */ -+ /* Destroy the window and everything associated with it */ -+#ifdef _WIN32_CE -+ DIB_ShowTaskBar(TRUE); -+#ifdef ENABLE_WINGAPI -+ GAPI_GrabHardwareKeys(FALSE); -+#endif -+#endif - if ( SDL_Window ) { - /* Delete the screen bitmap (also frees screen->pixels) */ - if ( this->screen ) { --#ifdef WIN32_PLATFORM_PSPC -- if ( this->screen->flags & SDL_FULLSCREEN ) { -- /* Unhide taskbar, etc. */ -- SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR); -- SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON); -- ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -- } --#endif - #ifndef NO_CHANGEDISPLAYSETTINGS - if ( this->screen->flags & SDL_FULLSCREEN ) { - ChangeDisplaySettings(NULL, 0); - ShowWindow(SDL_Window, SW_HIDE); - } --#endif -+#endif -+#ifdef HAVE_OPENGL - if ( this->screen->flags & SDL_OPENGL ) { - WIN_GL_ShutDown(this); -- } -+ } -+#endif - this->screen->pixels = NULL; - } - if ( screen_bmp ) { -diff -ruN SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.h SDL-1.2.7/src/video/windib/SDL_dibvideo.h ---- SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.h Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/windib/SDL_dibvideo.h Thu Nov 18 13:13:42 2004 -@@ -29,11 +29,26 @@ - #define _SDL_dibvideo_h - - #include -+ -+//#ifdef _WIN32_CE -+/* Rotation direction */ -+typedef enum { -+ SDL_ROTATE_NONE, -+ SDL_ROTATE_LEFT, -+ SDL_ROTATE_RIGHT -+} SDL_RotateAttr; -+//#endif - - /* Private display data */ - struct SDL_PrivateVideoData { - HBITMAP screen_bmp; -- HPALETTE screen_pal; -+ HPALETTE screen_pal; -+//#ifdef _WIN32_CE -+ void *work_pixels; /* if the display needs to be rotated, memory allocated by the API */ -+ void *rotation_pixels; /* if the display needs to be rotated, memory allocated by the code */ -+ SDL_RotateAttr rotation; -+ char ozoneHack; /* force stylus translation if running without Hi Res flag */ -+//#endif - - #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ - int SDL_nummodes[NUM_MODELISTS]; -@@ -43,6 +58,12 @@ - #define screen_bmp (this->hidden->screen_bmp) - #define screen_pal (this->hidden->screen_pal) - #define SDL_nummodes (this->hidden->SDL_nummodes) --#define SDL_modelist (this->hidden->SDL_modelist) -+#define SDL_modelist (this->hidden->SDL_modelist) -+//#ifdef _WIN32_CE -+#define work_pixels (this->hidden->work_pixels) -+#define rotation (this->hidden->rotation) -+#define rotation_pixels (this->hidden->rotation_pixels) -+#define ozoneHack (this->hidden->ozoneHack) -+//#endif - - #endif /* _SDL_dibvideo_h */ -diff -ruN SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.c SDL-1.2.7/src/video/wingapi/SDL_gapivideo.c ---- SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.c Wed Dec 31 19:00:00 1969 -+++ SDL-1.2.7/src/video/wingapi/SDL_gapivideo.c Thu Nov 18 13:43:27 2004 -@@ -0,0 +1,956 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public -+ License along with this library; if not, write to the Free -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+ -+#ifdef SAVE_RCSID -+static char rcsid = -+ "@(#) $Id: SDL_gapivideo.c,v 1.5 2004/02/29 21:54:11 lemure Exp $"; -+#endif -+ -+/* Dummy SDL video driver implementation; this is just enough to make an -+ * SDL-based application THINK it's got a working video driver, for -+ * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, -+ * and also for use as a collection of stubs when porting SDL to a new -+ * platform for which you haven't yet written a valid video driver. -+ * -+ * This is also a great way to determine bottlenecks: if you think that SDL -+ * is a performance problem for a given platform, enable this driver, and -+ * then see if your application runs faster without video overhead. -+ * -+ * Initial work by Ryan C. Gordon (icculus@linuxgames.com). A good portion -+ * of this was cut-and-pasted from Stephane Peter's work in the AAlib -+ * SDL video driver. Renamed to "DUMMY" by Sam Lantinga. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+/* Not yet in the mingw32 cross-compile headers */ -+#ifndef CDS_FULLSCREEN -+#define CDS_FULLSCREEN 4 -+#endif -+ -+#ifndef WS_THICKFRAME -+#define WS_THICKFRAME 0 -+#endif -+ -+#include "SDL.h" -+#include "SDL_mutex.h" -+#include "SDL_syswm.h" -+#include "SDL_sysvideo.h" -+#include "SDL_sysevents.h" -+#include "SDL_events_c.h" -+#include "SDL_pixels_c.h" -+#include "SDL_syswm_c.h" -+#include "SDL_sysmouse_c.h" -+#include "SDL_dibevents_c.h" -+#include "SDL_gapivideo.h" -+ -+#if defined(WIN32_PLATFORM_PSPC) -+#include // Add Pocket PC includes -+#pragma comment( lib, "aygshell" ) // Link Pocket PC library -+#endif -+ -+#ifdef _WIN32_WCE -+extern void DIB_ShowTaskBar(BOOL taskBarShown); -+#endif -+ -+ -+/* Initialization/Query functions */ -+static int GAPI_VideoInit(_THIS, SDL_PixelFormat *vformat); -+static SDL_Rect **GAPI_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); -+static SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); -+static int GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); -+static void GAPI_VideoQuit(_THIS); -+ -+ -+/* Hardware surface functions */ -+static int GAPI_AllocHWSurface(_THIS, SDL_Surface *surface); -+static int GAPI_LockHWSurface(_THIS, SDL_Surface *surface); -+static void GAPI_UnlockHWSurface(_THIS, SDL_Surface *surface); -+static void GAPI_FreeHWSurface(_THIS, SDL_Surface *surface); -+ -+/* Windows message handling functions, will not be processed */ -+static void GAPI_RealizePalette(_THIS); -+static void GAPI_PaletteChanged(_THIS, HWND window); -+static void GAPI_WinPAINT(_THIS, HDC hdc); -+ -+static void GAPI_UpdateRects(_THIS, int numrects, SDL_Rect *rects); -+/*static void GAPI_UpdateRectsMono(_THIS, int numrects, SDL_Rect *rects);*/ -+ -+static int GAPI_Available(void); -+static SDL_VideoDevice *GAPI_CreateDevice(int devindex); -+ -+void GAPI_GrabHardwareKeys(BOOL grab); -+ -+VideoBootStrap WINGAPI_bootstrap = { -+ "wingapi", "WinCE GAPI", -+ GAPI_Available, GAPI_CreateDevice -+}; -+ -+/* 2003 SE GAPI emulation */ -+ -+#define GETRAWFRAMEBUFFER 0x00020001 -+ -+#define FORMAT_565 1 -+#define FORMAT_555 2 -+#define FORMAT_OTHER 3 -+ -+static void* _OzoneFrameBuffer = NULL; -+static struct GXDisplayProperties _OzoneDisplayProperties; -+static char _OzoneAvailable = 0; -+ -+typedef struct _RawFrameBufferInfo -+{ -+ WORD wFormat; -+ WORD wBPP; -+ VOID *pFramePointer; -+ int cxStride; -+ int cyStride; -+ int cxPixels; -+ int cyPixels; -+} RawFrameBufferInfo; -+ -+ -+struct GXDisplayProperties Ozone_GetDisplayProperties(void) { -+ return _OzoneDisplayProperties; -+} -+ -+int Ozone_OpenDisplay(HWND window, unsigned long flag) { -+ return 1; -+} -+ -+int Ozone_CloseDisplay(void) { -+ return 1; -+} -+ -+void* Ozone_BeginDraw(void) { -+ return _OzoneFrameBuffer; -+} -+ -+int Ozone_EndDraw(void) { -+ return 1; -+} -+ -+int Ozone_Suspend(void) { -+ return 1; -+} -+ -+int Ozone_Resume(void) { -+ return 1; -+} -+ -+static HINSTANCE checkOzone(tGXDisplayProperties *gxGetDisplayProperties, tGXOpenDisplay *gxOpenDisplay, -+ tGXVoidFunction *gxCloseDisplay, tGXBeginDraw *gxBeginDraw, -+ tGXVoidFunction *gxEndDraw, tGXVoidFunction *gxSuspend, tGXVoidFunction *gxResume) { -+#ifdef ARM -+ -+ int result; -+ RawFrameBufferInfo frameBufferInfo; -+ HDC hdc = GetDC(NULL); -+ result = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *)&frameBufferInfo); -+ ReleaseDC(NULL, hdc); -+ if (result < 0) -+ return NULL; -+ OutputDebugString(TEXT("Running on Ozone\r\n")); -+ _OzoneAvailable = 1; -+ -+ // Initializing global parameters -+ _OzoneFrameBuffer = frameBufferInfo.pFramePointer; -+ _OzoneDisplayProperties.cBPP = frameBufferInfo.wBPP; -+ _OzoneDisplayProperties.cbxPitch = frameBufferInfo.cxStride; -+ _OzoneDisplayProperties.cbyPitch = frameBufferInfo.cyStride; -+ _OzoneDisplayProperties.cxWidth = frameBufferInfo.cxPixels; -+ _OzoneDisplayProperties.cyHeight = frameBufferInfo.cyPixels; -+ if (frameBufferInfo.wFormat == FORMAT_565) -+ _OzoneDisplayProperties.ffFormat = kfDirect565; -+ else -+ if (frameBufferInfo.wFormat == FORMAT_555) -+ _OzoneDisplayProperties.ffFormat = kfDirect555; -+ else { -+ OutputDebugString(TEXT("Ozone unknown screen format")); -+ return NULL; -+ } -+ -+ if (gxGetDisplayProperties) -+ *gxGetDisplayProperties = Ozone_GetDisplayProperties; -+ if (gxOpenDisplay) -+ *gxOpenDisplay = Ozone_OpenDisplay; -+ if (gxCloseDisplay) -+ *gxCloseDisplay = Ozone_CloseDisplay; -+ if (gxBeginDraw) -+ *gxBeginDraw = Ozone_BeginDraw; -+ if (gxEndDraw) -+ *gxEndDraw = Ozone_EndDraw; -+ if (gxSuspend) -+ *gxSuspend = Ozone_Suspend; -+ if (gxResume) -+ *gxResume = Ozone_Resume; -+ -+ return (HINSTANCE)1; -+ -+#else -+ -+ return NULL; -+ -+#endif -+} -+ -+int getScreenWidth() { -+ return (_OzoneFrameBuffer ? _OzoneDisplayProperties.cxWidth : GetSystemMetrics(SM_CXSCREEN)); -+} -+ -+int getScreenHeight() { -+ return (_OzoneFrameBuffer ? _OzoneDisplayProperties.cyHeight : GetSystemMetrics(SM_CYSCREEN)); -+} -+ -+ -+/* Check GAPI library */ -+ -+#define IMPORT(Handle,Variable,Type,Function, Store) \ -+ Variable = GetProcAddress(Handle, TEXT(Function)); \ -+ if (!Variable) { \ -+ FreeLibrary(Handle); \ -+ return NULL; \ -+ } \ -+ if (Store) \ -+ *Store = (Type)Variable; -+ -+static HINSTANCE checkGAPI(tGXDisplayProperties *gxGetDisplayProperties, tGXOpenDisplay *gxOpenDisplay, -+ tGXVoidFunction *gxCloseDisplay, tGXBeginDraw *gxBeginDraw, -+ tGXVoidFunction *gxEndDraw, tGXVoidFunction *gxSuspend, tGXVoidFunction *gxResume, -+ BOOL bypassOzone) { -+ HMODULE gapiLibrary; -+ FARPROC proc; -+ HINSTANCE result; -+ // FIXME paletted ! -+ tGXDisplayProperties temp_gxGetDisplayProperties; -+ -+ // Workaround for Windows Mobile 2003 SE -+ _OzoneFrameBuffer = NULL; -+ if (!bypassOzone) { -+ result = checkOzone(gxGetDisplayProperties, gxOpenDisplay, gxCloseDisplay, gxBeginDraw, gxEndDraw, gxSuspend, gxResume); -+ if (result) -+ return result; -+ } -+ -+ gapiLibrary = LoadLibrary(TEXT("gx.dll")); -+ if (!gapiLibrary) -+ return NULL; -+ -+ IMPORT(gapiLibrary, proc, tGXDisplayProperties, "?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ", gxGetDisplayProperties) -+ IMPORT(gapiLibrary, proc, tGXOpenDisplay, "?GXOpenDisplay@@YAHPAUHWND__@@K@Z", gxOpenDisplay) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXCloseDisplay@@YAHXZ", gxCloseDisplay) -+ IMPORT(gapiLibrary, proc, tGXBeginDraw, "?GXBeginDraw@@YAPAXXZ", gxBeginDraw) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXEndDraw@@YAHXZ", gxEndDraw) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXSuspend@@YAHXZ", gxSuspend) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXResume@@YAHXZ", gxResume) -+ -+ // FIXME paletted ! for the moment we just bail out -+ if (!gxGetDisplayProperties) { -+ IMPORT(gapiLibrary, proc, tGXDisplayProperties, "?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ", &temp_gxGetDisplayProperties) -+ if (temp_gxGetDisplayProperties().ffFormat & kfPalette) { -+ FreeLibrary(gapiLibrary); -+ return NULL; -+ } -+ FreeLibrary(gapiLibrary); -+ gapiLibrary = (HINSTANCE)1; -+ } -+ -+ return gapiLibrary; -+} -+ -+ -+/* GAPI driver bootstrap functions */ -+ -+static int GAPI_Available(void) -+{ -+ /* Check if the GAPI library is available */ -+ -+ if (!checkGAPI(NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE)) { -+ OutputDebugString(TEXT("GAPI driver not available\r\n")); -+ return 0; -+ } -+ else { -+ OutputDebugString(TEXT("GAPI driver available\r\n")); -+ return 1; -+ } -+} -+ -+static void GAPI_DeleteDevice(SDL_VideoDevice *device) -+{ -+ if (device && device->hidden && device->hidden->gapiFuncs.dynamicGXCloseDisplay) -+ device->hidden->gapiFuncs.dynamicGXCloseDisplay(); -+ -+ if (device && device->hidden) -+ free(device->hidden); -+ if (device) -+ free(device); -+ -+} -+ -+static SDL_VideoDevice *GAPI_CreateDevice(int devindex) -+{ -+ SDL_VideoDevice *device; -+ -+ /* Initialize all variables that we clean on shutdown */ -+ device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); -+ if ( device ) { -+ memset(device, 0, (sizeof *device)); -+ device->hidden = (struct SDL_PrivateVideoData *) -+ malloc((sizeof *device->hidden)); -+ } -+ if ( (device == NULL) || (device->hidden == NULL) ) { -+ SDL_OutOfMemory(); -+ if ( device ) { -+ free(device); -+ } -+ return(0); -+ } -+ memset(device->hidden, 0, (sizeof *device->hidden)); -+ -+ /* Set GAPI pointers */ -+ -+ checkGAPI(&device->hidden->gapiFuncs.dynamicGXGetDisplayProperties, -+ &device->hidden->gapiFuncs.dynamicGXOpenDisplay, -+ &device->hidden->gapiFuncs.dynamicGXCloseDisplay, -+ &device->hidden->gapiFuncs.dynamicGXBeginDraw, -+ &device->hidden->gapiFuncs.dynamicGXEndDraw, -+ &device->hidden->gapiFuncs.dynamicGXSuspend, -+ &device->hidden->gapiFuncs.dynamicGXResume, -+ FALSE); -+ device->hidden->displayProps = device->hidden->gapiFuncs.dynamicGXGetDisplayProperties(); -+ -+ /* Set the function pointers */ -+ -+ device->VideoInit = GAPI_VideoInit; -+ device->ListModes = GAPI_ListModes; -+ device->SetVideoMode = GAPI_SetVideoMode; -+ device->UpdateMouse = WIN_UpdateMouse; -+ device->SetColors = GAPI_SetColors; -+ device->UpdateRects = NULL; -+ device->VideoQuit = GAPI_VideoQuit; -+ device->AllocHWSurface = GAPI_AllocHWSurface; -+ device->CheckHWBlit = NULL; -+ device->FillHWRect = NULL; -+ device->SetHWColorKey = NULL; -+ device->SetHWAlpha = NULL; -+ device->LockHWSurface = GAPI_LockHWSurface; -+ device->UnlockHWSurface = GAPI_UnlockHWSurface; -+ device->FlipHWSurface = NULL; -+ device->FreeHWSurface = GAPI_FreeHWSurface; -+ device->SetCaption = WIN_SetWMCaption; -+ device->SetIcon = WIN_SetWMIcon; -+ device->IconifyWindow = WIN_IconifyWindow; -+ device->GrabInput = WIN_GrabInput; -+ device->GetWMInfo = WIN_GetWMInfo; -+ device->FreeWMCursor = WIN_FreeWMCursor; -+ device->CreateWMCursor = WIN_CreateWMCursor; -+ device->ShowWMCursor = WIN_ShowWMCursor; -+ device->WarpWMCursor = WIN_WarpWMCursor; -+ device->CheckMouseMode = WIN_CheckMouseMode; -+ device->InitOSKeymap = DIB_InitOSKeymap; -+ device->PumpEvents = DIB_PumpEvents; -+ -+ device->SetColors = GAPI_SetColors; -+ -+ /* Set up the windows message handling functions */ -+ WIN_RealizePalette = GAPI_RealizePalette; -+ WIN_PaletteChanged = GAPI_PaletteChanged; -+ WIN_WinPAINT = GAPI_WinPAINT; -+ HandleMessage = DIB_HandleMessage; -+ -+ device->free = GAPI_DeleteDevice; -+ -+ -+ /* -+ device->VideoInit = GAPI_VideoInit; -+ device->ListModes = GAPI_ListModes; -+ device->SetVideoMode = GAPI_SetVideoMode; -+ device->CreateYUVOverlay = NULL; -+ device->SetColors = DUMMY_SetColors; -+ device->UpdateRects = DUMMY_UpdateRects; -+ device->VideoQuit = DUMMY_VideoQuit; -+ device->AllocHWSurface = DUMMY_AllocHWSurface; -+ device->CheckHWBlit = NULL; -+ device->FillHWRect = NULL; -+ device->SetHWColorKey = NULL; -+ device->SetHWAlpha = NULL; -+ device->LockHWSurface = DUMMY_LockHWSurface; -+ device->UnlockHWSurface = DUMMY_UnlockHWSurface; -+ device->FlipHWSurface = NULL; -+ device->FreeHWSurface = DUMMY_FreeHWSurface; -+ device->SetCaption = NULL; -+ device->SetIcon = NULL; -+ device->IconifyWindow = NULL; -+ device->GrabInput = NULL; -+ device->GetWMInfo = NULL; -+ device->InitOSKeymap = DUMMY_InitOSKeymap; -+ device->PumpEvents = DUMMY_PumpEvents; -+ -+ device->free = DUMMY_DeleteDevice; -+ */ -+ -+ return device; -+} -+ -+ -+int GAPI_VideoInit(_THIS, SDL_PixelFormat *vformat) -+{ -+ -+ /* Create the window */ -+ if ( DIB_CreateWindow(this) < 0 ) { -+ return(-1); -+ } -+ -+ vformat->BitsPerPixel = (unsigned char)displayProperties.cBPP; -+ -+ // Get color mask -+ if (displayProperties.ffFormat & kfDirect565) { -+ vformat->BitsPerPixel = 16; -+ vformat->Rmask = 0x0000f800; -+ vformat->Gmask = 0x000007e0; -+ vformat->Bmask = 0x0000001f; -+ videoMode = GAPI_DIRECT_565; -+ } -+ else -+ if (displayProperties.ffFormat & kfDirect555) { -+ vformat->BitsPerPixel = 16; -+ vformat->Rmask = 0x00007c00; -+ vformat->Gmask = 0x000003e0; -+ vformat->Bmask = 0x0000001f; -+ videoMode = GAPI_DIRECT_555; -+ } -+ else -+ if ((displayProperties.ffFormat & kfDirect) && (displayProperties.cBPP <= 8)) { -+ // We'll perform the conversion -+ vformat->BitsPerPixel = 24; -+ vformat->Rmask = 0x00ff0000; -+ vformat->Gmask = 0x0000ff00; -+ vformat->Bmask = 0x000000ff; -+ if (displayProperties.ffFormat & kfDirectInverted) -+ invert = (1 << displayProperties.cBPP) - 1; -+ colorscale = displayProperties.cBPP < 8 ? 8 - displayProperties.cBPP : 0; -+ videoMode = GAPI_MONO; -+ } -+ else -+ if (displayProperties.ffFormat & kfPalette) { -+ videoMode = GAPI_PALETTE; -+ } -+ -+ /* Set UpdateRect callback */ -+ // FIXME -+ /* -+ if (videoMode != GAPI_MONO) -+ this->UpdateRects = GAPI_UpdateRects; -+ else -+ this->UpdateRects = GAPI_UpdateRectsMono; -+ */ -+ -+ this->UpdateRects = GAPI_UpdateRects; -+ -+ /* We're done! */ -+ return(0); -+} -+ -+SDL_Rect **GAPI_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) -+{ -+ return (SDL_Rect **) -1; -+} -+ -+SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface *current, -+ int width, int height, int bpp, Uint32 flags) -+{ -+ SDL_Surface *video; -+ Uint32 Rmask, Gmask, Bmask; -+ Uint32 prev_flags; -+ DWORD style; -+ const DWORD directstyle = -+ (WS_POPUP); -+ const DWORD windowstyle = -+ (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX); -+ const DWORD resizestyle = -+ (WS_THICKFRAME|WS_MAXIMIZEBOX); -+ int screenWidth, screenHeight; -+ BOOL was_visible; -+ -+ /* We negociate legacy GAPI if we want a screen that fits in QVGA */ -+ if (_OzoneAvailable && _OzoneFrameBuffer && (width <= GetSystemMetrics(SM_CXSCREEN) || width <= GetSystemMetrics(SM_CYSCREEN)) && -+ (height <= GetSystemMetrics(SM_CXSCREEN) || height <= GetSystemMetrics(SM_CYSCREEN))) { -+ OutputDebugString(TEXT("Ozone workaround, switching back to GAPI\r\n")); -+ ozoneHack = 0; -+ checkGAPI(&this->hidden->gapiFuncs.dynamicGXGetDisplayProperties, -+ &this->hidden->gapiFuncs.dynamicGXOpenDisplay, -+ &this->hidden->gapiFuncs.dynamicGXCloseDisplay, -+ &this->hidden->gapiFuncs.dynamicGXBeginDraw, -+ &this->hidden->gapiFuncs.dynamicGXEndDraw, -+ &this->hidden->gapiFuncs.dynamicGXSuspend, -+ &this->hidden->gapiFuncs.dynamicGXResume, -+ TRUE); -+ this->hidden->displayProps = this->hidden->gapiFuncs.dynamicGXGetDisplayProperties(); -+ } -+ /* Otherwise we'll use the new system call */ -+ if (_OzoneAvailable && !_OzoneFrameBuffer && (width > GetSystemMetrics(SM_CXSCREEN) && width > GetSystemMetrics(SM_CYSCREEN)) && -+ (height > GetSystemMetrics(SM_CXSCREEN) && height > GetSystemMetrics(SM_CYSCREEN))) { -+ OutputDebugString(TEXT("Ozone workaround, switching back to true Ozone\r\n")); -+ checkGAPI(&this->hidden->gapiFuncs.dynamicGXGetDisplayProperties, -+ &this->hidden->gapiFuncs.dynamicGXOpenDisplay, -+ &this->hidden->gapiFuncs.dynamicGXCloseDisplay, -+ &this->hidden->gapiFuncs.dynamicGXBeginDraw, -+ &this->hidden->gapiFuncs.dynamicGXEndDraw, -+ &this->hidden->gapiFuncs.dynamicGXSuspend, -+ &this->hidden->gapiFuncs.dynamicGXResume, -+ FALSE); -+ this->hidden->displayProps = this->hidden->gapiFuncs.dynamicGXGetDisplayProperties(); -+ } -+ /* Which will need a tiny input hack if the original code does not have the "Hi Res" aware ressource property set */ -+ ozoneHack = 0; -+ if (_OzoneFrameBuffer && (GetSystemMetrics(SM_CXSCREEN) != (signed) _OzoneDisplayProperties.cxWidth || -+ GetSystemMetrics(SM_CYSCREEN) != (signed) _OzoneDisplayProperties.cyHeight)) { -+ OutputDebugString(TEXT("Running true Ozone with stylus hack\r\n")); -+ ozoneHack = 1; -+ } -+ -+ /* See whether or not we should center the window */ -+ was_visible = IsWindowVisible(SDL_Window); -+ -+ /* Recalculate bitmasks if necessary */ -+ if (bpp == current->format->BitsPerPixel) { -+ video = current; -+ } -+ else { -+ switch(bpp) { -+ case 8: -+ Rmask = 0; -+ Gmask = 0; -+ Bmask = 0; -+ break; -+ case 15: -+ case 16: -+ /* Default is 565 unless the display is specifically 555 */ -+ if (displayProperties.ffFormat & kfDirect555) { -+ Rmask = 0x00007c00; -+ Gmask = 0x000003e0; -+ Bmask = 0x0000001f; -+ } -+ else { -+ Rmask = 0x0000f800; -+ Gmask = 0x000007e0; -+ Bmask = 0x0000001f; -+ } -+ break; -+ case 24: -+ case 32: -+ Rmask = 0x00ff0000; -+ Gmask = 0x0000ff00; -+ Bmask = 0x000000ff; -+ break; -+ default: -+ SDL_SetError("Unsupported Bits Per Pixel format requested"); -+ return NULL; -+ } -+ video = SDL_CreateRGBSurface(SDL_SWSURFACE, -+ 0, 0, bpp, Rmask, Gmask, Bmask, 0); -+ if ( video == NULL ) { -+ SDL_OutOfMemory(); -+ return(NULL); -+ } -+ } -+ -+ /* Fill in part of the video surface */ -+ prev_flags = video->flags; -+ video->flags = 0; /* Clear flags */ -+ video->w = width; -+ video->h = height; -+ video->pitch = SDL_CalculatePitch(video); -+ mainSurfaceWidth = width; -+ mainSurfaceHeight = height; -+ -+//#ifdef WIN32_PLATFORM_PSPC -+ /* Hide taskbar */ -+ if ( flags & SDL_FULLSCREEN ) { -+ if ( !(prev_flags & SDL_FULLSCREEN) ) { -+ //SHFullScreen(SDL_Window, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON); -+ //ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); -+ DIB_ShowTaskBar(FALSE); -+ } -+ video->flags |= SDL_FULLSCREEN; -+ } else { -+ if ( prev_flags & SDL_FULLSCREEN ) { -+ //SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); -+ //ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ DIB_ShowTaskBar(TRUE); -+ } -+ } -+//#endif -+ -+ /* Reset the palette and create a new one if necessary */ -+ if (screenPal != NULL) { -+ DeleteObject(screenPal); -+ screenPal = NULL; -+ } -+ -+ /* See if we need to create a translation palette */ -+ if (convertPalette != NULL) { -+ free(convertPalette); -+ } -+ if (bpp == 8) { -+ OutputDebugString(TEXT("creating palette\r\n")); -+ convertPalette = (unsigned short*)malloc(256 * sizeof(unsigned short)); -+ } -+ -+ if (displayProperties.ffFormat & kfPalette) { -+ /* Will only be able to support 256 colors in this mode */ -+ // FIXME -+ //screenPal = GAPI_CreatePalette(); -+ } -+ -+ /* Set Window style */ -+ style = GetWindowLong(SDL_Window, GWL_STYLE); -+ if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { -+ style &= ~windowstyle; -+ style |= directstyle; -+ } else { -+ if ( flags & SDL_NOFRAME ) { -+ style &= ~windowstyle; -+ style |= directstyle; -+ video->flags |= SDL_NOFRAME; -+ } else { -+ style &= ~directstyle; -+ style |= windowstyle; -+ if ( flags & SDL_RESIZABLE ) { -+ style |= resizestyle; -+ video->flags |= SDL_RESIZABLE; -+ } -+ } -+#if WS_MAXIMIZE -+ if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE; -+#endif -+ } -+ -+ if (!SDL_windowid) -+ SetWindowLong(SDL_Window, GWL_STYLE, style); -+ -+ /* Allocate bitmap */ -+ if (gapiBuffer) { -+ free(gapiBuffer); -+ gapiBuffer = NULL; -+ } -+ gapiBuffer = malloc(video->h * video->pitch); -+ video->pixels = gapiBuffer; -+ -+ /* See if we will rotate */ -+ rotation = SDL_ROTATE_NONE; -+ screenWidth = getScreenWidth(); -+ screenHeight = getScreenHeight(); -+ if ((flags & SDL_FULLSCREEN) && -+ (width > screenWidth && width <= screenHeight) -+ ) -+ { -+ rotation = SDL_ROTATE_LEFT; -+ } -+ /* Compute the different drawing properties */ -+ switch(rotation) { -+ case SDL_ROTATE_NONE: -+ dstPixelstep = displayProperties.cbxPitch; -+ dstLinestep = displayProperties.cbyPitch; -+ startOffset = 0; -+ break; -+ case SDL_ROTATE_LEFT: -+ dstPixelstep = -displayProperties.cbyPitch; -+ dstLinestep = displayProperties.cbxPitch; -+ startOffset = displayProperties.cbyPitch * (displayProperties.cyHeight - 1); -+ break; -+ case SDL_ROTATE_RIGHT: -+ dstPixelstep = displayProperties.cbyPitch; -+ dstLinestep = -displayProperties.cbxPitch; -+ startOffset = displayProperties.cbxPitch * (displayProperties.cxWidth - 1); -+ break; -+ } -+ /* Compute padding */ -+ padWidth = 0; -+ padHeight = 0; -+ if (rotation == SDL_ROTATE_NONE) { -+ if (getScreenWidth() > width) -+ padWidth = (getScreenWidth() - width) / 2; -+ if (getScreenHeight() > height) -+ padHeight = (getScreenHeight() - height) / 2; -+ } -+ else { -+ if (getScreenWidth() > height) -+ padWidth = (getScreenWidth() - height) / 2; -+ if (getScreenHeight() > width) -+ padHeight = (getScreenHeight() - width) / 2; -+ } -+ srcLinestep = video->pitch; -+ srcPixelstep = (bpp == 15 ? 2 : bpp / 8); -+ -+ MoveWindow(SDL_Window, 0, 0, getScreenWidth(), getScreenHeight(), FALSE); -+ ShowWindow(SDL_Window, SW_SHOW); -+ -+ /* Resize the window */ -+ //if ( SDL_windowid == NULL ) { -+ if (0) { -+ HWND top; -+ UINT swp_flags; -+ RECT bounds; -+ int x,y; -+ -+ SDL_resizing = 1; -+ bounds.left = 0; -+ bounds.top = 0; -+ bounds.right = video->w; -+ bounds.bottom = video->h; -+ AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); -+ width = bounds.right-bounds.left; -+ height = bounds.bottom-bounds.top; -+ x = (getScreenWidth()-width)/2; -+ y = (getScreenHeight()-height)/2; -+ if ( y < 0 ) { /* Cover up title bar for more client area */ -+ y -= GetSystemMetrics(SM_CYCAPTION)/2; -+ } -+ swp_flags = (SWP_FRAMECHANGED | SWP_SHOWWINDOW); -+ if ( was_visible && !(flags & SDL_FULLSCREEN) ) { -+ swp_flags |= SWP_NOMOVE; -+ } -+ if ( flags & SDL_FULLSCREEN ) { -+ top = HWND_TOPMOST; -+ } else { -+ top = HWND_NOTOPMOST; -+ } -+ -+ if (flags & SDL_FULLSCREEN) { -+ SetWindowPos(SDL_Window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -+ ShowWindow(SDL_Window, SW_SHOW); -+ } -+ else -+ SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+ -+ SDL_resizing = 0; -+ SetForegroundWindow(SDL_Window); -+ } -+ -+ /* Open GAPI display */ -+ GXOpenDisplay(SDL_Window, (flags & SDL_FULLSCREEN ? GX_FULLSCREEN : 0)); -+ -+ /* Grab hardware keys if necessary */ -+ if (flags & SDL_FULLSCREEN) -+ GAPI_GrabHardwareKeys(TRUE); -+ -+ /* Blank screen */ -+ memset(GXBeginDraw(), 0, getScreenWidth() * getScreenHeight() * 2); -+ GXEndDraw(); -+ -+ /* We're done */ -+ return(video); -+} -+ -+/* We don't actually allow hardware surfaces other than the main one */ -+static int GAPI_AllocHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return(-1); -+} -+static void GAPI_FreeHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return; -+} -+ -+/* We need to wait for vertical retrace on page flipped displays */ -+static int GAPI_LockHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return(0); -+} -+ -+static void GAPI_UnlockHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return; -+} -+ -+static void updateLine(_THIS, unsigned char *srcPointer, unsigned char *destPointer, int width) { -+ // FIXME, we assume everything is in the correct format, either 16 bits 565 or 555, or 8 bits -+ int i; -+ for (i=0; i= 8) \ -+ { \ -+ bitshift = 0; \ -+ bitmask = (1<>= displayProperties.cBPP; -+ -+ -+static void GAPI_UpdateRectsMono(_THIS, int numrects, SDL_Rect *rects) -+{ -+ int i; -+ unsigned char *screenBuffer; -+ -+ screenBuffer = GXBeginDraw(); -+ -+ for (i=0; i>3)) -+ -+#define COLORCONV555(r,g,b) (((r&0xf8)<<(10-3))|((g&0xf8)<<(5-2))|((b&0xf8)>>3)) -+ -+int GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) -+{ -+ int i; -+ /* Convert colors to appropriate 565 or 555 mapping */ -+ for (i=0; ipixels) */ -+ if ( this->screen ) { -+//#ifdef WIN32_PLATFORM_PSPC -+ if ( this->screen->flags & SDL_FULLSCREEN ) { -+ /* Unhide taskbar, etc. */ -+ //SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); -+ //ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ DIB_ShowTaskBar(TRUE); -+ GAPI_GrabHardwareKeys(FALSE); -+ } -+//#endif -+ -+ if (this->screen->pixels != NULL) -+ { -+ free(this->screen->pixels); -+ this->screen->pixels = NULL; -+ } -+ -+ if (GXCloseDisplay) -+ GXCloseDisplay(); -+ } -+ } -+} -+ -+void GAPI_GrabHardwareKeys(BOOL grab) { -+ HINSTANCE GAPI_handle; -+ tGXVoidFunction GAPIActionInput; -+ -+ GAPI_handle = LoadLibrary(TEXT("gx.dll")); -+ if (!GAPI_handle) -+ return; -+ GAPIActionInput = (tGXVoidFunction)GetProcAddress(GAPI_handle, (grab ? TEXT("?GXOpenInput@@YAHXZ") : TEXT("?GXCloseInput@@YAHXZ"))); -+ if (GAPIActionInput) { -+ GAPIActionInput(); -+ } -+ FreeLibrary(GAPI_handle); -+} -diff -ruN SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.h SDL-1.2.7/src/video/wingapi/SDL_gapivideo.h ---- SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.h Wed Dec 31 19:00:00 1969 -+++ SDL-1.2.7/src/video/wingapi/SDL_gapivideo.h Sun May 30 17:57:48 2004 -@@ -0,0 +1,192 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public -+ License along with this library; if not, write to the Free -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+ -+#ifdef SAVE_RCSID -+static char rcsid = -+ "@(#) $Id: SDL_gapivideo.h,v 1.1 2004/02/02 23:25:35 lemure Exp $"; -+#endif -+ -+#ifndef _SDL_gapivideo_h -+#define _SDL_gapivideo_h -+ -+#include -+ -+/* -------------------------------------------------------------------------------------------- */ -+ -+/* From gx.h, since it's not really C compliant */ -+ -+struct GXDisplayProperties { -+ DWORD cxWidth; -+ DWORD cyHeight; // notice lack of 'th' in the word height. -+ long cbxPitch; // number of bytes to move right one x pixel - can be negative. -+ long cbyPitch; // number of bytes to move down one y pixel - can be negative. -+ long cBPP; // # of bits in each pixel -+ DWORD ffFormat; // format flags. -+}; -+ -+struct GXKeyList { -+ short vkUp; // key for up -+ POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates. -+ short vkDown; -+ POINT ptDown; -+ short vkLeft; -+ POINT ptLeft; -+ short vkRight; -+ POINT ptRight; -+ short vkA; -+ POINT ptA; -+ short vkB; -+ POINT ptB; -+ short vkC; -+ POINT ptC; -+ short vkStart; -+ POINT ptStart; -+}; -+ -+#define kfLandscape 0x8 // Screen is rotated 270 degrees -+#define kfPalette 0x10 // Pixel values are indexes into a palette -+#define kfDirect 0x20 // Pixel values contain actual level information -+#define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel. -+#define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel -+#define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel. -+#define kfDirect444 0x200 // 4 red, 4 green, 4 blue -+#define kfDirectInverted 0x400 -+ -+#define GX_FULLSCREEN 0x01 // for OpenDisplay() -+ -+/* -------------------------------------------------------------------------------------------- */ -+ -+/* Rotation direction */ -+typedef enum { -+ SDL_ROTATE_NONE, -+ SDL_ROTATE_LEFT, -+ SDL_ROTATE_RIGHT -+} SDL_RotateAttr; -+ -+/* GAPI video mode */ -+typedef enum { -+ GAPI_NONE = 0, -+ GAPI_DIRECT_565, -+ GAPI_DIRECT_555, -+ GAPI_MONO, -+ GAPI_PALETTE -+} SDL_GAPIVideoMode; -+ -+ -+/* Hidden "this" pointer for the video functions */ -+#define _THIS SDL_VideoDevice *this -+ -+/* GAPI functions definitions */ -+ -+typedef struct GXDisplayProperties (*tGXDisplayProperties)(void); -+typedef int (*tGXOpenDisplay)(HWND, unsigned long); -+typedef void* (*tGXBeginDraw)(void); -+typedef int (*tGXVoidFunction)(void); -+ -+/* Private display data */ -+ -+struct GAPI_funcs { -+ tGXDisplayProperties dynamicGXGetDisplayProperties; -+ tGXOpenDisplay dynamicGXOpenDisplay; -+ tGXVoidFunction dynamicGXCloseDisplay; -+ tGXBeginDraw dynamicGXBeginDraw; -+ tGXVoidFunction dynamicGXEndDraw; -+ tGXVoidFunction dynamicGXSuspend; -+ tGXVoidFunction dynamicGXResume; -+}; -+ -+struct GAPI_properties { -+ unsigned char invert; -+ int colorscale; -+ int dstPixelstep; -+ int dstLinestep; -+ int startOffset; -+ SDL_GAPIVideoMode videoMode; -+}; -+ -+#define MAX_CLR 0x100 -+ -+struct palette_properties { -+ unsigned char *palRed; -+ unsigned char *palGreen; -+ unsigned char *palBlue; -+ unsigned short *pal; -+}; -+ -+ -+struct SDL_PrivateVideoData { -+ /* --- --- begin with DIB private structure to allow DIB events code sharing */ -+ HBITMAP screen_bmp; -+ HPALETTE screen_pal; -+ void *work_pixels; /* if the display needs to be rotated, memory allocated by the API */ -+ void *rotation_pixels; /* if the display needs to be rotated, memory allocated by the code */ -+ SDL_RotateAttr rotation; -+ char ozoneHack; /* force stylus translation if running without Hi Res flag */ -+ -+#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ -+ int SDL_nummodes[NUM_MODELISTS]; -+ SDL_Rect **SDL_modelist[NUM_MODELISTS]; -+ -+ /* --- --- */ -+ -+ int w, h; -+ void *gapiBuffer; -+ HPALETTE screenPal; -+ struct GAPI_funcs gapiFuncs; -+ struct GAPI_properties gapiProperties; -+ struct GXDisplayProperties displayProps; -+ int srcLinestep; -+ int srcPixelstep; -+ -+ int padWidth; -+ int padHeight; -+ -+ unsigned short *convertPalette; -+}; -+ -+#define gapiBuffer (this->hidden->gapiBuffer) -+#define mainSurfaceWidth (this->hidden->w) -+#define mainSurfaceHeight (this->hidden->h) -+#define rotation (this->hidden->rotation) -+#define ozoneHack (this->hidden->ozoneHack) -+#define displayProperties (this->hidden->displayProps) -+#define screenPal (this->hidden->screenPal) -+#define GXGetDisplayProperties (this->hidden->gapiFuncs.dynamicGXGetDisplayProperties) -+#define GXOpenDisplay (this->hidden->gapiFuncs.dynamicGXOpenDisplay) -+#define GXCloseDisplay (this->hidden->gapiFuncs.dynamicGXCloseDisplay) -+#define GXBeginDraw (this->hidden->gapiFuncs.dynamicGXBeginDraw) -+#define GXEndDraw (this->hidden->gapiFuncs.dynamicGXEndDraw) -+#define GXSuspend (this->hidden->gapiFuncs.dynamicGXSuspend) -+#define GXResume (this->hidden->gapiFuncs.dynamicGXResume) -+#define invert (this->hidden->gapiProperties.invert) -+#define colorscale (this->hidden->gapiProperties.colorscale) -+#define videoMode (this->hidden->gapiProperties.videoMode) -+#define srcPixelstep (this->hidden->srcPixelstep) -+#define srcLinestep (this->hidden->srcLinestep) -+#define dstPixelstep (this->hidden->gapiProperties.dstPixelstep) -+#define dstLinestep (this->hidden->gapiProperties.dstLinestep) -+#define startOffset (this->hidden->gapiProperties.startOffset) -+#define padWidth (this->hidden->padWidth) -+#define padHeight (this->hidden->padHeight) -+#define convertPalette (this->hidden->convertPalette) -+ -+#endif /* _SDL_gapivideo_h */ diff --git a/tools/SDL1.2.7_CE/VisualCEv2.zip b/tools/SDL1.2.7_CE/VisualCEv2.zip deleted file mode 100644 index 816382e3b..000000000 Binary files a/tools/SDL1.2.7_CE/VisualCEv2.zip and /dev/null differ diff --git a/tools/SOCEdit/Global.bas b/tools/SOCEdit/Global.bas deleted file mode 100644 index 77bf3df2b..000000000 --- a/tools/SOCEdit/Global.bas +++ /dev/null @@ -1,96 +0,0 @@ -Attribute VB_Name = "Module1" -Option Explicit -Public SOCFile As String -Public SOCTemp As String -Public SourcePath As String - -Public Function FirstToken(ByVal line As String) - Dim index As Integer - - index = InStr(line, " ") - 1 - - If index < 1 Then - index = Len(line) - End If - - FirstToken = TrimComplete(Left(line, index)) -End Function - -Public Function SecondToken(ByVal line As String) - Dim startclip As Integer - Dim endclip As Integer - - startclip = InStr(line, " ") - - startclip = startclip + 1 - - SecondToken = TrimComplete(Mid(line, startclip, Len(line))) -End Function - -Public Function SecondTokenEqual(ByVal line As String) - Dim startclip As Integer - Dim endclip As Integer - - startclip = InStr(line, "=") - - startclip = startclip + 2 - - line = Mid(line, startclip, Len(line)) - - SecondTokenEqual = TrimComplete(line) -End Function - -Public Function TrimComplete(ByVal sValue As String) As String - Dim sAns As String - Dim sWkg As String - Dim sChar As String - Dim lLen As Long - Dim lCtr As Long - - sAns = sValue - lLen = Len(sValue) - - If lLen > 0 Then - 'Ltrim - For lCtr = 1 To lLen - sChar = Mid(sAns, lCtr, 1) - If Asc(sChar) > 32 Then Exit For - Next - - sAns = Mid(sAns, lCtr) - lLen = Len(sAns) - - 'Rtrim - If lLen > 0 Then - For lCtr = lLen To 1 Step -1 - sChar = Mid(sAns, lCtr, 1) - If Asc(sChar) > 32 Then Exit For - Next - End If - sAns = Left$(sAns, lCtr) - End If - - TrimComplete = sAns -End Function - -Public Function RTrimComplete(ByVal sValue As String) As String - Dim sAns As String - Dim sWkg As String - Dim sChar As String - Dim lLen As Long - Dim lCtr As Long - - sAns = sValue - lLen = Len(sValue) - - 'Rtrim - If lLen > 0 Then - For lCtr = lLen To 1 Step -1 - sChar = Mid(sAns, lCtr, 1) - If Asc(sChar) > 32 Then Exit For - Next - End If - sAns = Left$(sAns, lCtr) - - RTrimComplete = sAns -End Function diff --git a/tools/SOCEdit/SOCEdit.vbp b/tools/SOCEdit/SOCEdit.vbp deleted file mode 100644 index 90af0095a..000000000 --- a/tools/SOCEdit/SOCEdit.vbp +++ /dev/null @@ -1,53 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINNT\system32\stdole2.tlb#OLE Automation -Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#..\..\..\WINNT\system32\scrrun.dll#Microsoft Scripting Runtime -Form=Things.frm -Module=Module1; Global.bas -Form=frmStateEdit.frm -Form=frmLevelHeader.frm -Form=frmHub.frm -Form=frmMaincfg.frm -Form=frmUnlockablesEdit.frm -Form=frmEmblemEdit.frm -Form=frmSoundEdit.frm -Form=frmCharacterEdit.frm -Form=frmCutsceneEdit.frm -Form=frmHelp.frm -Form=frmHUDEdit.frm -IconForm="frmThingEdit" -Startup="frmHub" -HelpFile="" -Title="SOC Editor" -ExeName32="SOCEdit.exe" -Path32="..\..\..\srb2demo2\SOCEdit" -Command32="" -Name="SOCEditor" -HelpContextID="0" -CompatibleMode="0" -MajorVer=0 -MinorVer=7 -RevisionVer=7 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionComments="http://www.srb2.org/" -VersionCompanyName="Sonic Team Junior" -VersionFileDescription="For SRB2 v1.09.4" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/tools/SOCEdit/Things.frm b/tools/SOCEdit/Things.frm deleted file mode 100644 index f95b6afb7..000000000 --- a/tools/SOCEdit/Things.frm +++ /dev/null @@ -1,1895 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmThingEdit - Caption = "Thing Edit" - ClientHeight = 5745 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 11880 - Icon = "Things.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 5745 - ScaleWidth = 11880 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdCopy - Caption = "&Copy Thing" - Height = 615 - Left = 6600 - TabIndex = 77 - Top = 4920 - Width = 975 - End - Begin VB.CommandButton cmdLoadDefault - Caption = "&Load Code Default" - Height = 615 - Left = 4440 - Style = 1 'Graphical - TabIndex = 76 - Top = 4920 - Width = 975 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete Thing from SOC" - Height = 615 - Left = 3240 - Style = 1 'Graphical - TabIndex = 74 - Top = 4920 - Width = 1095 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 615 - Left = 5520 - TabIndex = 73 - Top = 4920 - Width = 975 - End - Begin VB.Frame frmFlags - Caption = "Flags" - Height = 3735 - Left = 7680 - TabIndex = 45 - Top = 1920 - Width = 4095 - Begin VB.CheckBox chkFlags - Caption = "MF_FIRE" - Height = 255 - Index = 26 - Left = 2040 - TabIndex = 72 - Tag = "4194304" - ToolTipText = "Fire object. Doesn't harm if you have red shield." - Top = 2160 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOCLIPTHING" - Height = 255 - Index = 25 - Left = 2040 - TabIndex = 71 - Tag = "1073741824" - ToolTipText = "Don't be blocked by things (partial clipping)" - Top = 3120 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SCENERY" - Height = 255 - Index = 24 - Left = 2040 - TabIndex = 70 - Tag = "33554432" - ToolTipText = "Scenery (uses scenery thinker). Uses less CPU than a standard object, but generally can't move, etc." - Top = 2880 - Width = 1455 - End - Begin VB.CheckBox chkFlags - Caption = "MF_ENEMY" - Height = 255 - Index = 23 - Left = 2040 - TabIndex = 69 - Tag = "16777216" - ToolTipText = "This mobj is an enemy!" - Top = 2640 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_COUNTITEM" - Height = 255 - Index = 22 - Left = 2040 - TabIndex = 68 - Tag = "8388608" - ToolTipText = "On picking up, count this item object towards intermission item total." - Top = 2400 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOTHINK" - Height = 255 - Index = 21 - Left = 2040 - TabIndex = 67 - Tag = "2097152" - ToolTipText = "Don't run this thing's thinker." - Top = 1920 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_MONITOR" - Height = 255 - Index = 20 - Left = 2040 - TabIndex = 66 - Tag = "1048576" - ToolTipText = "Item box" - Top = 1680 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_HIRES" - Height = 255 - Index = 19 - Left = 2040 - TabIndex = 65 - Tag = "524288" - ToolTipText = "Object uses a high-resolution sprite" - Top = 1440 - Width = 1215 - End - Begin VB.CheckBox chkFlags - Caption = "MF_BOUNCE" - Height = 255 - Index = 18 - Left = 2040 - TabIndex = 64 - Tag = "262144" - ToolTipText = "Bounce off walls and things." - Top = 1200 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPRING" - Height = 255 - Index = 17 - Left = 2040 - TabIndex = 63 - Tag = "131072" - ToolTipText = "Item is a spring." - Top = 960 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_MISSILE" - Height = 255 - Index = 16 - Left = 2040 - TabIndex = 62 - Tag = "65536" - ToolTipText = "Any kind of projectile currently flying through the air, waiting to hit something" - Top = 720 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_BOXICON" - Height = 255 - Index = 15 - Left = 2040 - TabIndex = 61 - Tag = "32768" - ToolTipText = "Monitor powerup icon. These rise a bit." - Top = 480 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_FLOAT" - Height = 255 - Index = 14 - Left = 2040 - TabIndex = 60 - Tag = "16384" - ToolTipText = "Allow moves to any height, no gravity. For active floaters." - Top = 240 - Width = 1215 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPECIALFLAGS" - Height = 255 - Index = 13 - Left = 120 - TabIndex = 59 - Tag = "8192" - ToolTipText = "This object does not adhere to regular flag/z properties for object placing." - Top = 3360 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOCLIP" - Height = 255 - Index = 12 - Left = 120 - TabIndex = 58 - Tag = "4096" - ToolTipText = "Don't clip against objects, walls, etc." - Top = 3120 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SLIDEME" - Height = 255 - Index = 11 - Left = 120 - TabIndex = 57 - Tag = "2048" - ToolTipText = "Slide this object when it hits a wall." - Top = 2880 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_AMBIENT" - Height = 255 - Index = 10 - Left = 120 - TabIndex = 56 - Tag = "1024" - ToolTipText = "This object is an ambient sound." - Top = 2640 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOGRAVITY" - Height = 255 - Index = 9 - Left = 120 - TabIndex = 55 - Tag = "512" - ToolTipText = "Don't apply gravity" - Top = 2400 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPAWNCEILING" - Height = 255 - Index = 8 - Left = 120 - TabIndex = 54 - Tag = "256" - ToolTipText = "On level spawning (initial position), hang from ceiling instead of stand on floor." - Top = 2160 - Width = 1935 - End - Begin VB.CheckBox chkFlags - Caption = "MF_BOSS" - Height = 255 - Index = 7 - Left = 120 - TabIndex = 53 - Tag = "128" - ToolTipText = "Object is a boss." - Top = 1920 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_PUSHABLE" - Height = 255 - Index = 6 - Left = 120 - TabIndex = 52 - Tag = "64" - ToolTipText = "You can push this object. It can activate switches and things by pushing it on top." - Top = 1680 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_AMBUSH" - Height = 255 - Index = 5 - Left = 120 - TabIndex = 51 - Tag = "32" - ToolTipText = "Special attributes" - Top = 1440 - Width = 1455 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOBLOCKMAP" - Height = 255 - Index = 4 - Left = 120 - TabIndex = 50 - Tag = "16" - ToolTipText = "Don't use the blocklinks (inert but displayable)" - Top = 1200 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOSECTOR" - Height = 255 - Index = 3 - Left = 120 - TabIndex = 49 - Tag = "8" - ToolTipText = "Don't use the sector links (invisible but touchable)." - Top = 960 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SHOOTABLE" - Height = 255 - Index = 2 - Left = 120 - TabIndex = 48 - Tag = "4" - ToolTipText = "Can be hit." - Top = 720 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SOLID" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 47 - Tag = "2" - ToolTipText = "Blocks." - Top = 480 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPECIAL" - Height = 255 - Index = 0 - Left = 120 - TabIndex = 46 - Tag = "1" - ToolTipText = "Call P_TouchSpecialThing when touched." - Top = 240 - Width = 1455 - End - End - Begin VB.ComboBox cmbRaisestate - Height = 315 - Left = 4320 - TabIndex = 43 - Text = "cmbRaisestate" - Top = 4440 - Width = 3300 - End - Begin VB.ComboBox cmbActivesound - Height = 315 - Left = 4320 - TabIndex = 41 - Text = "cmbActivesound" - Top = 4080 - Width = 3300 - End - Begin VB.TextBox txtDamage - Height = 285 - Left = 10680 - TabIndex = 39 - Text = "0" - Top = 1200 - Width = 1095 - End - Begin VB.TextBox txtMass - Height = 285 - Left = 10680 - TabIndex = 37 - Text = "0" - Top = 840 - Width = 1095 - End - Begin VB.TextBox txtHeight - Height = 285 - Left = 10680 - TabIndex = 35 - Text = "0" - Top = 480 - Width = 1095 - End - Begin VB.TextBox txtRadius - Height = 285 - Left = 10680 - TabIndex = 33 - Text = "0" - Top = 120 - Width = 1095 - End - Begin VB.TextBox txtSpeed - Height = 285 - Left = 8760 - TabIndex = 31 - Text = "0" - Top = 1560 - Width = 1095 - End - Begin VB.ComboBox cmbDeathsound - Height = 315 - Left = 4320 - TabIndex = 29 - Text = "cmbDeathsound" - Top = 3720 - Width = 3300 - End - Begin VB.ComboBox cmbXdeathstate - Height = 315 - Left = 4320 - TabIndex = 27 - Text = "cmbXdeathstate" - Top = 3360 - Width = 3300 - End - Begin VB.ComboBox cmbDeathstate - Height = 315 - Left = 4320 - TabIndex = 25 - Text = "cmbDeathstate" - Top = 3000 - Width = 3300 - End - Begin VB.ComboBox cmbMissilestate - Height = 315 - Left = 4320 - TabIndex = 23 - Text = "cmbMissilestate" - Top = 2640 - Width = 3300 - End - Begin VB.ComboBox cmbMeleestate - Height = 315 - Left = 4320 - TabIndex = 21 - Text = "cmbMeleestate" - Top = 2280 - Width = 3300 - End - Begin VB.ComboBox cmbPainsound - Height = 315 - Left = 4320 - TabIndex = 19 - Text = "cmbPainsound" - Top = 1920 - Width = 3300 - End - Begin VB.TextBox txtPainchance - Height = 285 - Left = 8760 - TabIndex = 17 - Text = "0" - Top = 1200 - Width = 1095 - End - Begin VB.ComboBox cmbPainstate - Height = 315 - Left = 4320 - TabIndex = 15 - Text = "cmbPainstate" - Top = 1560 - Width = 3300 - End - Begin VB.ComboBox cmbAttacksound - Height = 315 - Left = 4320 - TabIndex = 13 - Text = "cmbAttacksound" - Top = 1200 - Width = 3300 - End - Begin VB.TextBox txtReactiontime - Height = 285 - Left = 8760 - TabIndex = 11 - Text = "0" - Top = 840 - Width = 1095 - End - Begin VB.ComboBox cmbSeesound - Height = 315 - Left = 4320 - TabIndex = 9 - Text = "cmbSeesound" - Top = 840 - Width = 3300 - End - Begin VB.ComboBox cmbSeestate - Height = 315 - Left = 4320 - TabIndex = 7 - Text = "cmbSeestate" - Top = 480 - Width = 3300 - End - Begin VB.TextBox txtSpawnhealth - Height = 285 - Left = 8760 - TabIndex = 6 - Text = "0" - Top = 480 - Width = 1095 - End - Begin VB.ComboBox cmbSpawnstate - Height = 315 - Left = 4320 - TabIndex = 3 - Text = "cmbSpawnstate" - Top = 120 - Width = 3300 - End - Begin VB.TextBox txtDoomednum - Height = 285 - Left = 8760 - TabIndex = 1 - Text = "0" - Top = 120 - Width = 1095 - End - Begin VB.ListBox lstThings - Height = 5520 - ItemData = "Things.frx":0442 - Left = 120 - List = "Things.frx":0444 - TabIndex = 0 - Top = 120 - Width = 3015 - End - Begin VB.Label lblStatusInfo - Alignment = 2 'Center - Caption = "Idle" - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 375 - Left = 9960 - TabIndex = 75 - Top = 1560 - Width = 1815 - End - Begin VB.Label lblRaisestate - Alignment = 1 'Right Justify - Caption = "Raisestate:" - Height = 255 - Left = 3360 - TabIndex = 44 - Top = 4440 - Width = 855 - End - Begin VB.Label lblActivesound - Alignment = 1 'Right Justify - Caption = "Activesound:" - Height = 255 - Left = 3240 - TabIndex = 42 - Top = 4080 - Width = 975 - End - Begin VB.Label lblDamage - Alignment = 1 'Right Justify - Caption = "Damage:" - Height = 255 - Left = 9840 - TabIndex = 40 - Top = 1200 - Width = 735 - End - Begin VB.Label lblMass - Alignment = 1 'Right Justify - Caption = "Mass:" - Height = 255 - Left = 9960 - TabIndex = 38 - Top = 840 - Width = 615 - End - Begin VB.Label lblHeight - Alignment = 1 'Right Justify - Caption = "Height:" - Height = 255 - Left = 9960 - TabIndex = 36 - Top = 480 - Width = 615 - End - Begin VB.Label lblRadius - Alignment = 1 'Right Justify - Caption = "Radius:" - Height = 255 - Left = 9960 - TabIndex = 34 - Top = 120 - Width = 615 - End - Begin VB.Label lblSpeed - Alignment = 1 'Right Justify - Caption = "Speed:" - Height = 255 - Left = 7680 - TabIndex = 32 - Top = 1560 - Width = 975 - End - Begin VB.Label lblDeathsound - Alignment = 1 'Right Justify - Caption = "Deathsound:" - Height = 255 - Left = 3240 - TabIndex = 30 - Top = 3720 - Width = 975 - End - Begin VB.Label lblXdeathstate - Alignment = 1 'Right Justify - Caption = "Xdeathstate:" - Height = 255 - Left = 3240 - TabIndex = 28 - Top = 3360 - Width = 975 - End - Begin VB.Label lblDeathstate - Alignment = 1 'Right Justify - Caption = "Deathstate:" - Height = 255 - Left = 3240 - TabIndex = 26 - Top = 3000 - Width = 975 - End - Begin VB.Label lblMissilestate - Alignment = 1 'Right Justify - Caption = "Missilestate:" - Height = 255 - Left = 3240 - TabIndex = 24 - Top = 2640 - Width = 975 - End - Begin VB.Label lblMeleestate - Alignment = 1 'Right Justify - Caption = "Meleestate:" - Height = 255 - Left = 3240 - TabIndex = 22 - Top = 2280 - Width = 975 - End - Begin VB.Label lblPainsound - Alignment = 1 'Right Justify - Caption = "Painsound:" - Height = 255 - Left = 3240 - TabIndex = 20 - Top = 1920 - Width = 975 - End - Begin VB.Label lblPainchance - Alignment = 1 'Right Justify - Caption = "Painchance:" - Height = 255 - Left = 7680 - TabIndex = 18 - Top = 1200 - Width = 975 - End - Begin VB.Label lblPainstate - Alignment = 1 'Right Justify - Caption = "Painstate:" - Height = 255 - Left = 3240 - TabIndex = 16 - Top = 1560 - Width = 975 - End - Begin VB.Label lblAttacksound - Alignment = 1 'Right Justify - Caption = "Attacksound:" - Height = 255 - Left = 3240 - TabIndex = 14 - Top = 1200 - Width = 975 - End - Begin VB.Label lblReactiontime - Alignment = 1 'Right Justify - Caption = "Reactiontime:" - Height = 255 - Left = 7680 - TabIndex = 12 - Top = 840 - Width = 975 - End - Begin VB.Label lblSeesound - Alignment = 1 'Right Justify - Caption = "Seesound:" - Height = 255 - Left = 3240 - TabIndex = 10 - Top = 840 - Width = 975 - End - Begin VB.Label lblSeestate - Alignment = 1 'Right Justify - Caption = "Seestate:" - Height = 255 - Left = 3240 - TabIndex = 8 - Top = 480 - Width = 975 - End - Begin VB.Label lblSpawnhealth - Alignment = 1 'Right Justify - Caption = "Spawnhealth:" - Height = 255 - Left = 7680 - TabIndex = 5 - Top = 480 - Width = 975 - End - Begin VB.Label lblSpawnstate - Alignment = 1 'Right Justify - Caption = "Spawnstate:" - Height = 255 - Left = 3240 - TabIndex = 4 - Top = 120 - Width = 975 - End - Begin VB.Label lblDoomednum - Alignment = 1 'Right Justify - Caption = "Thing Map #:" - Height = 255 - Left = 7680 - TabIndex = 2 - Top = 120 - Width = 975 - End -End -Attribute VB_Name = "frmThingEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdCopy_Click() - Dim Response As String - - Response$ = InputBox("Copy state to #:", "Copy State") - - If Response = "" Then Exit Sub - - Response = TrimComplete(Response) - - Call WriteThing(False, Val(Response)) - - MsgBox "Thing copied to #" & Val(Response) -End Sub - -Private Sub cmdDelete_Click() - Call WriteThing(True, lstThings.ListIndex) -End Sub - -Private Sub cmdLoadDefault_Click() - Call ClearForm - If InStr(lstThings.List(lstThings.ListIndex), "MT_FREESLOT") = 0 Then - LoadObjectInfo (lstThings.ListIndex) - Else - MsgBox "Free slots do not have a code default." - End If -End Sub - -Private Sub cmdSave_Click() - Call WriteThing(False, lstThings.ListIndex) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ClearForm() - Dim i As Integer - cmbSpawnstate.Text = "" - cmbSeestate.Text = "" - cmbSeesound.Text = "" - cmbAttacksound.Text = "" - cmbPainstate.Text = "" - cmbPainsound.Text = "" - cmbMeleestate.Text = "" - cmbMissilestate.Text = "" - cmbDeathstate.Text = "" - cmbXdeathstate.Text = "" - cmbDeathsound.Text = "" - cmbActivesound.Text = "" - cmbRaisestate.Text = "" - txtDoomednum.Text = "" - txtSpawnhealth.Text = "" - txtReactiontime.Text = "" - txtPainchance.Text = "" - txtSpeed.Text = "" - txtRadius.Text = "" - txtHeight.Text = "" - txtMass.Text = "" - txtDamage.Text = "" - - For i = 0 To 26 - chkFlags(i).Value = 0 - Next -End Sub - -Private Sub Reload() - lblStatusInfo.Caption = "Loading Sounds Info..." - DoEvents - LoadSounds - lblStatusInfo.Caption = "Loading Things Info..." - DoEvents - LoadThings - lblStatusInfo.Caption = "Loading States Info..." - DoEvents - LoadStates - lblStatusInfo.Caption = "Idle" - lstThings.ListIndex = 0 -End Sub - -Private Sub LoadSounds() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim i As Integer, numfreeslots As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "List of sounds (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbSeesound.Clear - cmbAttacksound.Clear - cmbPainsound.Clear - cmbDeathsound.Clear - cmbActivesound.Clear - - Do While InStr(line, "sfx_freeslot0") = 0 - startclip = InStr(line, "sfx_") - If InStr(line, "sfx_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbSeesound.AddItem addstring - cmbAttacksound.AddItem addstring - cmbPainsound.AddItem addstring - cmbDeathsound.AddItem addstring - cmbActivesound.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing - - 'Populate the free slots! - numfreeslots = 800 - - For i = 1 To numfreeslots - If i < 10 Then - addstring = number & " - " & "sfx_fre00" & i & " (free slot)" - ElseIf i < 100 Then - addstring = number & " - " & "sfx_fre0" & i & " (free slot)" - Else - addstring = number & " - " & "sfx_fre" & i & " (free slot)" - End If - cmbSeesound.AddItem addstring - cmbAttacksound.AddItem addstring - cmbPainsound.AddItem addstring - cmbDeathsound.AddItem addstring - cmbActivesound.AddItem addstring - number = number + 1 - Next -End Sub -Private Sub LoadStates() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim i As Integer - Dim numfreeslots As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Object states (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbSpawnstate.Clear - cmbSeestate.Clear - cmbPainstate.Clear - cmbMeleestate.Clear - cmbMissilestate.Clear - cmbDeathstate.Clear - cmbXdeathstate.Clear - cmbRaisestate.Clear - - Do While InStr(line, "S_FIRSTFREESLOT") = 0 - startclip = InStr(line, "S_") - If InStr(line, "S_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbSpawnstate.AddItem addstring - cmbSeestate.AddItem addstring - cmbPainstate.AddItem addstring - cmbMeleestate.AddItem addstring - cmbMissilestate.AddItem addstring - cmbDeathstate.AddItem addstring - cmbXdeathstate.AddItem addstring - cmbRaisestate.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) * 6 - - For i = 1 To numfreeslots - addstring = number & " - " & "S_FREESLOT" & i - cmbSpawnstate.AddItem addstring - cmbSeestate.AddItem addstring - cmbPainstate.AddItem addstring - cmbMeleestate.AddItem addstring - cmbMissilestate.AddItem addstring - cmbDeathstate.AddItem addstring - cmbXdeathstate.AddItem addstring - cmbRaisestate.AddItem addstring - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadThings() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Little flag for SOC editor (don't change this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstThings.Clear - - Do While InStr(line, "MT_FIRSTFREESLOT") = 0 - startclip = InStr(line, "MT_") - If InStr(line, "MT_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - lstThings.AddItem number & " - " & line - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) - - For i = 1 To numfreeslots - lstThings.AddItem number & " - " & "MT_FREESLOT" & i - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadObjectInfo(ThingNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.c", ForReading, False) - - Do While InStr(ts.ReadLine, "mobjinfo[NUMMOBJTYPES] =") = 0 - Loop - - number = 0 - - Do While number <> ThingNum - Do While InStr(ts.ReadLine, "}") = 0 - Loop - number = number + 1 - Loop - - Do While InStr(line, "doomednum") = 0 - line = ts.ReadLine - Loop - - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtDoomednum.Text = line - - line = ts.ReadLine - Do While InStr(line, "spawnstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbSpawnstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbSpawnstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbSpawnstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "spawnhealth") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtSpawnhealth.Text = line - - line = ts.ReadLine - Do While InStr(line, "seestate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbSeestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbSeestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbSeestate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "seesound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbSeesound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbSeesound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbSeesound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "reactiontime") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtReactiontime.Text = line - - line = ts.ReadLine - Do While InStr(line, "attacksound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbAttacksound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbAttacksound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbAttacksound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "painstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbPainstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbPainstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbPainstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "painchance") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtPainchance.Text = line - - line = ts.ReadLine - Do While InStr(line, "painsound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbPainsound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbPainsound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbPainsound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "meleestate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbMeleestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbMeleestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbMeleestate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "missilestate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbMissilestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbMissilestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbMissilestate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "deathstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbDeathstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbDeathstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbDeathstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "xdeathstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbXdeathstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbXdeathstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbXdeathstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "deathsound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbDeathsound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbDeathsound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbDeathsound.Text = number & " - " & line - End If - - - line = ts.ReadLine - Do While InStr(line, "speed") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtSpeed.Text = line - - line = ts.ReadLine - Do While InStr(line, "radius") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtRadius.Text = line - - line = ts.ReadLine - Do While InStr(line, "height") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtHeight.Text = line - - line = ts.ReadLine 'Display order offset (add support, please!) - - line = ts.ReadLine - Do While InStr(line, "mass") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtMass.Text = line - - line = ts.ReadLine - Do While InStr(line, "damage") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtDamage.Text = line - - line = ts.ReadLine - Do While InStr(line, "activesound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbActivesound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbActivesound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbActivesound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "flags") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - ProcessFlags (line) - - line = ts.ReadLine - Do While InStr(line, "raisestate") = 0 - Loop - endclip = InStr(line, "//") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbRaisestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbRaisestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbRaisestate.Text = number & " - " & line - End If - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ProcessFlags(flags As String) - Dim FlagList(32) As String - Dim endpoint As Integer - Dim ListCount As Integer - Dim FlagString As String - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim j As Integer, i As Integer - Dim number As Long - Dim startclip As Integer, endclip As Integer - - For j = 0 To 26 - chkFlags(j).Value = 0 - Next j - - FlagString = flags - - flags = flags & "||" - - ListCount = 0 - - Do While Len(flags) > 3 - endpoint = InStr(flags, "|") - FlagString = Left(flags, endpoint - 1) - flags = Right(flags, Len(flags) - endpoint) - FlagList(ListCount) = FlagString - ListCount = ListCount + 1 - Loop - - ChDir SourcePath - - For i = 0 To ListCount - 1 - Set ts = myFSO.OpenTextFile("p_mobj.h", ForReading, False) - - line = ts.ReadLine - - Do While Not ts.AtEndOfStream - line = ts.ReadLine - If InStr(line, FlagList(i)) Then - If InStr(line, "//") = 0 Or (InStr(line, "//") > InStr(line, FlagList(i))) Then - Exit Do - End If - End If - Loop - - If InStr(line, FlagList(i)) Then - startclip = InStr(line, "0x") - endclip = InStr(line, ",") - line = Mid(line, startclip + 2, endclip - 1) - line = "&H" & line - TrimComplete (line) - line = Left(line, Len(line) - 1) - number = CLng(line) - - For j = 0 To 26 - If chkFlags(j).Tag = number Then - chkFlags(j).Value = 1 - End If - Next j - End If - ts.Close - Next i - - Set myFSO = Nothing -End Sub - -Private Sub FindComboIndex(ByRef Box As ComboBox, line As String) - Dim i As Integer - - For i = 0 To Box.ListCount - If InStr(Box.List(i), line) Then - Box.ListIndex = i - Exit For - End If - Next -End Sub - -Private Sub lstThings_Click() - lblStatusInfo.Caption = "Loading thing info..." - DoEvents - Call ClearForm - If InStr(lstThings.List(lstThings.ListIndex), "MT_FREESLOT") = 0 Then - LoadObjectInfo (lstThings.ListIndex) - End If - LoadSOCObjectInfo (lstThings.ListIndex) - lblStatusInfo.Caption = "Idle" -End Sub - -Private Sub LoadSOCObjectInfo(ThingNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim j As Integer - Dim temp As Long - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "THING" And Val(word2) = ThingNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "MAPTHINGNUM" Then - txtDoomednum.Text = Val(word2) - ElseIf word = "SPAWNSTATE" Then - cmbSpawnstate.ListIndex = Val(word2) - ElseIf word = "SPAWNHEALTH" Then - txtSpawnhealth.Text = Val(word2) - ElseIf word = "SEESTATE" Then - cmbSeestate.ListIndex = Val(word2) - ElseIf word = "SEESOUND" Then - cmbSeesound.ListIndex = Val(word2) - ElseIf word = "REACTIONTIME" Then - txtReactiontime.Text = Val(word2) - ElseIf word = "ATTACKSOUND" Then - cmbAttacksound.ListIndex = Val(word2) - ElseIf word = "PAINSTATE" Then - cmbPainstate.ListIndex = Val(word2) - ElseIf word = "PAINCHANCE" Then - txtPainchance.Text = Val(word2) - ElseIf word = "PAINSOUND" Then - cmbPainsound.ListIndex = Val(word2) - ElseIf word = "MELEESTATE" Then - cmbMeleestate.ListIndex = Val(word2) - ElseIf word = "MISSILESTATE" Then - cmbMissilestate.ListIndex = Val(word2) - ElseIf word = "DEATHSTATE" Then - cmbDeathstate.ListIndex = Val(word2) - ElseIf word = "DEATHSOUND" Then - cmbDeathsound.ListIndex = Val(word2) - ElseIf word = "XDEATHSTATE" Then - cmbXdeathstate.ListIndex = Val(word2) - ElseIf word = "SPEED" Then - txtSpeed.Text = Val(word2) - ElseIf word = "RADIUS" Then - txtRadius.Text = Val(word2) - ElseIf word = "HEIGHT" Then - txtHeight.Text = Val(word2) - ElseIf word = "MASS" Then - txtMass.Text = Val(word2) - ElseIf word = "DAMAGE" Then - txtDamage.Text = Val(word2) - ElseIf word = "ACTIVESOUND" Then - cmbActivesound.ListIndex = Val(word2) - ElseIf word = "FLAGS" Then - For j = 0 To 26 - temp = Val(word2) - If temp And chkFlags(j).Tag Then - chkFlags(j).Value = 1 - Else - chkFlags(j).Value = 0 - End If - Next j - ElseIf word = "RAISESTATE" Then - cmbRaisestate.ListIndex = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Function FindThingNum(ThingName As String) As Integer - Dim i As Integer - Dim temp As String - Dim startpoint As Integer - Dim endpoint As Integer - - For i = 0 To lstThings.ListCount - 1 - temp = lstThings.List(i) - startpoint = InStr(temp, "-") + 2 - endpoint = Len(temp) - startpoint + 1 - temp = Mid(temp, startpoint, endpoint) - If temp = ThingName Then - FindThingNum = Val(lstThings.List(i)) - Exit For - End If - Next -End Function - -Private Function FindPowerNum(PowerName As String) As Integer - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("d_player.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Player powers. (don't edit this comment)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - Do While InStr(line, "NUMPOWERS") = 0 - startclip = InStr(line, PowerName) - If startclip <> 0 Then - FindPowerNum = number - Exit Do - End If - number = number + 1 - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Function - -Private Sub WriteThing(Remove As Boolean, num As Integer) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim thingfound As Boolean - Dim i As Integer - - thingfound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current thing exists in the SOC, delete it. - If word = "THING" And Val(word2) = num Then - thingfound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - tsTarget.WriteLine "Thing " & num - txtDoomednum.Text = TrimComplete(txtDoomednum.Text) - cmbSpawnstate.Text = TrimComplete(cmbSpawnstate.Text) - txtSpawnhealth.Text = TrimComplete(txtSpawnhealth.Text) - cmbSeestate.Text = TrimComplete(cmbSeestate.Text) - cmbSeesound.Text = TrimComplete(cmbSeesound.Text) - txtReactiontime.Text = TrimComplete(txtReactiontime.Text) - cmbAttacksound.Text = TrimComplete(cmbAttacksound.Text) - cmbPainstate.Text = TrimComplete(cmbPainstate.Text) - txtPainchance.Text = TrimComplete(txtPainchance.Text) - cmbPainsound.Text = TrimComplete(cmbPainsound.Text) - cmbMeleestate.Text = TrimComplete(cmbMeleestate.Text) - cmbMissilestate.Text = TrimComplete(cmbMissilestate.Text) - cmbDeathstate.Text = TrimComplete(cmbDeathstate.Text) - cmbDeathsound.Text = TrimComplete(cmbDeathsound.Text) - cmbXdeathstate.Text = TrimComplete(cmbXdeathstate.Text) - txtSpeed.Text = TrimComplete(txtSpeed.Text) - txtRadius.Text = TrimComplete(txtRadius.Text) - txtHeight.Text = TrimComplete(txtHeight.Text) - txtMass.Text = TrimComplete(txtMass.Text) - txtDamage.Text = TrimComplete(txtDamage.Text) - cmbActivesound.Text = TrimComplete(cmbActivesound.Text) - cmbRaisestate.Text = TrimComplete(cmbRaisestate.Text) - flags = 0 - ' Only 31 bits can be used, because VB is stupid. - For i = 0 To 26 - If chkFlags(i).Value = 1 Then flags = flags + Val(chkFlags(i).Tag) - Next - If txtDoomednum.Text <> "" Then tsTarget.WriteLine "MAPTHINGNUM = " & Val(txtDoomednum.Text) - If cmbSpawnstate.Text <> "" Then tsTarget.WriteLine "SPAWNSTATE = " & Val(cmbSpawnstate.Text) - If txtSpawnhealth.Text <> "" Then tsTarget.WriteLine "SPAWNHEALTH = " & Val(txtSpawnhealth.Text) - If cmbSeestate.Text <> "" Then tsTarget.WriteLine "SEESTATE = " & Val(cmbSeestate.Text) - If cmbSeesound.Text <> "" Then tsTarget.WriteLine "SEESOUND = " & Val(cmbSeesound.Text) - If txtReactiontime.Text <> "" Then tsTarget.WriteLine "REACTIONTIME = " & Val(txtReactiontime.Text) - If cmbAttacksound.Text <> "" Then tsTarget.WriteLine "ATTACKSOUND = " & Val(cmbAttacksound.Text) - If cmbPainstate.Text <> "" Then tsTarget.WriteLine "PAINSTATE = " & Val(cmbPainstate.Text) - If txtPainchance.Text <> "" Then tsTarget.WriteLine "PAINCHANCE = " & Val(txtPainchance.Text) - If cmbPainsound.Text <> "" Then tsTarget.WriteLine "PAINSOUND = " & Val(cmbPainsound.Text) - If cmbMeleestate.Text <> "" Then tsTarget.WriteLine "MELEESTATE = " & Val(cmbMeleestate.Text) - If cmbMissilestate.Text <> "" Then tsTarget.WriteLine "MISSILESTATE = " & Val(cmbMissilestate.Text) - If cmbDeathstate.Text <> "" Then tsTarget.WriteLine "DEATHSTATE = " & Val(cmbDeathstate.Text) - If cmbDeathsound.Text <> "" Then tsTarget.WriteLine "DEATHSOUND = " & Val(cmbDeathsound.Text) - If cmbXdeathstate.Text <> "" Then tsTarget.WriteLine "XDEATHSTATE = " & Val(cmbXdeathstate.Text) - If txtSpeed.Text <> "" Then tsTarget.WriteLine "SPEED = " & Val(txtSpeed.Text) - If txtRadius.Text <> "" Then tsTarget.WriteLine "RADIUS = " & Val(txtRadius.Text) - If txtHeight.Text <> "" Then tsTarget.WriteLine "HEIGHT = " & Val(txtHeight.Text) - If txtMass.Text <> "" Then tsTarget.WriteLine "MASS = " & Val(txtMass.Text) - If txtDamage.Text <> "" Then tsTarget.WriteLine "DAMAGE = " & Val(txtDamage.Text) - If cmbActivesound.Text <> "" Then tsTarget.WriteLine "ACTIVESOUND = " & Val(cmbActivesound.Text) - If cmbRaisestate.Text <> "" Then tsTarget.WriteLine "RAISESTATE = " & Val(cmbRaisestate.Text) - tsTarget.WriteLine "FLAGS = " & flags - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If thingfound = True Then - MsgBox "Thing removed from SOC." - Else - MsgBox "Thing not found in SOC." - End If - Else - MsgBox "Thing Saved." - End If -End Sub diff --git a/tools/SOCEdit/Things.frx b/tools/SOCEdit/Things.frx deleted file mode 100644 index 980538679..000000000 Binary files a/tools/SOCEdit/Things.frx and /dev/null differ diff --git a/tools/SOCEdit/frmCharacterEdit.frm b/tools/SOCEdit/frmCharacterEdit.frm deleted file mode 100644 index 415fcbb0f..000000000 --- a/tools/SOCEdit/frmCharacterEdit.frm +++ /dev/null @@ -1,320 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmCharacterEdit - Caption = "Character Edit" - ClientHeight = 3345 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 4680 - Icon = "frmCharacterEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 3345 - ScaleWidth = 4680 - Begin VB.CommandButton cmdExample - Caption = "Show Me An &Example" - Height = 495 - Left = 1320 - Style = 1 'Graphical - TabIndex = 14 - Top = 2400 - Width = 975 - End - Begin VB.CheckBox chkEnabled - Caption = "Enable this player selection." - Height = 495 - Left = 1080 - TabIndex = 13 - Top = 1560 - Width = 1455 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete from SOC" - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 12 - Top = 2760 - Width = 855 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 120 - TabIndex = 11 - Top = 2160 - Width = 855 - End - Begin VB.TextBox txtSkinname - Height = 285 - Left = 3240 - TabIndex = 9 - Top = 1200 - Width = 1335 - End - Begin VB.TextBox txtPicname - Height = 285 - Left = 3240 - MaxLength = 8 - TabIndex = 7 - Top = 840 - Width = 1095 - End - Begin VB.TextBox txtMenuposition - Height = 285 - Left = 3240 - MaxLength = 3 - TabIndex = 5 - Top = 480 - Width = 495 - End - Begin VB.TextBox txtPlayername - Height = 285 - Left = 3240 - MaxLength = 64 - TabIndex = 3 - Top = 120 - Width = 1335 - End - Begin VB.TextBox txtPlayertext - Height = 1455 - Left = 2640 - MultiLine = -1 'True - TabIndex = 1 - Top = 1800 - Width = 1935 - End - Begin VB.ListBox lstPlayers - Height = 1815 - ItemData = "frmCharacterEdit.frx":0442 - Left = 120 - List = "frmCharacterEdit.frx":0461 - TabIndex = 0 - Top = 240 - Width = 855 - End - Begin VB.Label lblSkinname - Caption = "Name of player (skin) to use:" - Height = 255 - Left = 1080 - TabIndex = 10 - Top = 1200 - Width = 2055 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture to display:" - Height = 255 - Left = 1560 - TabIndex = 8 - Top = 840 - Width = 1575 - End - Begin VB.Label lblMenuposition - Alignment = 1 'Right Justify - Caption = "Vertical menu position:" - Height = 255 - Left = 1320 - TabIndex = 6 - Top = 480 - Width = 1815 - End - Begin VB.Label lblPlayername - Alignment = 1 'Right Justify - Caption = "Displayed name of player:" - Height = 255 - Left = 1320 - TabIndex = 4 - Top = 120 - Width = 1815 - End - Begin VB.Label lblPlayertext - Caption = "Short Description:" - Height = 255 - Left = 2640 - TabIndex = 2 - Top = 1560 - Width = 1455 - End -End -Attribute VB_Name = "frmCharacterEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdDelete_Click() - Call WriteCharacter(True) -End Sub - -Private Sub cmdExample_Click() - txtPlayername.Text = "SONIC" - txtMenuposition.Text = "20" - txtPicname.Text = "SONCCHAR" - txtSkinname.Text = "SONIC" - chkEnabled.Value = 1 - txtPlayertext.Text = " Fastest" & vbCrLf & " Speed Thok" & vbCrLf & " Not a good pick" & vbCrLf & "for starters, but when" & vbCrLf & "controlled properly," & vbCrLf & "Sonic is the most" & vbCrLf & "powerful of the three." -End Sub - -Private Sub cmdSave_Click() - Call WriteCharacter(False) -End Sub - -Private Sub ClearForm() - txtPlayername.Text = "" - txtMenuposition.Text = "" - txtPicname.Text = "" - txtSkinname.Text = "" - chkEnabled.Value = 0 - txtPlayertext.Text = "" -End Sub - -Private Sub ReadSOCPlayer(num As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "CHARACTER" And Val(word2) = num Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "PLAYERTEXT" Then - Dim startclip As Integer, endclip As Integer - startclip = InStr(line, "=") - - startclip = startclip + 2 - - line = Mid(line, startclip, Len(line)) - - txtPlayertext.Text = line & vbCrLf - - Do While InStr(line, "#") = 0 And Not ts.AtEndOfStream - line = ts.ReadLine & vbCrLf - txtPlayertext.Text = txtPlayertext.Text & line - Loop - - txtPlayertext.Text = RTrimComplete(txtPlayertext.Text) - If Right(txtPlayertext.Text, 1) = "#" Then - txtPlayertext.Text = Left(txtPlayertext.Text, Len(txtPlayertext.Text) - 1) - End If - ElseIf word = "PLAYERNAME" Then - txtPlayername.Text = word2 - ElseIf word = "MENUPOSITION" Then - txtMenuposition.Text = Val(word2) - ElseIf word = "PICNAME" Then - txtPicname.Text = word2 - ElseIf word = "STATUS" Then - If Val(word2) = 32 Then - chkEnabled.Value = 1 - Else - chkEnabled.Value = 0 - End If - ElseIf word = "SKINNAME" Then - txtSkinname.Text = word2 - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstPlayers_Click() - Call ClearForm - Call ReadSOCPlayer(lstPlayers.ListIndex) -End Sub - -Private Sub WriteCharacter(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim charfound As Boolean - - charfound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current character exists in the SOC, delete it. - If word = "CHARACTER" And Val(word2) = lstPlayers.ListIndex Then - charfound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "CHARACTER " & lstPlayers.ListIndex - txtPlayername.Text = TrimComplete(txtPlayername.Text) - txtMenuposition.Text = TrimComplete(txtMenuposition.Text) - txtPicname.Text = TrimComplete(txtPicname.Text) - txtSkinname.Text = TrimComplete(txtSkinname.Text) - If txtPlayername.Text <> "" Then tsTarget.WriteLine "PLAYERNAME = " & txtPlayername.Text - If txtMenuposition.Text <> "" Then tsTarget.WriteLine "MENUPOSITION = " & Val(txtMenuposition.Text) - If txtPicname.Text <> "" Then tsTarget.WriteLine "PICNAME = " & txtPicname.Text - If txtSkinname.Text <> "" Then tsTarget.WriteLine "SKINNAME = " & txtSkinname.Text - If chkEnabled.Value = 1 Then - tsTarget.WriteLine "STATUS = 32" - Else - tsTarget.WriteLine "STATUS = 0" - End If - If txtPlayertext.Text <> "" Then tsTarget.WriteLine "PLAYERTEXT = " & txtPlayertext.Text & "#" - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If charfound = True Then - MsgBox "Player choice removed from SOC." - Else - MsgBox "Player choice not found in SOC." - End If - Else - MsgBox "Character Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmCharacterEdit.frx b/tools/SOCEdit/frmCharacterEdit.frx deleted file mode 100644 index 5e767f4ab..000000000 Binary files a/tools/SOCEdit/frmCharacterEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmCutsceneEdit.frm b/tools/SOCEdit/frmCutsceneEdit.frm deleted file mode 100644 index 7fb18feed..000000000 --- a/tools/SOCEdit/frmCutsceneEdit.frm +++ /dev/null @@ -1,1365 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmCutsceneEdit - Caption = "Cutscene Edit" - ClientHeight = 6495 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 10410 - Icon = "frmCutsceneEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 6495 - ScaleWidth = 10410 - StartUpPosition = 3 'Windows Default - Begin VB.TextBox txtNumScenes - Height = 285 - Left = 3480 - MaxLength = 3 - TabIndex = 97 - Top = 240 - Width = 615 - End - Begin VB.ListBox lstScene - Height = 450 - ItemData = "frmCutsceneEdit.frx":0442 - Left = 3360 - List = "frmCutsceneEdit.frx":0444 - TabIndex = 94 - Top = 600 - Width = 735 - End - Begin VB.ComboBox cmbMusicslot - Height = 315 - Left = 8760 - TabIndex = 93 - Top = 1680 - Width = 1575 - End - Begin VB.Frame frmPic1 - Caption = "Picture 8:" - Height = 1335 - Index = 7 - Left = 7440 - TabIndex = 80 - Top = 5040 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 7 - Left = 600 - MaxLength = 3 - TabIndex = 85 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 7 - Left = 600 - MaxLength = 3 - TabIndex = 84 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 7 - Left = 2040 - MaxLength = 5 - TabIndex = 83 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 7 - Left = 1320 - TabIndex = 82 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 7 - Left = 1320 - TabIndex = 81 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 7 - Left = 240 - TabIndex = 89 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 7 - Left = 240 - TabIndex = 88 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 7 - Left = 1200 - TabIndex = 87 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 7 - Left = 120 - TabIndex = 86 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 7:" - Height = 1335 - Index = 6 - Left = 4440 - TabIndex = 70 - Top = 5040 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 6 - Left = 600 - MaxLength = 3 - TabIndex = 75 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 6 - Left = 600 - MaxLength = 3 - TabIndex = 74 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 6 - Left = 2040 - MaxLength = 5 - TabIndex = 73 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 6 - Left = 1320 - TabIndex = 72 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 6 - Left = 1320 - TabIndex = 71 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 6 - Left = 240 - TabIndex = 79 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 6 - Left = 240 - TabIndex = 78 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 6 - Left = 1200 - TabIndex = 77 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 6 - Left = 120 - TabIndex = 76 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 6:" - Height = 1335 - Index = 5 - Left = 7440 - TabIndex = 60 - Top = 3600 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 5 - Left = 600 - MaxLength = 3 - TabIndex = 65 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 5 - Left = 600 - MaxLength = 3 - TabIndex = 64 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 5 - Left = 2040 - MaxLength = 5 - TabIndex = 63 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 5 - Left = 1320 - TabIndex = 62 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 5 - Left = 1320 - TabIndex = 61 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 5 - Left = 240 - TabIndex = 69 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 5 - Left = 240 - TabIndex = 68 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 5 - Left = 1200 - TabIndex = 67 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 5 - Left = 120 - TabIndex = 66 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 5:" - Height = 1335 - Index = 4 - Left = 4440 - TabIndex = 50 - Top = 3600 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 4 - Left = 600 - MaxLength = 3 - TabIndex = 55 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 4 - Left = 600 - MaxLength = 3 - TabIndex = 54 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 4 - Left = 2040 - MaxLength = 5 - TabIndex = 53 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 4 - Left = 1320 - TabIndex = 52 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 4 - Left = 1320 - TabIndex = 51 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 4 - Left = 240 - TabIndex = 59 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 4 - Left = 240 - TabIndex = 58 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 4 - Left = 1200 - TabIndex = 57 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 4 - Left = 120 - TabIndex = 56 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 4:" - Height = 1335 - Index = 3 - Left = 1440 - TabIndex = 40 - Top = 3600 - Width = 2895 - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 3 - Left = 1320 - TabIndex = 45 - Top = 960 - Width = 1455 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 3 - Left = 1320 - TabIndex = 44 - Top = 240 - Width = 1455 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 3 - Left = 2040 - MaxLength = 5 - TabIndex = 43 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 3 - Left = 600 - MaxLength = 3 - TabIndex = 42 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 3 - Left = 600 - MaxLength = 3 - TabIndex = 41 - Top = 960 - Width = 495 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 3 - Left = 120 - TabIndex = 49 - Top = 240 - Width = 1095 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 3 - Left = 1200 - TabIndex = 48 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 3 - Left = 240 - TabIndex = 47 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 3 - Left = 240 - TabIndex = 46 - Top = 960 - Width = 255 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 3:" - Height = 1335 - Index = 2 - Left = 7440 - TabIndex = 30 - Top = 2160 - Width = 2895 - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 2 - Left = 1320 - TabIndex = 35 - Top = 960 - Width = 1455 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 2 - Left = 1320 - TabIndex = 34 - Top = 240 - Width = 1455 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 2 - Left = 2040 - MaxLength = 5 - TabIndex = 33 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 2 - Left = 600 - MaxLength = 3 - TabIndex = 32 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 2 - Left = 600 - MaxLength = 3 - TabIndex = 31 - Top = 960 - Width = 495 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 2 - Left = 120 - TabIndex = 39 - Top = 240 - Width = 1095 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 2 - Left = 1200 - TabIndex = 38 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 2 - Left = 240 - TabIndex = 37 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 2 - Left = 240 - TabIndex = 36 - Top = 960 - Width = 255 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 2:" - Height = 1335 - Index = 1 - Left = 4440 - TabIndex = 20 - Top = 2160 - Width = 2895 - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 1 - Left = 1320 - TabIndex = 25 - Top = 960 - Width = 1455 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 1 - Left = 1320 - TabIndex = 24 - Top = 240 - Width = 1455 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 1 - Left = 2040 - MaxLength = 5 - TabIndex = 23 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 1 - Left = 600 - MaxLength = 3 - TabIndex = 22 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 1 - Left = 600 - MaxLength = 3 - TabIndex = 21 - Top = 960 - Width = 495 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 29 - Top = 240 - Width = 1095 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 1 - Left = 1200 - TabIndex = 28 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 1 - Left = 240 - TabIndex = 27 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 1 - Left = 240 - TabIndex = 26 - Top = 960 - Width = 255 - End - End - Begin VB.TextBox txtTextypos - Height = 285 - Left = 3120 - MaxLength = 3 - TabIndex = 19 - Top = 5880 - Width = 615 - End - Begin VB.TextBox txtTextxpos - Height = 285 - Left = 3120 - MaxLength = 3 - TabIndex = 18 - Top = 5520 - Width = 615 - End - Begin VB.Frame frmPic1 - Caption = "Picture 1:" - Height = 1335 - Index = 0 - Left = 1440 - TabIndex = 6 - Top = 2160 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 0 - Left = 600 - MaxLength = 3 - TabIndex = 14 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 0 - Left = 600 - MaxLength = 3 - TabIndex = 12 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 0 - Left = 2040 - MaxLength = 5 - TabIndex = 11 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 0 - Left = 1320 - TabIndex = 8 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 0 - Left = 1320 - TabIndex = 7 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 0 - Left = 240 - TabIndex = 15 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 0 - Left = 240 - TabIndex = 13 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 0 - Left = 1200 - TabIndex = 10 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 0 - Left = 120 - TabIndex = 9 - Top = 240 - Width = 1095 - End - End - Begin VB.TextBox txtNumberofpics - Height = 285 - Left = 3840 - MaxLength = 1 - TabIndex = 5 - Top = 1800 - Width = 375 - End - Begin VB.TextBox txtScenetext - Height = 1815 - Left = 4440 - MultiLine = -1 'True - TabIndex = 3 - Top = 240 - Width = 3135 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Scene" - Height = 495 - Left = 3360 - Style = 1 'Graphical - TabIndex = 1 - Top = 1200 - Width = 855 - End - Begin VB.ListBox lstCutscenes - Height = 6300 - ItemData = "frmCutsceneEdit.frx":0446 - Left = 120 - List = "frmCutsceneEdit.frx":0448 - TabIndex = 0 - Top = 120 - Width = 1215 - End - Begin VB.Label Label3 - Caption = "Note: The cutscene editor is not fully functional. Only use it to get an idea of the proper syntax to use." - BeginProperty Font - Name = "MS Sans Serif" - Size = 9.75 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 1335 - Left = 7680 - TabIndex = 98 - Top = 240 - Width = 2655 - End - Begin VB.Label Label2 - Caption = "For Scene Text:" - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 400 - Underline = -1 'True - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 255 - Left = 1560 - TabIndex = 96 - Top = 5160 - Width = 1695 - End - Begin VB.Label Label1 - Caption = "Enter all time durations in game tics (35 = 1 second)" - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 855 - Left = 1560 - TabIndex = 95 - Top = 960 - Width = 1335 - End - Begin VB.Label lblMusicslot - Alignment = 1 'Right Justify - Caption = "Music to play:" - Height = 255 - Left = 7680 - TabIndex = 92 - Top = 1680 - Width = 975 - End - Begin VB.Label lblCurrentScene - Alignment = 1 'Right Justify - Caption = "Current Scene:" - Height = 255 - Left = 1920 - TabIndex = 91 - Top = 720 - Width = 1215 - End - Begin VB.Label lblNumScenes - Alignment = 1 'Right Justify - Caption = "Number of Scenes in this Cutscene:" - Height = 375 - Left = 1440 - TabIndex = 90 - Top = 120 - Width = 1935 - End - Begin VB.Label lblTextypos - Alignment = 1 'Right Justify - Caption = "Text Y Position:" - Height = 255 - Left = 1800 - TabIndex = 17 - Top = 5880 - Width = 1215 - End - Begin VB.Label lblTextxpos - Alignment = 1 'Right Justify - Caption = "Text X Position:" - Height = 255 - Left = 1800 - TabIndex = 16 - Top = 5520 - Width = 1215 - End - Begin VB.Label lblNumberofpics - Alignment = 1 'Right Justify - Caption = "Number of Pictures (max 8):" - Height = 255 - Left = 1560 - TabIndex = 4 - Top = 1800 - Width = 2175 - End - Begin VB.Label lblScenetext - Caption = "Scene Text:" - Height = 255 - Left = 4440 - TabIndex = 2 - Top = 0 - Width = 1215 - End -End -Attribute VB_Name = "frmCutsceneEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdSave_Click() - Call WriteScene(False) -End Sub - -Private Sub lstScene_Click() - Call ClearForm - Call LoadSOCCutscene(Val(lstCutscenes.List(lstCutscenes.ListIndex)), Val(lstScene.List(lstScene.ListIndex))) -End Sub - -Private Sub LoadMusic() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Music list (don't edit this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbMusicslot.Clear - - Do While InStr(line, "NUMMUSIC") = 0 - startclip = InStr(line, "mus_") - If InStr(line, "mus_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbMusicslot.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub cmdReload_Click() - Call Reload -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub Reload() - ClearForm - Call ReadCutsceneSOCNumbers - Call LoadMusic - If lstCutscenes.ListCount > 0 Then - lstCutscenes.ListIndex = 0 - End If -End Sub - -Private Sub LoadSOCCutscene(CutNum As Integer, SceneNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim ind As Integer - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - ' WOW! This looks fun, don't it?! - If UCase(word) = "CUTSCENE" And Val(word2) = CutNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "NUMSCENES" Then - txtNumScenes.Text = Val(word2) - ElseIf UCase(word) = "SCENE" And Val(word2) = SceneNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SCENETEXT" Then - Dim startclip As Integer, endclip As Integer - startclip = InStr(line, "=") - - startclip = startclip + 2 - - line = Mid(line, startclip, Len(line)) - - txtScenetext.Text = line & vbCrLf - - Do While InStr(line, "#") = 0 And Not ts.AtEndOfStream - line = ts.ReadLine & vbCrLf - txtScenetext.Text = txtScenetext.Text & line - Loop - - txtScenetext.Text = RTrimComplete(txtScenetext.Text) - If Right(txtScenetext.Text, 1) = "#" Then - txtScenetext.Text = Left(txtScenetext.Text, Len(txtScenetext.Text) - 1) - End If - ElseIf word = "PIC1NAME" Or word = "PIC2NAME" Or word = "PIC3NAME" Or word = "PIC4NAME" Or word = "PIC5NAME" Or word = "PIC6NAME" Or word = "PIC7NAME" Or word = "PIC8NAME" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicname(ind).Text = word2 - ElseIf word = "PIC1HIRES" Or word = "PIC2HIRES" Or word = "PIC3HIRES" Or word = "PIC4HIRES" Or word = "PIC5HIRES" Or word = "PIC6HIRES" Or word = "PIC7HIRES" Or word = "PIC8HIRES" Then - ind = Val(Mid(word, 4, 1)) - 1 - chkPichires(ind).Value = Val(word2) - ElseIf word = "PIC1DURATION" Or word = "PIC2DURATION" Or word = "PIC3DURATION" Or word = "PIC4DURATION" Or word = "PIC5DURATION" Or word = "PIC6DURATION" Or word = "PIC7DURATION" Or word = "PIC8DURATION" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicduration(ind).Text = Val(word2) - ElseIf word = "PIC1XCOORD" Or word = "PIC2XCOORD" Or word = "PIC3XCOORD" Or word = "PIC4XCOORD" Or word = "PIC5XCOORD" Or word = "PIC6XCOORD" Or word = "PIC7XCOORD" Or word = "PIC8XCOORD" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicXcoord(ind).Text = Val(word2) - ElseIf word = "PIC1YCOORD" Or word = "PIC2YCOORD" Or word = "PIC3YCOORD" Or word = "PIC4YCOORD" Or word = "PIC5YCOORD" Or word = "PIC6YCOORD" Or word = "PIC7YCOORD" Or word = "PIC8YCOORD" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicycoord(ind).Text = Val(word2) - ElseIf word = "TEXTXPOS" Then - txtTextxpos.Text = Val(word2) - ElseIf word = "TEXTYPOS" Then - txtTextypos.Text = Val(word2) - ElseIf word = "MUSICSLOT" Then - cmbMusicslot.ListIndex = Val(word2) - ElseIf word = "NUMBEROFPICS" Then - txtNumberofpics.Text = Val(word2) - ElseIf word = "SCENE" Then 'End of scene data - line = "" - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ReadCutsceneSOCNumbers() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - - lstCutscenes.Clear - -CutsceneLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo CutsceneLoad - - If Left(line, 1) = vbCrLf Then GoTo CutsceneLoad - - If Len(line) < 1 Then GoTo CutsceneLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "CUTSCENE" Then - lstCutscenes.AddItem (Val(word2)) - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ClearForm() - Dim i As Integer - - For i = 0 To 7 - chkPichires(i).Value = 0 - txtPicXcoord(i).Text = "" - txtPicycoord(i).Text = "" - txtPicname(i).Text = "" - txtPicduration(i).Text = "" - Next - - txtScenetext.Text = "" - txtNumberofpics.Text = "" - txtTextxpos.Text = "" - txtTextypos.Text = "" - cmbMusicslot.Text = "" -End Sub - -Private Sub lstCutscenes_Click() - Dim i As Integer - - LoadNumScenes (Val(lstCutscenes.List(lstCutscenes.ListIndex))) - - lstScene.Clear - For i = 1 To Val(txtNumScenes.Text) - lstScene.AddItem i - Next - - If Val(txtNumScenes) > 0 Then - lstScene.ListIndex = lstScene.ListCount - 1 - lstScene.ListIndex = 0 - End If -End Sub - -Private Sub LoadNumScenes(CutNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim ind As Integer - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - ' WOW! This looks fun, don't it?! - If UCase(word) = "CUTSCENE" And Val(word2) = CutNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "NUMSCENES" Then - txtNumScenes.Text = Val(word2) - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteScene(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim i As Integer - Dim CutsceneNum As Integer - Dim InCutScene As Boolean - Dim scenefound As Boolean - Dim nevercheckagain As Boolean - - ' This whole sub is a mess, but it works, - ' so I'd better not touch it... - scenefound = False - nevercheckagain = False - - InCutScene = False - CutsceneNum = Val(lstCutscenes.List(lstCutscenes.ListIndex)) - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If nevercheckagain = False And word = "CUTSCENE" And Val(word2) = CutsceneNum Then - InCutScene = True - tsTarget.WriteLine "CUTSCENE " & Val(lstCutscenes.List(lstCutscenes.ListIndex)) - tsTarget.WriteLine "NUMSCENES " & Val(txtNumScenes.Text) - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - If word = "NUMSCENES" Then - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - End If - End If - - 'If the current scene exists in the SOC, delete it. - If nevercheckagain = False And InCutScene = True And word = "SCENE" And Val(word2) = Val(lstScene.List(lstScene.ListIndex)) Then - scenefound = True - line = tsSource.ReadLine - Do While (Left(UCase(line), 6) <> "SCENE " And Len(TrimComplete(line)) > 0) And Not (tsSource.AtEndOfStream) - line = tsSource.ReadLine - Loop - If Remove = False Then - tsTarget.WriteLine "SCENE " & Val(lstScene.List(lstScene.ListIndex)) - txtNumberofpics.Text = TrimComplete(txtNumberofpics.Text) - txtTextxpos.Text = TrimComplete(txtTextxpos.Text) - txtTextypos.Text = TrimComplete(txtTextypos.Text) - cmbMusicslot.Text = TrimComplete(cmbMusicslot.Text) - - For i = 0 To 7 - txtPicname(i).Text = TrimComplete(txtPicname(i).Text) - txtPicXcoord(i).Text = TrimComplete(txtPicXcoord(i).Text) - txtPicycoord(i).Text = TrimComplete(txtPicycoord(i).Text) - txtPicduration(i).Text = TrimComplete(txtPicduration(i).Text) - Next - - If txtNumberofpics.Text <> "" Then tsTarget.WriteLine "NUMBEROFPICS = " & Val(txtNumberofpics.Text) - If txtTextxpos.Text <> "" Then tsTarget.WriteLine "TEXTXPOS = " & Val(txtTextxpos.Text) - If txtTextypos.Text <> "" Then tsTarget.WriteLine "TEXTYPOS = " & Val(txtTextypos.Text) - If cmbMusicslot.Text <> "" Then tsTarget.WriteLine "MUSICSLOT = " & Val(cmbMusicslot.Text) - - For i = 0 To 7 - If txtPicname(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "NAME = " & txtPicname(i).Text - - If chkPichires(i).Value = 1 Then tsTarget.WriteLine "PIC" & (i + 1) & "HIRES = 1" - - If txtPicXcoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "XCOORD = " & Val(txtPicXcoord(i).Text) - If txtPicycoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "YCOORD = " & Val(txtPicycoord(i).Text) - If txtPicduration(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "DURATION = " & Val(txtPicduration(i).Text) - Next - If txtScenetext.Text <> "" Then tsTarget.WriteLine "SCENETEXT = " & txtScenetext.Text & "#" - End If - InCutScene = False - nevercheckagain = True - End If - tsTarget.WriteLine line - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False And scenefound = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "CUTSCENE " & Val(lstCutscenes.List(lstCutscenes.ListIndex)) - tsTarget.WriteLine "NUMSCENES " & Val(txtNumScenes.Text) - tsTarget.WriteLine "SCENE " & Val(lstScene.List(lstScene.ListIndex)) - txtNumberofpics.Text = TrimComplete(txtNumberofpics.Text) - txtScenetext.Text = TrimComplete(txtScenetext.Text) - txtTextxpos.Text = TrimComplete(txtTextxpos.Text) - txtTextypos.Text = TrimComplete(txtTextypos.Text) - cmbMusicslot.Text = TrimComplete(cmbMusicslot.Text) - - For i = 0 To 7 - txtPicname(i).Text = TrimComplete(txtPicname(i).Text) - txtPicXcoord(i).Text = TrimComplete(txtPicXcoord(i).Text) - txtPicycoord(i).Text = TrimComplete(txtPicycoord(i).Text) - txtPicduration(i).Text = TrimComplete(txtPicduration(i).Text) - Next - - If txtNumberofpics.Text <> "" Then tsTarget.WriteLine "NUMBEROFPICS = " & Val(txtNumberofpics.Text) - If txtScenetext.Text <> "" Then tsTarget.WriteLine "SCENETEXT = " & txtScenetext.Text & "#" - If txtTextxpos.Text <> "" Then tsTarget.WriteLine "TEXTXPOS = " & Val(txtTextxpos.Text) - If txtTextypos.Text <> "" Then tsTarget.WriteLine "TEXTYPOS = " & Val(txtTextypos.Text) - If cmbMusicslot.Text <> "" Then tsTarget.WriteLine "MUSICSLOT = " & Val(cmbMusicslot.Text) - - For i = 0 To 7 - If txtPicname(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "NAME = " & txtPicname(i).Text - - If chkPichires(i).Value = 1 Then tsTarget.WriteLine "PIC" & (i + 1) & "HIRES = 1" - - If txtPicXcoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "XCOORD = " & Val(txtPicXcoord(i).Text) - If txtPicycoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "YCOORD = " & Val(txtPicycoord(i).Text) - If txtPicduration(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "DURATION = " & Val(txtPicduration(i).Text) - Next - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If scenefound = True Then - MsgBox "Scene removed from SOC." - Else - MsgBox "Scene not found in SOC." - End If - Else - MsgBox "Scene Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmCutsceneEdit.frx b/tools/SOCEdit/frmCutsceneEdit.frx deleted file mode 100644 index 6f844e643..000000000 Binary files a/tools/SOCEdit/frmCutsceneEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmEmblemEdit.frm b/tools/SOCEdit/frmEmblemEdit.frm deleted file mode 100644 index f94255b9c..000000000 --- a/tools/SOCEdit/frmEmblemEdit.frm +++ /dev/null @@ -1,384 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmEmblemEdit - Caption = "Emblem Edit" - ClientHeight = 2865 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 5160 - Icon = "frmEmblemEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 2865 - ScaleWidth = 5160 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdDelete - Caption = "&Delete Last Emblem" - Height = 735 - Left = 1560 - Style = 1 'Graphical - TabIndex = 17 - Top = 600 - Width = 855 - End - Begin VB.CommandButton cmdAdd - Caption = "&Add" - Height = 375 - Left = 1560 - TabIndex = 16 - Top = 120 - Width = 855 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Emblem" - Height = 495 - Left = 4200 - Style = 1 'Graphical - TabIndex = 13 - Top = 2280 - Width = 855 - End - Begin VB.CommandButton cmdReload - Caption = "&Reload" - Height = 495 - Left = 3120 - TabIndex = 12 - Top = 2280 - Width = 975 - End - Begin VB.TextBox txtPlayernum - Height = 285 - Left = 4320 - MaxLength = 3 - TabIndex = 9 - Top = 1800 - Width = 735 - End - Begin VB.TextBox txtMapnum - Height = 285 - Left = 4320 - MaxLength = 4 - TabIndex = 7 - Top = 1320 - Width = 735 - End - Begin VB.TextBox txtZ - Height = 285 - Left = 4320 - MaxLength = 5 - TabIndex = 3 - Top = 960 - Width = 735 - End - Begin VB.TextBox txtY - Height = 285 - Left = 4320 - MaxLength = 5 - TabIndex = 2 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtX - Height = 285 - Left = 4320 - MaxLength = 5 - TabIndex = 1 - Top = 240 - Width = 735 - End - Begin VB.ListBox lstEmblems - Height = 2400 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 1335 - End - Begin VB.Label Label1 - Caption = "Emblem #s must be linear, sorry!" - Height = 495 - Left = 1560 - TabIndex = 18 - Top = 2400 - Width = 1455 - End - Begin VB.Label lblNumEmblems - Caption = "# of Emblems:" - Height = 255 - Left = 120 - TabIndex = 15 - Top = 2520 - Width = 1335 - End - Begin VB.Label lblNote2 - Caption = "Don't forget to set Game Data file and # of Emblems in Global Game Settings!" - Height = 855 - Left = 1560 - TabIndex = 14 - Top = 1440 - Width = 1575 - End - Begin VB.Label lblNote - Appearance = 0 'Flat - BorderStyle = 1 'Fixed Single - Caption = "Note: Enter map coordinates, not game coordinates. (I.e., 128, not 8388608)" - ForeColor = &H80000008& - Height = 1095 - Left = 2640 - TabIndex = 11 - Top = 120 - Width = 1335 - End - Begin VB.Label lblPlayernum - Caption = "Player # (255 for all players):" - Height = 495 - Left = 3240 - TabIndex = 10 - Top = 1680 - Width = 1095 - End - Begin VB.Label lblMapnum - Alignment = 1 'Right Justify - Caption = "Map #:" - Height = 255 - Left = 3600 - TabIndex = 8 - Top = 1320 - Width = 615 - End - Begin VB.Label lblZ - Alignment = 1 'Right Justify - Caption = "Z:" - Height = 255 - Left = 3960 - TabIndex = 6 - Top = 960 - Width = 255 - End - Begin VB.Label lblY - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Left = 3960 - TabIndex = 5 - Top = 600 - Width = 255 - End - Begin VB.Label lblX - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Left = 3960 - TabIndex = 4 - Top = 240 - Width = 255 - End -End -Attribute VB_Name = "frmEmblemEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdAdd_Click() - lstEmblems.AddItem "Emblem " & lstEmblems.ListCount + 1 - lstEmblems.ListIndex = lstEmblems.ListCount - 1 - lblNumEmblems.Caption = "# of Emblems: " & lstEmblems.ListCount - txtX.Text = 0 - txtY.Text = 0 - txtZ.Text = 0 - txtPlayernum.Text = 255 - txtMapnum.Text = 1 -End Sub - -Private Sub cmdDelete_Click() - Call WriteEmblem(True) - lstEmblems.RemoveItem lstEmblems.ListCount - 1 - lstEmblems.ListIndex = lstEmblems.ListCount - 1 - lblNumEmblems.Caption = "# of Emblems: " & lstEmblems.ListCount -End Sub - -Private Sub cmdReload_Click() - Call Reload -End Sub - -Private Sub Reload() - lstEmblems.Clear - txtX.Text = "" - txtY.Text = "" - txtZ.Text = "" - txtMapnum.Text = "" - txtPlayernum.Text = "" - lblNumEmblems.Caption = "# of Emblems: " & lstEmblems.ListCount - Call ReadSOCEmblems -End Sub - -Private Sub cmdSave_Click() - If lstEmblems.ListCount <= 0 Then - MsgBox "You have no emblems to save!" - Else - Call WriteEmblem(False) - End If -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ReadSOCEmblems() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - - lstEmblems.Clear - -EmblemLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo EmblemLoad - - If Left(line, 1) = vbCrLf Then GoTo EmblemLoad - - If Len(line) < 1 Then GoTo EmblemLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "EMBLEM" Then - lstEmblems.AddItem ("Emblem " & Val(word2)) - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ReadSOCEmblemNum(num As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -EmblemLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo EmblemLoad - - If Left(line, 1) = vbCrLf Then GoTo EmblemLoad - - If Len(line) < 1 Then GoTo EmblemLoad - - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "EMBLEM" Then - If Val(word2) = num Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "X" Then - txtX.Text = Val(word2) - ElseIf word = "Y" Then - txtY.Text = Val(word2) - ElseIf word = "Z" Then - txtZ.Text = Val(word2) - ElseIf word = "PLAYERNUM" Then - txtPlayernum.Text = Val(word2) - ElseIf word = "MAPNUM" Then - txtMapnum.Text = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC with Emblem " & num & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstEmblems_Click() - Dim i As Integer - - i = InStr(lstEmblems.List(lstEmblems.ListIndex), " ") + 1 - - i = Mid(lstEmblems.List(lstEmblems.ListIndex), i, Len(lstEmblems.List(lstEmblems.ListIndex)) - i + 1) - i = Val(i) - Call ReadSOCEmblemNum(i) -End Sub - -Private Sub WriteEmblem(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim i As Integer - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - i = InStr(lstEmblems.List(lstEmblems.ListIndex), " ") + 1 - - i = Mid(lstEmblems.List(lstEmblems.ListIndex), i, Len(lstEmblems.List(lstEmblems.ListIndex)) - i + 1) - i = Val(i) - - 'If the current emblem exists in the SOC, delete it. - If word = "EMBLEM" And Val(word2) = i Then - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine UCase(lstEmblems.List(lstEmblems.ListIndex)) - txtX.Text = TrimComplete(txtX.Text) - txtY.Text = TrimComplete(txtY.Text) - txtZ.Text = TrimComplete(txtZ.Text) - txtMapnum.Text = TrimComplete(txtMapnum.Text) - txtPlayernum.Text = TrimComplete(txtPlayernum.Text) - If txtX.Text <> "" Then tsTarget.WriteLine "X = " & Val(txtX.Text) - If txtY.Text <> "" Then tsTarget.WriteLine "Y = " & Val(txtY.Text) - If txtZ.Text <> "" Then tsTarget.WriteLine "Z = " & Val(txtZ.Text) - If txtMapnum.Text <> "" Then tsTarget.WriteLine "MAPNUM = " & Val(txtMapnum.Text) - If txtPlayernum.Text <> "" Then tsTarget.WriteLine "PLAYERNUM = " & Val(txtPlayernum.Text) - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - MsgBox "Emblem deleted." - Else - MsgBox "Emblem Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmEmblemEdit.frx b/tools/SOCEdit/frmEmblemEdit.frx deleted file mode 100644 index 2ae367330..000000000 Binary files a/tools/SOCEdit/frmEmblemEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmHUDEdit.frm b/tools/SOCEdit/frmHUDEdit.frm deleted file mode 100644 index 2b267b79b..000000000 --- a/tools/SOCEdit/frmHUDEdit.frm +++ /dev/null @@ -1,315 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmHUDEdit - Caption = "HUD Edit" - ClientHeight = 2505 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 5160 - Icon = "frmHUDEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 2505 - ScaleWidth = 5160 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdCodeDefault - Caption = "&Load Code Default" - Height = 375 - Left = 3480 - TabIndex = 9 - Top = 1080 - Width = 1575 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete from SOC" - Height = 375 - Left = 3480 - TabIndex = 7 - Top = 2040 - Width = 1575 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Changes" - Height = 375 - Left = 3480 - TabIndex = 6 - Top = 1560 - Width = 1575 - End - Begin VB.TextBox txtY - Height = 285 - Left = 4080 - MaxLength = 3 - TabIndex = 3 - Top = 720 - Width = 615 - End - Begin VB.TextBox txtX - Height = 285 - Left = 4080 - MaxLength = 3 - TabIndex = 2 - Top = 360 - Width = 615 - End - Begin VB.ListBox lstHUD - Height = 2010 - Left = 120 - TabIndex = 0 - Top = 360 - Width = 3255 - End - Begin VB.Label lblNote - Caption = "HUD items are placed on a 320x200 grid." - Height = 255 - Left = 1680 - TabIndex = 8 - Top = 120 - Width = 3015 - End - Begin VB.Label lblY - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Left = 3600 - TabIndex = 5 - Top = 720 - Width = 375 - End - Begin VB.Label lblX - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Left = 3720 - TabIndex = 4 - Top = 360 - Width = 255 - End - Begin VB.Label lblHUDItems - Caption = "HUD Items:" - Height = 255 - Left = 120 - TabIndex = 1 - Top = 120 - Width = 975 - End -End -Attribute VB_Name = "frmHUDEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdCodeDefault_Click() - LoadHUDInfo (lstHUD.ListIndex) -End Sub - -Private Sub cmdDelete_Click() - Call WriteHUDItem(True) -End Sub - -Private Sub cmdSave_Click() - Call WriteHUDItem(False) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub Reload() - txtX.Text = "" - txtY.Text = "" - Call LoadCode - lstHUD.ListIndex = 0 -End Sub - -Private Sub LoadCode() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("st_stuff.h", ForReading, False) - - Do While ts.ReadLine <> "/** HUD location information (don't move this comment)" - Loop - - ts.ReadLine ' */ - ts.ReadLine ' typedef struct - ts.ReadLine ' { - ts.ReadLine ' int x, y; - ts.ReadLine ' } hudinfo_t; - ts.ReadLine ' - ts.ReadLine ' typedef enum - ts.ReadLine ' { - - line = ts.ReadLine - number = 0 - - lstHUD.Clear - - Do While InStr(line, "NUMHUDITEMS") = 0 - startclip = InStr(line, "HUD_") - If InStr(line, "HUD_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - lstHUD.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstHUD_Click() - LoadHUDInfo (lstHUD.ListIndex) - Call ReadSOC(lstHUD.ListIndex) -End Sub - -Private Sub LoadHUDInfo(HUDNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("st_stuff.c", ForReading, False) - - Do While InStr(ts.ReadLine, "hudinfo[NUMHUDITEMS] =") = 0 - Loop - - ts.SkipLine ' { - line = ts.ReadLine ' First HUD item - - number = 0 - - Do While number <> HUDNum - line = ts.ReadLine - number = number + 1 - Loop - - startclip = InStr(line, "{") + 1 - endclip = InStr(line, ",") - - txtX.Text = TrimComplete(Mid(line, startclip, endclip - startclip)) - - startclip = endclip + 2 - endclip = InStr(startclip, line, "}") - 1 - - txtY.Text = TrimComplete(Mid(line, startclip, endclip - startclip)) - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ReadSOC(HUDNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "HUDITEM" And Val(word2) = HUDNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "X" Then - txtX.Text = Val(word2) - ElseIf word = "Y" Then - txtY.Text = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteHUDItem(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim hudremoved As Boolean - - hudremoved = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current item exists in the SOC, delete it. - If word = "HUDITEM" And Val(word2) = lstHUD.ListIndex Then - hudremoved = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not tsSource.AtEndOfStream - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "HUDITEM " & lstHUD.ListIndex - txtX.Text = TrimComplete(txtX.Text) - txtY.Text = TrimComplete(txtY.Text) - If txtX.Text <> "" Then tsTarget.WriteLine "X = " & Val(txtX.Text) - If txtY.Text <> "" Then tsTarget.WriteLine "Y = " & Val(txtY.Text) - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If hudremoved = True Then - MsgBox "HUD Item deleted from SOC." - Else - MsgBox "Couldn't find HUD Item in SOC." - End If - Else - MsgBox "HUD Item Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmHUDEdit.frx b/tools/SOCEdit/frmHUDEdit.frx deleted file mode 100644 index 2ae367330..000000000 Binary files a/tools/SOCEdit/frmHUDEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmHelp.frm b/tools/SOCEdit/frmHelp.frm deleted file mode 100644 index acf991057..000000000 --- a/tools/SOCEdit/frmHelp.frm +++ /dev/null @@ -1,213 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmHelp - BorderStyle = 3 'Fixed Dialog - Caption = "Getting Started" - ClientHeight = 7395 - ClientLeft = 45 - ClientTop = 330 - ClientWidth = 6360 - Icon = "frmHelp.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 7395 - ScaleWidth = 6360 - ShowInTaskbar = 0 'False - StartUpPosition = 1 'CenterOwner - Begin VB.CommandButton cmdOK - Caption = "&OK, I know what I'm doing now." - Height = 495 - Left = 1920 - Style = 1 'Graphical - TabIndex = 8 - Top = 6840 - Width = 2535 - End - Begin VB.Line Line9 - X1 = 120 - X2 = 6120 - Y1 = 4800 - Y2 = 4800 - End - Begin VB.Line Line7 - X1 = 120 - X2 = 6120 - Y1 = 5400 - Y2 = 5400 - End - Begin VB.Label Label12 - Caption = $"frmHelp.frx":0442 - Height = 615 - Left = 120 - TabIndex = 12 - Top = 4800 - Width = 6015 - End - Begin VB.Line Line6 - X1 = 120 - X2 = 6120 - Y1 = 4200 - Y2 = 4200 - End - Begin VB.Label Label11 - Caption = $"frmHelp.frx":04F8 - Height = 615 - Left = 120 - TabIndex = 11 - Top = 4200 - Width = 6015 - End - Begin VB.Line Line8 - X1 = 120 - X2 = 6120 - Y1 = 6360 - Y2 = 6360 - End - Begin VB.Line Line5 - X1 = 120 - X2 = 6120 - Y1 = 3720 - Y2 = 3720 - End - Begin VB.Line Line4 - X1 = 120 - X2 = 6120 - Y1 = 2880 - Y2 = 2880 - End - Begin VB.Line Line3 - X1 = 120 - X2 = 6120 - Y1 = 2400 - Y2 = 2400 - End - Begin VB.Line Line2 - X1 = 120 - X2 = 6120 - Y1 = 1800 - Y2 = 1800 - End - Begin VB.Line Line1 - X1 = 120 - X2 = 6120 - Y1 = 1200 - Y2 = 1200 - End - Begin VB.Label Label10 - Caption = $"frmHelp.frx":05EC - Height = 495 - Left = 120 - TabIndex = 10 - Top = 3720 - Width = 6135 - End - Begin VB.Label Label9 - Caption = $"frmHelp.frx":068F - Height = 615 - Left = 120 - TabIndex = 9 - Top = 1200 - Width = 6135 - End - Begin VB.Label Label8 - Caption = $"frmHelp.frx":0772 - Height = 495 - Left = 120 - TabIndex = 7 - Top = 6360 - Width = 6135 - End - Begin VB.Label Label7 - Caption = "However, if you have these settings in the SOC you are using, don't worry - the editor will not erase them from your file." - Height = 495 - Left = 120 - TabIndex = 6 - Top = 5880 - Width = 6135 - End - Begin VB.Label Label6 - Caption = $"frmHelp.frx":0816 - Height = 495 - Left = 120 - TabIndex = 5 - Top = 5400 - Width = 6135 - End - Begin VB.Label Label5 - Caption = $"frmHelp.frx":08A9 - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 855 - Left = 120 - TabIndex = 4 - Top = 2880 - Width = 6135 - End - Begin VB.Label Label4 - Caption = $"frmHelp.frx":09B1 - Height = 495 - Left = 120 - TabIndex = 3 - Top = 2400 - Width = 6135 - End - Begin VB.Label Label3 - Caption = $"frmHelp.frx":0A5A - Height = 495 - Left = 120 - TabIndex = 2 - Top = 1920 - Width = 6135 - End - Begin VB.Label Label2 - Caption = "Finally! A way to easily edit SOC files! I know you're anxious to get started, but here are some things you should know first:" - BeginProperty Font - Name = "MS Sans Serif" - Size = 9.75 - Charset = 0 - Weight = 400 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 495 - Left = 120 - TabIndex = 1 - Top = 600 - Width = 6135 - End - Begin VB.Label Label1 - Caption = "How To Use This Program" - BeginProperty Font - Name = "MS Sans Serif" - Size = 13.5 - Charset = 0 - Weight = 700 - Underline = -1 'True - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 495 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 3855 - End -End -Attribute VB_Name = "frmHelp" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdOK_Click() - frmHelp.Hide -End Sub diff --git a/tools/SOCEdit/frmHelp.frx b/tools/SOCEdit/frmHelp.frx deleted file mode 100644 index 25004fe29..000000000 Binary files a/tools/SOCEdit/frmHelp.frx and /dev/null differ diff --git a/tools/SOCEdit/frmHub.frm b/tools/SOCEdit/frmHub.frm deleted file mode 100644 index 3672c62b0..000000000 --- a/tools/SOCEdit/frmHub.frm +++ /dev/null @@ -1,429 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmHub - Caption = "SOC Editor" - ClientHeight = 6960 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 4920 - Icon = "frmHub.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 6960 - ScaleWidth = 4920 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdCreateBlank - Caption = "Make a &Blank SOC" - Height = 255 - Left = 240 - TabIndex = 22 - Top = 2520 - Width = 2055 - End - Begin VB.CommandButton cmdUnlockables - Caption = "Edit &Unlockables" - Enabled = 0 'False - Height = 495 - Left = 2760 - Style = 1 'Graphical - TabIndex = 21 - Top = 6360 - Width = 1095 - End - Begin VB.CommandButton cmdAuthor - Caption = "Enter &Author Info" - Enabled = 0 'False - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 19 - Top = 3960 - Width = 1215 - End - Begin VB.CommandButton cmdHelp - Caption = "Getting Starte&d / READ ME FIRST!" - Height = 495 - Left = 480 - TabIndex = 18 - Top = 2880 - Width = 1575 - End - Begin VB.CommandButton cmdEditCutscenes - Caption = "Edit C&utscenes" - Enabled = 0 'False - Height = 495 - Left = 120 - TabIndex = 17 - Top = 6360 - Width = 1215 - End - Begin VB.CommandButton cmdCharacterEdit - Caption = "Edit &Character Select Screen" - Enabled = 0 'False - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 16 - Top = 5760 - Width = 1215 - End - Begin VB.PictureBox Picture1 - Height = 1965 - Left = 2760 - Picture = "frmHub.frx":0442 - ScaleHeight = 1905 - ScaleWidth = 1905 - TabIndex = 15 - Top = 3960 - Width = 1965 - End - Begin VB.CommandButton cmdSoundEdit - Caption = "Edit &Sounds" - Enabled = 0 'False - Height = 495 - Left = 120 - TabIndex = 14 - Top = 5160 - Width = 1215 - End - Begin VB.CommandButton cmdEmblemEdit - Caption = "Edit &Emblem Locations" - Enabled = 0 'False - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 13 - Top = 4560 - Width = 1215 - End - Begin VB.CommandButton cmdHUDEdit - Caption = "Edit &HUD Coordinates" - Enabled = 0 'False - Height = 495 - Left = 1440 - Style = 1 'Graphical - TabIndex = 12 - Top = 3960 - Width = 1215 - End - Begin VB.CommandButton cmdMaincfg - Caption = "Edit &Global Game Settings" - Enabled = 0 'False - Height = 495 - Left = 1440 - Style = 1 'Graphical - TabIndex = 11 - Top = 4560 - Width = 1215 - End - Begin VB.DriveListBox Drive2 - Height = 315 - Left = 2640 - TabIndex = 9 - Top = 360 - Width = 2175 - End - Begin VB.DirListBox Dir2 - Height = 1665 - Left = 2520 - TabIndex = 8 - Top = 720 - Width = 2295 - End - Begin VB.FileListBox File1 - Height = 1455 - Left = 2520 - Pattern = "*.soc" - TabIndex = 7 - Top = 2400 - Width = 2295 - End - Begin VB.DriveListBox Drive1 - Height = 315 - Left = 120 - TabIndex = 6 - Top = 360 - Width = 2295 - End - Begin VB.DirListBox Dir1 - Height = 1665 - Left = 120 - TabIndex = 4 - Top = 720 - Width = 2295 - End - Begin VB.CommandButton cmdAbout - Caption = "&About" - Height = 375 - Left = 3960 - TabIndex = 3 - Top = 6000 - Width = 735 - End - Begin VB.CommandButton cmdStateEdit - Caption = "Edit St&ates" - Enabled = 0 'False - Height = 495 - Left = 1440 - TabIndex = 2 - Top = 6360 - Width = 1215 - End - Begin VB.CommandButton cmdLevelHeader - Caption = "Edit &Level Headers" - Enabled = 0 'False - Height = 495 - Left = 1440 - Style = 1 'Graphical - TabIndex = 1 - Top = 5160 - Width = 1215 - End - Begin VB.CommandButton cmdThingEdit - Caption = "Edit &Things" - Enabled = 0 'False - Height = 495 - Left = 1440 - TabIndex = 0 - Top = 5760 - Width = 1215 - End - Begin VB.Label lblAuthor - Caption = "Modification By:" - Height = 495 - Left = 120 - TabIndex = 20 - Top = 3480 - Width = 2295 - End - Begin VB.Label lblSOCFile - Caption = "SOC File to use (double click):" - Height = 255 - Left = 2640 - TabIndex = 10 - Top = 120 - Width = 2175 - End - Begin VB.Label lblSourcePath - Caption = "Path to SRB2 Source Code:" - Height = 255 - Left = 120 - TabIndex = 5 - Top = 120 - Width = 2175 - End -End -Attribute VB_Name = "frmHub" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdAbout_Click() - MsgBox App.Title & " v" & App.Major & "." & App.Minor & "." & App.Revision & vbCrLf & "By " & App.CompanyName & vbCrLf & "(SSNTails)" & vbCrLf & App.Comments & vbCrLf & App.FileDescription -End Sub - -Private Sub cmdAuthor_Click() - Dim Response As String - - Response$ = InputBox("Enter name to appear on credits (type in NOBODY to delete):", "Modification By", GetAuthor) - - If Response = "" Then Exit Sub - - Response = TrimComplete(Response) - - If UCase(Response) = "NOBODY" Then - Call WriteAuthor(True, Response) - lblAuthor.Caption = "Modification By: " - Else - Call WriteAuthor(False, Response) - lblAuthor.Caption = "Modification By: " & Response - End If -End Sub - -Private Sub cmdCharacterEdit_Click() - frmCharacterEdit.Show vbModal, Me -End Sub - -Private Sub cmdCreateBlank_Click() - Dim socname As String - - socname = InputBox("This file will be created in the directory you have selected on the main window." & vbCrLf & vbCrLf & "Enter the filename you want (do not include .SOC at the end):", "Make A Blank SOC") - Trim (socname) - - If InStr(LCase(socname), ".soc") > 0 Then - MsgBox "The thing says not to include the .SOC at the end, stupid.", vbOKOnly, "You goofed!" - Exit Sub - End If - - If Len(socname) > 0 Then - socname = socname & ".soc" - - Dim myFSOSOC As New Scripting.FileSystemObject - Dim tsSOC As TextStream - - Set tsSOC = myFSOSOC.OpenTextFile(File1.Path & "\" & socname, ForWriting, True) - tsSOC.Close - Set myFSOSOC = Nothing - - MsgBox "Blank SOC named " & socname & " created in " & File1.Path, vbOKOnly, "Success!" - End If -End Sub - -Private Sub cmdEditCutscenes_Click() - frmCutsceneEdit.Show vbModal, Me -End Sub - -Private Sub cmdEmblemEdit_Click() - frmEmblemEdit.Show vbModal, Me -End Sub - -Private Sub cmdHelp_Click() - frmHelp.Show vbModal, Me -End Sub - -Private Sub cmdHUDEdit_Click() - frmHUDEdit.Show vbModal, Me -End Sub - -Private Sub cmdLevelHeader_Click() - frmLevelHeader.Show vbModal, Me -End Sub - -Private Sub cmdMaincfg_Click() - frmMaincfg.Show vbModal, Me -End Sub - -Private Sub cmdSoundEdit_Click() - frmSoundEdit.Show vbModal, Me -End Sub - -Private Sub cmdStateEdit_Click() - frmStateEdit.Show vbModal, Me -End Sub - -Private Sub cmdThingEdit_Click() - frmThingEdit.Show vbModal, Me -End Sub - -Private Sub cmdUnlockables_Click() - frmUnlockablesEdit.Show vbModal, Me -End Sub - -Private Sub Dir1_Change() - SourcePath = Dir1.Path -End Sub - -Private Sub Dir2_Change() - File1.Path = Dir2.Path -End Sub - -Private Sub Drive1_Change() - Dir1.Path = Drive1.Drive -End Sub - -Private Sub Drive2_Change() - Dir2.Path = Drive2.Drive -End Sub - -Private Sub File1_DblClick() - SOCTemp = File1.Path & "\" & "socedit.tmp" - SOCFile = File1.Path & "\" & File1.List(File1.ListIndex) - MsgBox "You are now using the file: " & vbCrLf & SOCFile - cmdLevelHeader.Enabled = True - cmdThingEdit.Enabled = True - cmdStateEdit.Enabled = True - cmdHUDEdit.Enabled = True - cmdMaincfg.Enabled = True - cmdEmblemEdit.Enabled = True - cmdSoundEdit.Enabled = True - cmdCharacterEdit.Enabled = True - cmdEditCutscenes.Enabled = True - cmdAuthor.Enabled = True - cmdUnlockables.Enabled = True - lblAuthor.Caption = "Modification By: " & GetAuthor -End Sub - -Private Sub Form_Load() - SourcePath = App.Path - Dir1.Path = SourcePath -End Sub - -Private Function GetAuthor() As String - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "MODBY" Then - GetAuthor = word2 - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Function - -Private Sub WriteAuthor(Remove As Boolean, ModderName As String) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the entry exists in the SOC, delete it. - If word <> "MODBY" Then - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "ModBy " & ModderName - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - MsgBox "Name removed." - Else - MsgBox "Name Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmHub.frx b/tools/SOCEdit/frmHub.frx deleted file mode 100644 index 176491ab6..000000000 Binary files a/tools/SOCEdit/frmHub.frx and /dev/null differ diff --git a/tools/SOCEdit/frmLevelHeader.frm b/tools/SOCEdit/frmLevelHeader.frm deleted file mode 100644 index e30acd581..000000000 --- a/tools/SOCEdit/frmLevelHeader.frm +++ /dev/null @@ -1,839 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmLevelHeader - Caption = "Level Header Info" - ClientHeight = 5250 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 7650 - Icon = "frmLevelHeader.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 5250 - ScaleWidth = 7650 - StartUpPosition = 3 'Windows Default - Begin VB.TextBox txtRunSOC - Height = 285 - Left = 6240 - MaxLength = 8 - TabIndex = 49 - Top = 4680 - Width = 1215 - End - Begin VB.CheckBox chkLevelSelect - Caption = "Show on Host Game selection menu" - Height = 375 - Left = 1680 - TabIndex = 48 - Top = 4800 - Width = 1935 - End - Begin VB.CheckBox chkTimeAttack - Caption = "Include in Time Attack calculations" - Height = 255 - Left = 1680 - TabIndex = 47 - Top = 4440 - Width = 2775 - End - Begin VB.CheckBox chkNoReload - Caption = "Retain level state when player dies." - Height = 255 - Left = 1680 - TabIndex = 46 - Top = 4080 - Width = 2895 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Map" - Height = 735 - Left = 120 - Style = 1 'Graphical - TabIndex = 45 - Top = 4440 - Width = 1215 - End - Begin VB.CommandButton cmdRename - Caption = "&Rename Map" - Height = 375 - Left = 120 - TabIndex = 44 - Top = 3960 - Width = 1215 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete Map" - Height = 375 - Left = 120 - TabIndex = 43 - Top = 3480 - Width = 1215 - End - Begin VB.CommandButton cmdAddMap - Caption = "&Add Map" - Height = 375 - Left = 120 - TabIndex = 42 - Top = 3000 - Width = 1215 - End - Begin VB.CheckBox chkNossmusic - Caption = "Disable Super Sonic music changes" - Height = 255 - Left = 4560 - TabIndex = 29 - Top = 1200 - Width = 2895 - End - Begin VB.CheckBox chkHidden - Caption = "Don't show on level selection menu" - Height = 255 - Left = 4560 - TabIndex = 28 - Top = 480 - Width = 2895 - End - Begin VB.TextBox txtCountdown - Height = 285 - Left = 6360 - MaxLength = 3 - TabIndex = 26 - Top = 840 - Width = 735 - End - Begin VB.TextBox txtCutscenenum - Height = 285 - Left = 4440 - MaxLength = 3 - TabIndex = 25 - Top = 3720 - Width = 495 - End - Begin VB.TextBox txtPrecutscenenum - Height = 285 - Left = 2640 - MaxLength = 3 - TabIndex = 22 - Top = 3720 - Width = 495 - End - Begin VB.CheckBox chkScriptislump - Caption = "Script is a lump in WAD, not a file" - Height = 255 - Left = 1680 - TabIndex = 21 - Top = 3360 - Width = 2775 - End - Begin VB.TextBox txtScriptname - Height = 285 - Left = 2640 - MaxLength = 191 - TabIndex = 19 - Top = 3000 - Width = 1455 - End - Begin VB.TextBox txtSkynum - Height = 285 - Left = 2640 - MaxLength = 4 - TabIndex = 17 - Top = 2640 - Width = 495 - End - Begin VB.ComboBox cmbWeather - Height = 315 - ItemData = "frmLevelHeader.frx":0442 - Left = 2640 - List = "frmLevelHeader.frx":0458 - TabIndex = 15 - Top = 2280 - Width = 2295 - End - Begin VB.TextBox txtForcecharacter - Height = 285 - Left = 2640 - MaxLength = 2 - TabIndex = 13 - Top = 1920 - Width = 495 - End - Begin VB.ComboBox cmbMusicslot - Height = 315 - Left = 2640 - TabIndex = 11 - Top = 1560 - Width = 1815 - End - Begin VB.TextBox txtNextlevel - Height = 285 - Left = 2640 - MaxLength = 4 - TabIndex = 9 - Top = 1200 - Width = 615 - End - Begin VB.Frame frmTypeOfLevel - Caption = "Type of Level" - Height = 2775 - Left = 5040 - TabIndex = 8 - Top = 1680 - Width = 2535 - Begin VB.CheckBox chkTypeoflevel - Caption = "Christmas" - Height = 255 - Index = 11 - Left = 1440 - TabIndex = 41 - Tag = "1024" - Top = 960 - Width = 975 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "2D" - Height = 255 - Index = 10 - Left = 1440 - TabIndex = 40 - Tag = "512" - Top = 720 - Width = 735 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Mario" - Height = 255 - Index = 9 - Left = 120 - TabIndex = 39 - Tag = "256" - Top = 2400 - Width = 1455 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Sonic Adventure" - Height = 255 - Index = 8 - Left = 120 - TabIndex = 38 - Tag = "128" - Top = 2160 - Width = 1575 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "NiGHTS" - Height = 255 - Index = 7 - Left = 120 - TabIndex = 37 - Tag = "64" - Top = 1920 - Width = 1335 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Chaos" - Height = 255 - Index = 6 - Left = 120 - TabIndex = 36 - Tag = "32" - Top = 1680 - Width = 1455 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Capture the Flag" - Height = 255 - Index = 5 - Left = 120 - TabIndex = 35 - Tag = "16" - Top = 1440 - Width = 1695 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Tag" - Height = 255 - Index = 4 - Left = 120 - TabIndex = 34 - Tag = "8" - Top = 1200 - Width = 1215 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Match" - Height = 255 - Index = 3 - Left = 120 - TabIndex = 33 - Tag = "4" - Top = 960 - Width = 855 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Race" - Height = 255 - Index = 2 - Left = 120 - TabIndex = 32 - Tag = "2" - Top = 720 - Width = 855 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Cooperative" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 31 - Tag = "1" - Top = 480 - Width = 1215 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Single Player" - Height = 255 - Index = 0 - Left = 120 - TabIndex = 30 - Tag = "4096" - Top = 240 - Width = 1215 - End - End - Begin VB.CheckBox chkNozone - Caption = "Don't show ""ZONE"" after Level Name" - Height = 255 - Left = 4560 - TabIndex = 7 - Top = 120 - Width = 3015 - End - Begin VB.TextBox txtAct - Height = 285 - Left = 2640 - MaxLength = 2 - TabIndex = 5 - Top = 840 - Width = 495 - End - Begin VB.TextBox txtInterscreen - Height = 285 - Left = 2640 - MaxLength = 8 - TabIndex = 3 - Top = 480 - Width = 1335 - End - Begin VB.ListBox lstMaps - Height = 2790 - Left = 120 - Sorted = -1 'True - TabIndex = 2 - Top = 120 - Width = 1215 - End - Begin VB.TextBox txtLevelName - Height = 285 - Left = 2640 - MaxLength = 32 - TabIndex = 0 - Top = 120 - Width = 1815 - End - Begin VB.Label lblRunSOC - Alignment = 1 'Right Justify - Caption = "Run SOC at level load (lump name):" - Height = 495 - Left = 4440 - TabIndex = 50 - Top = 4560 - Width = 1695 - End - Begin VB.Label lblCountdown - Alignment = 1 'Right Justify - Caption = "Level Timer (seconds):" - Height = 255 - Left = 4560 - TabIndex = 27 - Top = 840 - Width = 1695 - End - Begin VB.Label lblCutscenenum - Alignment = 1 'Right Justify - Caption = "Cutscene to play after level:" - Height = 495 - Left = 3240 - TabIndex = 24 - Top = 3600 - Width = 1095 - End - Begin VB.Label lblPrecutscenenum - Alignment = 1 'Right Justify - Caption = "Cutscene to play before level:" - Height = 375 - Left = 1320 - TabIndex = 23 - Top = 3600 - Width = 1215 - End - Begin VB.Label lblScriptName - Alignment = 1 'Right Justify - Caption = "Script Name:" - Height = 255 - Left = 1440 - TabIndex = 20 - Top = 3000 - Width = 1095 - End - Begin VB.Label lblSkynum - Alignment = 1 'Right Justify - Caption = "Sky #:" - Height = 255 - Left = 1800 - TabIndex = 18 - Top = 2640 - Width = 735 - End - Begin VB.Label Label1 - Alignment = 1 'Right Justify - Caption = "Weather:" - Height = 255 - Left = 1680 - TabIndex = 16 - Top = 2280 - Width = 855 - End - Begin VB.Label lblForcecharacter - Caption = "Force Character #:" - Height = 375 - Left = 1440 - TabIndex = 14 - Top = 1800 - Width = 1095 - End - Begin VB.Label lblMusicslot - Alignment = 1 'Right Justify - Caption = "Music:" - Height = 255 - Left = 1800 - TabIndex = 12 - Top = 1560 - Width = 735 - End - Begin VB.Label lblNextlevel - Alignment = 1 'Right Justify - Caption = "Next Level:" - Height = 255 - Left = 1440 - TabIndex = 10 - Top = 1200 - Width = 1095 - End - Begin VB.Label lblAct - Alignment = 1 'Right Justify - Caption = "Act:" - Height = 255 - Left = 2040 - TabIndex = 6 - Top = 840 - Width = 495 - End - Begin VB.Label lblInterscreen - Alignment = 1 'Right Justify - Caption = "Intermission BG:" - Height = 255 - Left = 1320 - TabIndex = 4 - Top = 480 - Width = 1215 - End - Begin VB.Label lblLevelName - Alignment = 1 'Right Justify - Caption = "Level Name:" - Height = 255 - Left = 1560 - TabIndex = 1 - Top = 120 - Width = 975 - End -End -Attribute VB_Name = "frmLevelHeader" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdAddMap_Click() - Dim Response As String - Dim NewNum As Integer - - Response$ = InputBox("Enter the new level (NUMBER ONLY):") - - If Response = "" Then - Exit Sub - End If - - NewNum = Val(TrimComplete(Response)) - - lstMaps.AddItem "Level " & NewNum - lstMaps.ListIndex = lstMaps.ListCount - 1 -End Sub - -Private Sub cmdDelete_Click() - Dim i As Integer - - If MsgBox("Delete this level header?", vbYesNo) = vbNo Then - Exit Sub - End If - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1) - i = Val(i) - Call WriteLevel(True, i) - lstMaps.RemoveItem lstMaps.ListIndex - - If lstMaps.ListCount > 0 Then - lstMaps.ListIndex = 0 - End If -End Sub - -Private Sub cmdRename_Click() - Dim Response As String - Dim NewNum As Integer - Dim i As Integer - - Response$ = InputBox("Rename level to (NUMBER ONLY):") - - If Response = "" Then - Exit Sub - End If - - NewNum = Val(TrimComplete(Response)) - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1) - i = Val(i) - Call WriteLevel(True, i) - lstMaps.List(lstMaps.ListIndex) = "Level " & NewNum - Call cmdSave_Click -End Sub - -Private Sub cmdSave_Click() - Dim i As Integer - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Val(Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1)) - Call WriteLevel(False, i) -End Sub - -Private Sub Form_Load() - Call LoadMusic - Call LoadSOCMaps - If lstMaps.ListCount > 0 Then lstMaps.ListIndex = 0 -End Sub - -Private Sub LoadSOCMaps() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - - lstMaps.Clear - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "LEVEL" Then - lstMaps.AddItem ("Level " & Val(word2)) - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadMusic() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Music list (don't edit this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbMusicslot.Clear - - Do While InStr(line, "NUMMUSIC") = 0 - startclip = InStr(line, "mus_") - If InStr(line, "mus_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbMusicslot.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ClearForm() - Dim j As Integer - - txtLevelName.Text = "" - txtInterscreen.Text = "" - txtAct.Text = "" - txtNextlevel.Text = "" - cmbMusicslot.Text = "" - txtForcecharacter.Text = "" - cmbWeather.Text = "" - txtSkynum.Text = "" - txtScriptname.Text = "" - chkScriptislump.Value = 0 - txtPrecutscenenum.Text = "" - txtCutscenenum.Text = "" - txtRunSOC.Text = "" - chkNozone.Value = 0 - chkHidden.Value = 0 - txtCountdown.Text = "" - chkNossmusic.Value = 0 - chkNoReload.Value = 0 - chkTimeAttack.Value = 0 - chkLevelSelect = 0 - - For j = 0 To 11 - chkTypeoflevel(j).Value = 0 - Next j -End Sub - -Private Sub lstMaps_Click() - Dim startclip As Integer - Call ClearForm - startclip = InStr(lstMaps.List(lstMaps.ListIndex), " ") - Call LoadSOCMapInfo(Val(Mid(lstMaps.List(lstMaps.ListIndex), startclip + 1, Len(lstMaps.List(lstMaps.ListIndex))))) -End Sub - -Private Sub LoadSOCMapInfo(num As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "LEVEL" Then - If Val(word2) = num Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "LEVELNAME" Then - txtLevelName.Text = word2 - ElseIf word = "INTERSCREEN" Then - txtInterscreen.Text = word2 - ElseIf word = "ACT" Then - txtAct.Text = Val(word2) - ElseIf word = "NOZONE" Then - chkNozone.Value = Val(word2) - ElseIf word = "TYPEOFLEVEL" Then - ProcessMapFlags (Val(word2)) - ElseIf word = "NEXTLEVEL" Then - txtNextlevel.Text = Val(word2) - ElseIf word = "MUSICSLOT" Then - cmbMusicslot.ListIndex = Val(word2) - ElseIf word = "FORCECHARACTER" Then - txtForcecharacter.Text = Val(word2) - ElseIf word = "WEATHER" Then - cmbWeather.ListIndex = Val(word2) - ElseIf word = "SKYNUM" Then - txtSkynum.Text = Val(word2) - ElseIf word = "SCRIPTNAME" Then - txtScriptname.Text = word2 - ElseIf word = "SCRIPTISLUMP" Then - chkScriptislump.Value = Val(word2) - ElseIf word = "PRECUTSCENENUM" Then - txtPrecutscenenum.Text = Val(word2) - ElseIf word = "CUTSCENENUM" Then - txtCutscenenum.Text = Val(word2) - ElseIf word = "COUNTDOWN" Then - txtCountdown.Text = Val(word2) - ElseIf word = "HIDDEN" Then - chkHidden.Value = Val(word2) - ElseIf word = "NOSSMUSIC" Then - chkNossmusic.Value = Val(word2) - ElseIf word = "NORELOAD" Then - chkNoReload.Value = Val(word2) - ElseIf word = "TIMEATTACK" Then - chkTimeAttack.Value = Val(word2) - ElseIf word = "LEVELSELECT" Then - chkLevelSelect.Value = Val(word2) - ElseIf word = "RUNSOC" Then - txtRunSOC.Text = word2 - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ProcessMapFlags(flags As Long) - Dim j As Integer - - For j = 0 To 11 - If flags And chkTypeoflevel(j).Tag Then - chkTypeoflevel(j).Value = 1 - Else - chkTypeoflevel(j).Value = 0 - End If - Next j -End Sub - -Private Sub WriteLevel(Remove As Boolean, Mapnum As Integer) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim i As Integer - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1) - i = Val(i) - 'If the current level exists in the SOC, delete it. - If word = "LEVEL" And Val(word2) = i Then - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine UCase(lstMaps.List(lstMaps.ListIndex)) - txtLevelName.Text = TrimComplete(txtLevelName.Text) - txtInterscreen.Text = TrimComplete(txtInterscreen.Text) - txtAct.Text = TrimComplete(txtAct.Text) - txtNextlevel.Text = TrimComplete(txtNextlevel.Text) - cmbMusicslot.Text = TrimComplete(cmbMusicslot.Text) - txtForcecharacter.Text = TrimComplete(txtForcecharacter.Text) - cmbWeather.Text = TrimComplete(cmbWeather.Text) - txtSkynum.Text = TrimComplete(txtSkynum.Text) - txtScriptname.Text = TrimComplete(txtScriptname.Text) - txtPrecutscenenum.Text = TrimComplete(txtPrecutscenenum.Text) - txtCutscenenum.Text = TrimComplete(txtCutscenenum.Text) - txtCountdown.Text = TrimComplete(txtCountdown.Text) - txtRunSOC.Text = TrimComplete(txtRunSOC.Text) - - If txtLevelName.Text <> "" Then tsTarget.WriteLine "LEVELNAME = " & txtLevelName.Text - If txtInterscreen.Text <> "" Then tsTarget.WriteLine "INTERSCREEN = " & txtInterscreen.Text - If txtAct.Text <> "" Then tsTarget.WriteLine "ACT = " & Val(txtAct.Text) - If txtNextlevel.Text <> "" Then tsTarget.WriteLine "NEXTLEVEL = " & Val(txtNextlevel.Text) - If cmbMusicslot.Text <> "" Then tsTarget.WriteLine "MUSICSLOT = " & cmbMusicslot.ListIndex - If txtForcecharacter.Text <> "" Then tsTarget.WriteLine "FORCECHARACTER = " & Val(txtForcecharacter.Text) - If cmbWeather.Text <> "" Then tsTarget.WriteLine "WEATHER = " & cmbWeather.ListIndex - If txtSkynum.Text <> "" Then tsTarget.WriteLine "SKYNUM = " & Val(txtSkynum.Text) - If txtScriptname.Text <> "" Then tsTarget.WriteLine "SCRIPTNAME = " & txtScriptname.Text - If txtPrecutscenenum.Text <> "" Then tsTarget.WriteLine "PRECUTSCENENUM = " & Val(txtPrecutscenenum.Text) - If txtCutscenenum.Text <> "" Then tsTarget.WriteLine "CUTSCENENUM = " & Val(txtCutscenenum.Text) - If txtCountdown.Text <> "" Then tsTarget.WriteLine "COUNTDOWN = " & Val(txtCountdown.Text) - If chkScriptislump.Value = 1 Then tsTarget.WriteLine "SCRIPTISLUMP = 1" - If chkNozone.Value = 1 Then tsTarget.WriteLine "NOZONE = 1" - If chkHidden.Value = 1 Then tsTarget.WriteLine "HIDDEN = 1" - If chkNossmusic.Value = 1 Then tsTarget.WriteLine "NOSSMUSIC = 1" - If chkNoReload.Value = 1 Then tsTarget.WriteLine "NORELOAD = 1" - If chkTimeAttack.Value = 1 Then tsTarget.WriteLine "TIMEATTACK = 1" - If chkLevelSelect.Value = 1 Then tsTarget.WriteLine "LEVELSELECT = 1" - If txtRunSOC.Text <> "" Then tsTarget.WriteLine "RUNSOC = " & txtRunSOC.Text - - flags = 0 - For i = 0 To 11 - If chkTypeoflevel(i).Value = 1 Then - flags = flags + Val(chkTypeoflevel(i).Tag) - End If - Next - - If flags > 0 Then tsTarget.WriteLine "TYPEOFLEVEL = " & flags - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - MsgBox "Level Deleted." - Else - MsgBox "Level Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmLevelHeader.frx b/tools/SOCEdit/frmLevelHeader.frx deleted file mode 100644 index fe81f4413..000000000 Binary files a/tools/SOCEdit/frmLevelHeader.frx and /dev/null differ diff --git a/tools/SOCEdit/frmMaincfg.frm b/tools/SOCEdit/frmMaincfg.frm deleted file mode 100644 index 3efca74a8..000000000 --- a/tools/SOCEdit/frmMaincfg.frm +++ /dev/null @@ -1,644 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmMaincfg - Caption = "Global Game Settings" - ClientHeight = 5295 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 9360 - Icon = "frmMaincfg.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 5295 - ScaleWidth = 9360 - StartUpPosition = 3 'Windows Default - Begin VB.Frame frmReset - Caption = "Reset Data (Be sure this is at the TOP of your SOC)" - Height = 975 - Left = 4800 - TabIndex = 43 - Top = 4200 - Width = 4455 - Begin VB.CheckBox chkReset - Caption = "Thing Properties" - Height = 255 - Index = 2 - Left = 1680 - TabIndex = 46 - Tag = "4" - Top = 240 - Width = 1575 - End - Begin VB.CheckBox chkReset - Caption = "States" - Height = 255 - Index = 1 - Left = 240 - TabIndex = 45 - Tag = "2" - Top = 600 - Width = 1335 - End - Begin VB.CheckBox chkReset - Caption = "Sprite Names" - Height = 255 - Index = 0 - Left = 240 - TabIndex = 44 - Tag = "1" - Top = 240 - Width = 1575 - End - End - Begin VB.CheckBox chkDisableSpeedAdjust - Caption = "Disable speed adjustment of player animations depending on how fast they are moving." - Height = 375 - Left = 1080 - TabIndex = 42 - Top = 4200 - Width = 3615 - End - Begin VB.TextBox txtTitleScrollSpeed - Height = 285 - Left = 4080 - TabIndex = 41 - Top = 1920 - Width = 495 - End - Begin VB.CheckBox chkLoopTitle - Caption = "Loop the title screen music?" - Height = 195 - Left = 1080 - TabIndex = 39 - Top = 3840 - Width = 2415 - End - Begin VB.TextBox txtCreditsCutscene - Height = 285 - Left = 4080 - TabIndex = 37 - Top = 1560 - Width = 495 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 120 - TabIndex = 36 - Top = 3120 - Width = 735 - End - Begin VB.CommandButton cmdReload - Caption = "&Reload" - Height = 495 - Left = 120 - TabIndex = 35 - Top = 2520 - Width = 735 - End - Begin VB.TextBox txtNumemblems - Height = 285 - Left = 4080 - MaxLength = 2 - TabIndex = 33 - Top = 3360 - Width = 495 - End - Begin VB.TextBox txtGamedata - Height = 285 - Left = 3240 - MaxLength = 64 - TabIndex = 31 - Top = 2880 - Width = 1335 - End - Begin VB.TextBox txtExeccfg - Height = 285 - Left = 3240 - TabIndex = 9 - Top = 2400 - Width = 1335 - End - Begin VB.Frame frmTimers - Caption = "Timers (35 = 1 second)" - Height = 3975 - Left = 4800 - TabIndex = 8 - Top = 120 - Width = 4455 - Begin VB.TextBox txtGameovertics - Height = 285 - Left = 3000 - TabIndex = 29 - Top = 3480 - Width = 1335 - End - Begin VB.TextBox txtHelpertics - Height = 285 - Left = 3000 - TabIndex = 27 - Top = 3120 - Width = 1335 - End - Begin VB.TextBox txtParalooptics - Height = 285 - Left = 3000 - TabIndex = 25 - Top = 2760 - Width = 1335 - End - Begin VB.TextBox txtExtralifetics - Height = 285 - Left = 3000 - TabIndex = 23 - Top = 2400 - Width = 1335 - End - Begin VB.TextBox txtSpacetimetics - Height = 285 - Left = 3000 - TabIndex = 21 - Top = 2040 - Width = 1335 - End - Begin VB.TextBox txtUnderwatertics - Height = 285 - Left = 3000 - TabIndex = 19 - Top = 1680 - Width = 1335 - End - Begin VB.TextBox txtTailsflytics - Height = 285 - Left = 3000 - TabIndex = 17 - Top = 1320 - Width = 1335 - End - Begin VB.TextBox txtFlashingtics - Height = 285 - Left = 3000 - TabIndex = 15 - Top = 960 - Width = 1335 - End - Begin VB.TextBox txtSneakertics - Height = 285 - Left = 3000 - TabIndex = 13 - Top = 600 - Width = 1335 - End - Begin VB.TextBox txtInvulntics - Height = 285 - Left = 3000 - TabIndex = 11 - Top = 240 - Width = 1335 - End - Begin VB.Label lblGameovertics - Alignment = 1 'Right Justify - Caption = "Game Over Screen Time:" - Height = 255 - Left = 960 - TabIndex = 30 - Top = 3480 - Width = 1935 - End - Begin VB.Label lblHelpertics - Alignment = 1 'Right Justify - Caption = "NiGHTS Nightopian Helper Time:" - Height = 255 - Left = 240 - TabIndex = 28 - Top = 3120 - Width = 2655 - End - Begin VB.Label lblParalooptics - Alignment = 1 'Right Justify - Caption = "NiGHTS Paraloop Powerup Time:" - Height = 255 - Left = 360 - TabIndex = 26 - Top = 2760 - Width = 2535 - End - Begin VB.Label lblExtralifetics - Alignment = 1 'Right Justify - Caption = "Extra Life Music Duration:" - Height = 255 - Left = 960 - TabIndex = 24 - Top = 2400 - Width = 1935 - End - Begin VB.Label lblSpacetimetics - Alignment = 1 'Right Justify - Caption = "Space Breath Timeout:" - Height = 255 - Left = 1200 - TabIndex = 22 - Top = 2040 - Width = 1695 - End - Begin VB.Label lblUnderwatertics - Alignment = 1 'Right Justify - Caption = "Underwater Breath Timeout:" - Height = 255 - Left = 840 - TabIndex = 20 - Top = 1680 - Width = 2055 - End - Begin VB.Label lblTailsflytics - Alignment = 1 'Right Justify - Caption = "Tails Flying Time:" - Height = 255 - Left = 1440 - TabIndex = 18 - Top = 1320 - Width = 1455 - End - Begin VB.Label lblFlashingtics - Alignment = 1 'Right Justify - Caption = "Flashing Time After Being Hit:" - Height = 255 - Left = 360 - TabIndex = 16 - Top = 960 - Width = 2535 - End - Begin VB.Label lblSneakertics - Alignment = 1 'Right Justify - Caption = "Super Sneakers Time:" - Height = 255 - Left = 240 - TabIndex = 14 - Top = 600 - Width = 2655 - End - Begin VB.Label lblInvulntics - Alignment = 1 'Right Justify - Caption = "Invincibility Time:" - Height = 255 - Left = 360 - TabIndex = 12 - Top = 240 - Width = 2535 - End - End - Begin VB.TextBox txtIntrotoplay - Height = 285 - Left = 4080 - TabIndex = 6 - Top = 1200 - Width = 495 - End - Begin VB.TextBox txtRacestage_start - Height = 285 - Left = 4080 - MaxLength = 4 - TabIndex = 4 - Top = 840 - Width = 495 - End - Begin VB.TextBox txtSpstage_start - Height = 285 - Left = 4080 - MaxLength = 4 - TabIndex = 2 - Top = 480 - Width = 495 - End - Begin VB.TextBox txtSstage_start - Height = 285 - Left = 4080 - MaxLength = 4 - TabIndex = 0 - Top = 120 - Width = 495 - End - Begin VB.Label lblTitleScrollSpeed - Alignment = 1 'Right Justify - Caption = "Scroll speed of title background:" - Height = 255 - Left = 1560 - TabIndex = 40 - Top = 1920 - Width = 2415 - End - Begin VB.Label lblCreditsCutscene - Alignment = 1 'Right Justify - Caption = "Cutscene # to replace credits with:" - Height = 255 - Left = 1080 - TabIndex = 38 - Top = 1560 - Width = 2895 - End - Begin VB.Label lblNumemblems - Alignment = 1 'Right Justify - Caption = "# of LEVEL Emblems (Gamedata field must also be filled out):" - Height = 375 - Left = 1440 - TabIndex = 34 - Top = 3240 - Width = 2535 - End - Begin VB.Label lblGamedata - Alignment = 1 'Right Justify - Caption = "Gamedata file (to save mod emblems and time data):" - Height = 375 - Left = 960 - TabIndex = 32 - Top = 2760 - Width = 2175 - End - Begin VB.Label lblExeccfg - Alignment = 1 'Right Justify - Caption = "CFG file to instantly execute upon loading this SOC:" - Height = 495 - Left = 960 - TabIndex = 10 - Top = 2280 - Width = 2175 - End - Begin VB.Label lblIntrotoplay - Alignment = 1 'Right Justify - Caption = "Cutscene # to use for introduction:" - Height = 255 - Left = 1440 - TabIndex = 7 - Top = 1200 - Width = 2535 - End - Begin VB.Label lblRacestage_start - Alignment = 1 'Right Justify - Caption = "Racing mode starts/loops back to this map #:" - Height = 255 - Left = 720 - TabIndex = 5 - Top = 840 - Width = 3255 - End - Begin VB.Label lblSpstage_start - Alignment = 1 'Right Justify - Caption = "Single Player Game Starts on this map #:" - Height = 255 - Left = 1080 - TabIndex = 3 - Top = 480 - Width = 2895 - End - Begin VB.Label lblSstage_start - Alignment = 1 'Right Justify - Caption = "First Special Stage Map #:" - Height = 255 - Left = 2040 - TabIndex = 1 - Top = 120 - Width = 1935 - End -End -Attribute VB_Name = "frmMaincfg" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub cmdReload_Click() - Call Reload -End Sub - -Private Sub cmdSave_Click() - Call WriteSettings -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ClearForm() - Dim i As Integer - - txtSstage_start.Text = "" - txtSpstage_start.Text = "" - txtRacestage_start.Text = "" - txtIntrotoplay.Text = "" - txtExeccfg.Text = "" - txtGamedata.Text = "" - txtNumemblems.Text = "" - txtInvulntics.Text = "" - txtSneakertics.Text = "" - txtFlashingtics.Text = "" - txtTailsflytics.Text = "" - txtUnderwatertics.Text = "" - txtSpacetimetics.Text = "" - txtExtralifetics.Text = "" - txtParalooptics.Text = "" - txtHelpertics.Text = "" - txtGameovertics.Text = "" - txtCreditsCutscene.Text = "" - txtTitleScrollSpeed.Text = "" - chkLoopTitle.Value = 0 - chkDisableSpeedAdjust.Value = 0 - - For i = 0 To 2 - chkReset(i).Value = 0 - Next i -End Sub - -Private Sub Reload() - Call ClearForm - Call ReadSOCMaincfg -End Sub - -Private Sub ReadSOCMaincfg() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "MAINCFG" Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SSTAGE_START" Then - txtSstage_start.Text = Val(word2) - ElseIf word = "SPSTAGE_START" Then - txtSpstage_start.Text = Val(word2) - ElseIf word = "RACESTAGE_START" Then - txtRacestage_start.Text = Val(word2) - ElseIf word = "INVULNTICS" Then - txtInvulntics.Text = Val(word2) - ElseIf word = "SNEAKERTICS" Then - txtSneakertics.Text = Val(word2) - ElseIf word = "FLASHINGTICS" Then - txtFlashingtics.Text = Val(word2) - ElseIf word = "TAILSFLYTICS" Then - txtTailsflytics.Text = Val(word2) - ElseIf word = "UNDERWATERTICS" Then - txtUnderwatertics.Text = Val(word2) - ElseIf word = "SPACETIMETICS" Then - txtSpacetimetics.Text = Val(word2) - ElseIf word = "EXTRALIFETICS" Then - txtExtralifetics.Text = Val(word2) - ElseIf word = "PARALOOPTICS" Then - txtParalooptics.Text = Val(word2) - ElseIf word = "HELPERTICS" Then - txtHelpertics.Text = Val(word2) - ElseIf word = "GAMEOVERTICS" Then - txtGameovertics.Text = Val(word2) - ElseIf word = "INTROTOPLAY" Then - txtIntrotoplay.Text = Val(word2) - ElseIf word = "CREDITSCUTSCENE" Then - txtCreditsCutscene.Text = Val(word2) - ElseIf word = "TITLESCROLLSPEED" Then - txtTitleScrollSpeed.Text = Val(word2) - ElseIf word = "LOOPTITLE" Then - chkLoopTitle.Value = Val(word2) - ElseIf word = "DISABLESPEEDADJUST" Then - chkDisableSpeedAdjust.Value = Val(word2) - ElseIf word = "GAMEDATA" Then - txtGamedata.Text = word2 - ElseIf word = "NUMEMBLEMS" Then - txtNumemblems.Text = Val(word2) - ElseIf word = "RESETDATA" Then - Dim resetflags As Integer - Dim z As Integer - - resetflags = Val(word2) - - For z = 0 To 2 - If resetflags And chkReset(z).Tag Then - chkReset(z).Value = 1 - Else - chkReset(z).Value = 0 - End If - Next z - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteSettings() - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim i As Integer - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the category exists in the SOC, delete it. - If word = "MAINCFG" Then - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "MAINCFG CATEGORY" - txtSstage_start.Text = TrimComplete(txtSstage_start.Text) - txtSpstage_start.Text = TrimComplete(txtSpstage_start.Text) - txtRacestage_start.Text = TrimComplete(txtRacestage_start.Text) - txtIntrotoplay.Text = TrimComplete(txtIntrotoplay.Text) - txtCreditsCutscene.Text = TrimComplete(txtCreditsCutscene.Text) - txtExeccfg.Text = TrimComplete(txtExeccfg.Text) - txtGamedata.Text = TrimComplete(txtGamedata.Text) - txtNumemblems.Text = TrimComplete(txtNumemblems.Text) - txtInvulntics.Text = TrimComplete(txtInvulntics.Text) - txtSneakertics.Text = TrimComplete(txtSneakertics.Text) - txtFlashingtics.Text = TrimComplete(txtFlashingtics.Text) - txtTailsflytics.Text = TrimComplete(txtTailsflytics.Text) - txtUnderwatertics.Text = TrimComplete(txtUnderwatertics.Text) - txtSpacetimetics.Text = TrimComplete(txtSpacetimetics.Text) - txtExtralifetics.Text = TrimComplete(txtExtralifetics.Text) - txtParalooptics.Text = TrimComplete(txtParalooptics.Text) - txtHelpertics.Text = TrimComplete(txtHelpertics.Text) - txtGameovertics.Text = TrimComplete(txtGameovertics.Text) - txtTitleScrollSpeed.Text = TrimComplete(txtTitleScrollSpeed.Text) - - If txtSstage_start.Text <> "" Then tsTarget.WriteLine "SSTAGE_START = " & Val(txtSstage_start.Text) - If txtSpstage_start.Text <> "" Then tsTarget.WriteLine "SPSTAGE_START = " & Val(txtSpstage_start.Text) - If txtRacestage_start.Text <> "" Then tsTarget.WriteLine "RACESTAGE_START = " & Val(txtRacestage_start.Text) - If txtIntrotoplay.Text <> "" Then tsTarget.WriteLine "INTROTOPLAY = " & Val(txtIntrotoplay.Text) - If txtCreditsCutscene.Text <> "" Then tsTarget.WriteLine "CREDITSCUTSCENE = " & Val(txtCreditsCutscene.Text) - If txtExeccfg.Text <> "" Then tsTarget.WriteLine "EXECCFG = " & txtExeccfg.Text - If txtGamedata.Text <> "" Then tsTarget.WriteLine "GAMEDATA = " & txtGamedata.Text - If txtNumemblems.Text <> "" Then - tsTarget.WriteLine "NUMEMBLEMS = " & Val(txtNumemblems.Text) - EditedNumemblems = True - End If - If txtInvulntics.Text <> "" Then tsTarget.WriteLine "INVULNTICS = " & Val(txtInvulntics.Text) - If txtSneakertics.Text <> "" Then tsTarget.WriteLine "SNEAKERTICS = " & Val(txtSneakertics.Text) - If txtFlashingtics.Text <> "" Then tsTarget.WriteLine "FLASHINGTICS = " & Val(txtFlashingtics.Text) - If txtTailsflytics.Text <> "" Then tsTarget.WriteLine "TAILSFLYTICS = " & Val(txtTailsflytics.Text) - If txtUnderwatertics.Text <> "" Then tsTarget.WriteLine "UNDERWATERTICS = " & Val(txtUnderwatertics.Text) - If txtSpacetimetics.Text <> "" Then tsTarget.WriteLine "SPACETIMETICS = " & Val(txtSpacetimetics.Text) - If txtExtralifetics.Text <> "" Then tsTarget.WriteLine "EXTRALIFETICS = " & Val(txtExtralifetics.Text) - If txtParalooptics.Text <> "" Then tsTarget.WriteLine "PARALOOPTICS = " & Val(txtParalooptics.Text) - If txtHelpertics.Text <> "" Then tsTarget.WriteLine "HELPERTICS = " & Val(txtHelpertics.Text) - If txtGameovertics.Text <> "" Then tsTarget.WriteLine "GAMEOVERTICS = " & Val(txtGameovertics.Text) - If txtTitleScrollSpeed.Text <> "" Then tsTarget.WriteLine "TITLESCROLLSPEED = " & Val(txtTitleScrollSpeed.Text) - If chkLoopTitle.Value = 1 Then tsTarget.WriteLine "LOOPTITLE = " & chkLoopTitle.Value - If chkDisableSpeedAdjust.Value = 1 Then tsTarget.WriteLine "DISABLESPEEDADJUST = " & chkDisableSpeedAdjust.Value - - flags = 0 - For i = 0 To 2 - If chkReset(i).Value = 1 Then - flags = flags + Val(chkReset(i).Tag) - End If - Next - - If flags > 0 Then tsTarget.WriteLine "RESETDATA = " & flags - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - MsgBox "Settings Saved." -End Sub - diff --git a/tools/SOCEdit/frmMaincfg.frx b/tools/SOCEdit/frmMaincfg.frx deleted file mode 100644 index 2ae367330..000000000 Binary files a/tools/SOCEdit/frmMaincfg.frx and /dev/null differ diff --git a/tools/SOCEdit/frmSoundEdit.frm b/tools/SOCEdit/frmSoundEdit.frm deleted file mode 100644 index c91d84ed8..000000000 --- a/tools/SOCEdit/frmSoundEdit.frm +++ /dev/null @@ -1,485 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmSoundEdit - Caption = "Sound Edit" - ClientHeight = 4995 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 6180 - Icon = "frmSoundEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 4995 - ScaleWidth = 6180 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdDelete - Caption = "&Delete sound from SOC" - Height = 495 - Left = 5040 - Style = 1 'Graphical - TabIndex = 13 - Top = 4320 - Width = 1095 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 3840 - TabIndex = 6 - Top = 4320 - Width = 1095 - End - Begin VB.CommandButton cmdReload - Caption = "&Load Code Default" - Height = 495 - Left = 2640 - Style = 1 'Graphical - TabIndex = 5 - Top = 4320 - Width = 1095 - End - Begin VB.Frame frmSpecial - Caption = "Special Properties" - Height = 3375 - Left = 2640 - TabIndex = 4 - Top = 840 - Width = 3495 - Begin VB.CheckBox chkTotallySingle - Caption = "Make sure only one sound of this is playing at a time on any sound channel." - Height = 615 - Left = 120 - TabIndex = 12 - Tag = "1" - Top = 2640 - Width = 3255 - End - Begin VB.CheckBox chkEightEx - Caption = "Sound can be heard across 8x the distance" - Height = 375 - Left = 120 - TabIndex = 10 - Tag = "16" - Top = 2160 - Width = 2295 - End - Begin VB.CheckBox chkOutside - Caption = "Volume dependent on how close you are to outside" - Height = 375 - Left = 120 - TabIndex = 9 - Tag = "4" - Top = 360 - Width = 2295 - End - Begin VB.CheckBox chkFourEx - Caption = "Sound can be heard across 4x the distance" - Height = 375 - Left = 120 - TabIndex = 8 - Tag = "8" - Top = 1560 - Width = 2055 - End - Begin VB.CheckBox chkMultiple - Caption = "More than one of this sound can be played per object at a time (i.e., thunder)" - Height = 615 - Left = 120 - TabIndex = 7 - Tag = "2" - Top = 840 - Width = 2535 - End - Begin VB.Label Label1 - Caption = "Combine for 32x" - Height = 495 - Left = 2760 - TabIndex = 11 - Top = 1800 - Width = 615 - End - Begin VB.Line Line4 - X1 = 2400 - X2 = 2640 - Y1 = 2400 - Y2 = 2400 - End - Begin VB.Line Line2 - X1 = 2400 - X2 = 2640 - Y1 = 1800 - Y2 = 1800 - End - Begin VB.Line Line1 - X1 = 2640 - X2 = 2640 - Y1 = 2400 - Y2 = 1800 - End - End - Begin VB.ComboBox cmbPriority - Height = 315 - ItemData = "frmSoundEdit.frx":0442 - Left = 3360 - List = "frmSoundEdit.frx":0444 - TabIndex = 2 - Top = 120 - Width = 855 - End - Begin VB.CheckBox chkSingularity - Caption = "Only one can be played at a time per object." - Height = 255 - Left = 2640 - TabIndex = 1 - Top = 480 - Width = 3495 - End - Begin VB.ListBox lstSounds - Height = 4740 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 2415 - End - Begin VB.Line Line3 - X1 = 0 - X2 = 720 - Y1 = 0 - Y2 = 0 - End - Begin VB.Label lblPriority - Alignment = 1 'Right Justify - Caption = "Priority:" - Height = 255 - Left = 2640 - TabIndex = 3 - Top = 120 - Width = 615 - End -End -Attribute VB_Name = "frmSoundEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdDelete_Click() - Call WriteSound(True) -End Sub - -Private Sub cmdReload_Click() - Call ClearForm - If InStr(lstSounds.List(lstSounds.ListIndex), "(free slot)") = 0 Then - Call LoadSoundInfo(lstSounds.ListIndex) - Else - MsgBox "Free slots do not have a code default." - End If -End Sub - -Private Sub cmdSave_Click() - Call WriteSound(False) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ClearForm() - cmbPriority.Text = "" - chkSingularity.Value = 0 - chkOutside.Value = 0 - chkMultiple.Value = 0 - chkFourEx.Value = 0 - chkEightEx.Value = 0 - chkTotallySingle.Value = 0 -End Sub - -Private Sub Reload() - Call ClearForm - Call LoadCode - lstSounds.ListIndex = 0 -End Sub - -Private Sub LoadCode() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim i As Integer, numfreeslots As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "List of sounds (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstSounds.Clear - - Do While InStr(line, "sfx_freeslot0") = 0 - startclip = InStr(line, "sfx_") - If InStr(line, "sfx_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - lstSounds.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing - -'Populate the free slots! - numfreeslots = 800 - - For i = 1 To numfreeslots - If i < 10 Then - addstring = number & " - " & "sfx_fre00" & i & " (free slot)" - ElseIf i < 100 Then - addstring = number & " - " & "sfx_fre0" & i & " (free slot)" - Else - addstring = number & " - " & "sfx_fre" & i & " (free slot)" - End If - lstSounds.AddItem addstring - number = number + 1 - Next - - For i = 0 To 127 - cmbPriority.AddItem i - Next -End Sub - -Private Sub lstSounds_Click() - Call ClearForm - If InStr(lstSounds.List(lstSounds.ListIndex), "(free slot)") = 0 Then - Call LoadSoundInfo(lstSounds.ListIndex) - End If - Call LoadSOCSoundInfo(lstSounds.ListIndex) -End Sub - -Private Sub LoadSOCSoundInfo(SoundNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "SOUND" And Val(word2) = SoundNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SINGULAR" Then - If Val(word2) = 1 Then - chkSingularity.Value = 1 - Else - chkSingularity.Value = 0 - End If - ElseIf word = "PRIORITY" Then - cmbPriority.Text = Val(word2) - ElseIf word = "FLAGS" Then - ProcessSoundFlags (Val(word2)) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadSoundInfo(StateNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim token As String - Dim frame As Long - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.c", ForReading, False) - - Do While InStr(ts.ReadLine, "S_sfx[0] needs to be a dummy for odd reasons.") = 0 - Loop - - number = 0 - - Do While number <> StateNum - Do While InStr(ts.ReadLine, """") = 0 - Loop - number = number + 1 - Loop - - Do While InStr(line, """") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, """") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, """") - 1 - token = TrimComplete(Left(line, endclip)) - - 'txtName.Text = line - - startclip = InStr(line, ",") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = TrimComplete(Left(line, endclip)) - - If token = "true" Then - chkSingularity.Value = 1 - Else - chkSingularity.Value = 0 - End If - - startclip = InStr(line, ",") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = TrimComplete(Left(line, endclip)) - cmbPriority.Text = token - - startclip = InStr(line, ",") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = TrimComplete(Left(line, endclip)) - - ProcessSoundFlags (Val(token)) - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ProcessSoundFlags(flags As Long) - - chkTotallySingle.Value = 0 - chkMultiple.Value = 0 - chkOutside.Value = 0 - chkFourEx.Value = 0 - chkEightEx.Value = 0 - - If flags = -1 Then - Exit Sub - End If - - If flags And 1 Then - chkTotallySingle.Value = 1 - End If - - If flags And 2 Then - chkMultiple.Value = 1 - End If - - If flags And 4 Then - chkOutside.Value = 1 - End If - - If flags And 8 Then - chkFourEx.Value = 1 - End If - - If flags And 16 Then - chkEightEx.Value = 1 - End If - -End Sub - -Private Sub WriteSound(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim soundfound As Boolean - - soundfound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current sound exists in the SOC, delete it. - If word = "SOUND" And Val(word2) = lstSounds.ListIndex Then - soundfound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "SOUND " & lstSounds.ListIndex - cmbPriority.Text = TrimComplete(cmbPriority.Text) - If cmbPriority.Text <> "" Then tsTarget.WriteLine "PRIORITY = " & Val(cmbPriority.Text) - If chkSingularity.Value = 1 Then tsTarget.WriteLine "SINGULAR = 1" - - flags = 0 - - If chkOutside.Value = 1 Then flags = flags + Val(chkOutside.Tag) - If chkMultiple.Value = 1 Then flags = flags + Val(chkMultiple.Tag) - If chkFourEx.Value = 1 Then flags = flags + Val(chkFourEx.Tag) - If chkEightEx.Value = 1 Then flags = flags + Val(chkEightEx.Tag) - If chkTotallySingle.Value = 1 Then flags = flags + Val(chkTotallySingle.Tag) - - If flags > 0 Then tsTarget.WriteLine "FLAGS = " & flags - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If soundfound = True Then - MsgBox "Sound removed from SOC." - Else - MsgBox "Sound not found in SOC." - End If - Else - MsgBox "Sound Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmSoundEdit.frx b/tools/SOCEdit/frmSoundEdit.frx deleted file mode 100644 index 980538679..000000000 Binary files a/tools/SOCEdit/frmSoundEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmStateEdit.frm b/tools/SOCEdit/frmStateEdit.frm deleted file mode 100644 index 4eca5a1bc..000000000 --- a/tools/SOCEdit/frmStateEdit.frm +++ /dev/null @@ -1,940 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmStateEdit - Caption = "State Edit" - ClientHeight = 6750 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 8970 - Icon = "frmStateEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 6750 - ScaleWidth = 8970 - StartUpPosition = 3 'Windows Default - Begin VB.TextBox lblVar2Desc - Height = 495 - Left = 4440 - Locked = -1 'True - MultiLine = -1 'True - ScrollBars = 2 'Vertical - TabIndex = 25 - Top = 3000 - Width = 4455 - End - Begin VB.TextBox lblVar1Desc - Height = 495 - Left = 4440 - Locked = -1 'True - MultiLine = -1 'True - ScrollBars = 2 'Vertical - TabIndex = 24 - Top = 2400 - Width = 4455 - End - Begin VB.TextBox lblActionDesc - Height = 735 - Left = 4440 - Locked = -1 'True - MultiLine = -1 'True - ScrollBars = 2 'Vertical - TabIndex = 23 - Top = 1560 - Width = 4455 - End - Begin VB.ListBox lstThings - Height = 450 - ItemData = "frmStateEdit.frx":0442 - Left = 7440 - List = "frmStateEdit.frx":0444 - TabIndex = 22 - Top = 6120 - Visible = 0 'False - Width = 975 - End - Begin VB.TextBox txtFuncVar2 - Height = 285 - Left = 7200 - TabIndex = 19 - Top = 3600 - Width = 1215 - End - Begin VB.TextBox txtFuncVar1 - Height = 285 - Left = 5520 - TabIndex = 18 - Top = 3600 - Width = 1095 - End - Begin VB.CommandButton cmdCopy - Caption = "&Copy state to..." - Height = 495 - Left = 6120 - Style = 1 'Graphical - TabIndex = 17 - Top = 6120 - Width = 1095 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete State from SOC" - Height = 495 - Left = 6120 - Style = 1 'Graphical - TabIndex = 16 - Top = 5520 - Width = 1095 - End - Begin VB.CommandButton cmdReload - Caption = "&Load Code Default" - Height = 495 - Left = 4920 - Style = 1 'Graphical - TabIndex = 15 - Top = 5520 - Width = 1095 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 7320 - TabIndex = 14 - Top = 5520 - Width = 1095 - End - Begin VB.ComboBox cmbTranslucency - Height = 315 - ItemData = "frmStateEdit.frx":0446 - Left = 6720 - List = "frmStateEdit.frx":045C - TabIndex = 12 - Top = 5040 - Width = 1695 - End - Begin VB.CheckBox chkFullbright - Caption = "Make sprite full-brightness (unaffected by lighting)" - Height = 495 - Left = 6240 - TabIndex = 11 - Top = 4440 - Width = 2175 - End - Begin VB.ComboBox cmbNextstate - Height = 315 - Left = 6120 - TabIndex = 9 - Top = 3960 - Width = 2295 - End - Begin VB.ComboBox cmbAction - Height = 315 - Left = 6000 - TabIndex = 7 - Top = 1200 - Width = 2295 - End - Begin VB.TextBox txtTics - Height = 285 - Left = 7800 - TabIndex = 5 - Top = 720 - Width = 495 - End - Begin VB.TextBox txtFrame - Height = 285 - Left = 5880 - MaxLength = 2 - TabIndex = 3 - Top = 720 - Width = 495 - End - Begin VB.ComboBox cmbSprite - Height = 315 - Left = 5880 - TabIndex = 1 - Top = 120 - Width = 2415 - End - Begin VB.ListBox lstStates - Height = 6495 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 4215 - End - Begin VB.Label lblFuncVar2 - Alignment = 1 'Right Justify - Caption = "Var2:" - Height = 255 - Left = 6600 - TabIndex = 21 - Top = 3600 - Width = 495 - End - Begin VB.Label lblFuncVar1 - Alignment = 1 'Right Justify - Caption = "Var1:" - Height = 255 - Left = 4920 - TabIndex = 20 - Top = 3600 - Width = 495 - End - Begin VB.Label lblTranslucency - Alignment = 1 'Right Justify - Caption = "Translucency:" - Height = 255 - Left = 5520 - TabIndex = 13 - Top = 5040 - Width = 1095 - End - Begin VB.Label lblNextstate - Alignment = 1 'Right Justify - Caption = "Next State:" - Height = 255 - Left = 5160 - TabIndex = 10 - Top = 3960 - Width = 855 - End - Begin VB.Label lblAction - Alignment = 1 'Right Justify - Caption = "Function to Call:" - Height = 375 - Left = 5040 - TabIndex = 8 - Top = 1080 - Width = 855 - End - Begin VB.Label lblTics - Alignment = 1 'Right Justify - Caption = "Tics (-1 for infinite duration):" - Height = 495 - Left = 6480 - TabIndex = 6 - Top = 600 - Width = 1215 - End - Begin VB.Label lblFrame - Alignment = 1 'Right Justify - Caption = "Frame:" - Height = 255 - Left = 5160 - TabIndex = 4 - Top = 720 - Width = 615 - End - Begin VB.Label lblSprite - Alignment = 1 'Right Justify - Caption = "Sprite:" - Height = 255 - Left = 5160 - TabIndex = 2 - Top = 120 - Width = 615 - End -End -Attribute VB_Name = "frmStateEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmbAction_Click() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim index As Integer - Dim ActionName As String - - ActionName = cmbAction.List(cmbAction.ListIndex) - - If cmbAction.ListIndex = 0 Then - lblActionDesc.Text = "" - lblVar1Desc.Text = "" - lblVar2Desc.Text = "" - Exit Sub - End If - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("p_enemy.c", ForReading, False) - - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Mid(line, 4, 9) = "Function:" And InStr(line, ActionName) > 0 Then - ts.ReadLine ' // - line = ts.ReadLine ' // Description: - index = InStr(line, ":") - lblActionDesc.Text = Mid(line, index + 2, Len(line) - (index + 1)) - - ts.ReadLine ' // - line = ts.ReadLine ' // var1 = - If InStr(line, "var1:") Then - lblVar1Desc.Text = Mid(line, 4, Len(line) - 3) - line = ts.ReadLine - Do While Left(line, 7) <> "// var2" - lblVar1Desc.Text = lblVar1Desc.Text & vbCrLf & TrimComplete(Mid(line, 4, Len(line) - 3)) - line = ts.ReadLine - Loop - Else - lblVar1Desc.Text = Mid(line, 4, Len(line) - 3) - End If - - If Left(line, 7) <> "// var2" Then - line = ts.ReadLine ' // var2 = - End If - - If InStr(line, "var2:") Then - lblVar2Desc.Text = Mid(line, 4, Len(line) - 3) - line = ts.ReadLine - Do While Len(line) > 4 - lblVar2Desc.Text = lblVar2Desc.Text & vbCrLf & TrimComplete(Mid(line, 4, Len(line) - 3)) - line = ts.ReadLine - Loop - Else - lblVar2Desc.Text = Mid(line, 4, Len(line) - 3) - End If - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub cmdCopy_Click() - Dim Response As String - - Response$ = InputBox("Copy state to #:", "Copy State") - - If Response = "" Then Exit Sub - - Response = TrimComplete(Response) - - Call WriteState(False, Val(Response)) - - MsgBox "State copied to #" & Val(Response) -End Sub - -Private Sub cmdDelete_Click() - Call WriteState(True, lstStates.ListIndex) -End Sub - -Private Sub cmdReload_Click() - Call ClearForm - - If InStr(lstStates.List(lstStates.ListIndex), "S_FREESLOT") = 0 Then - LoadStateInfo (lstStates.ListIndex) - Else - MsgBox "Free slots do not have a code default." - End If -End Sub - -Private Sub cmdSave_Click() - If TrimComplete(txtFrame.Text) = "" And (chkFullbright.Value = 1 Or cmbTranslucency.ListIndex > 0) Then - MsgBox "ERROR: Frame field required for fullbright/translucency." - Exit Sub - End If - Call WriteState(False, lstStates.ListIndex) -End Sub - -Private Sub Form_Load() - Call Reload - lstStates.ListIndex = 0 -End Sub - -Private Sub ClearForm() - cmbNextstate.Text = "" - cmbSprite.Text = "" - txtFrame.Text = "" - cmbAction.Text = "" - txtFuncVar1.Text = "" - txtFuncVar2.Text = "" - lblActionDesc.Text = "" - lblVar1Desc.Text = "" - lblVar2Desc.Text = "" - chkFullbright.Value = False - cmbTranslucency.ListIndex = 0 -End Sub - -Private Sub Reload() - LoadStates - LoadSprites - LoadActions -End Sub - -Private Sub LoadStates() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Object states (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstStates.Clear - - Do While InStr(line, "S_FIRSTFREESLOT") = 0 - startclip = InStr(line, "S_") - If InStr(line, "S_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - lstStates.AddItem addstring - cmbNextstate.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) * 6 - - For i = 1 To numfreeslots - addstring = number & " - " & "S_FREESLOT" & i - lstStates.AddItem addstring - cmbNextstate.AddItem addstring - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadSprites() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Hey, moron! If you change this table, don't forget about") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbSprite.Clear - - Do While InStr(line, "SPR_FIRSTFREESLOT") = 0 - startclip = InStr(line, "SPR_") - If InStr(line, "SPR_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbSprite.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) - - For i = 1 To numfreeslots - If i < 10 Then - addstring = number & " - " & "SPR_F00" & i & " (Free slot)" - ElseIf i < 100 Then - addstring = number & " - " & "SPR_F0" & i & " (Free slot)" - Else - addstring = number & " - " & "SPR_F" & i & " (Free slot)" - End If - - cmbSprite.AddItem addstring - number = number + 1 - Next - - ts.Close - - Set myFSO = Nothing -End Sub - -Private Sub LoadActions() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("dehacked.c", ForReading, False) - - Do While InStr(ts.ReadLine, "actionpointer_t actionpointers[]") = 0 - Loop - - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbAction.Clear - - cmbAction.AddItem "None" - - Do While InStr(line, "NULL") = 0 - startclip = InStr(line, "A_") - If InStr(line, "A_") <> 0 Then - endclip = InStr(line, "}") - line = Mid(line, startclip, endclip - startclip) - cmbAction.AddItem line - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstStates_Click() - Call ClearForm - - If InStr(lstStates.List(lstStates.ListIndex), "S_FREESLOT") = 0 Then - LoadStateInfo (lstStates.ListIndex) - End If - - LoadSOCStateInfo (lstStates.ListIndex) -End Sub - -Private Sub LoadSOCStateInfo(StateNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim frameNum As Long - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "FRAME" And Val(word2) = StateNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SPRITENUMBER" Then - cmbSprite.ListIndex = Val(word2) - ElseIf word = "SPRITESUBNUMBER" Then - frameNum = Val(word2) - - If frameNum >= 327680 Then ' 5 << 16 - cmbTranslucency.ListIndex = 5 - frameNum = frameNum And Not 327680 - ElseIf frameNum >= 262144 Then ' 4 << 16 - cmbTranslucency.ListIndex = 4 - frameNum = frameNum And Not 262144 - ElseIf frameNum >= 196608 Then ' 3 << 16 - cmbTranslucency.ListIndex = 3 - frameNum = frameNum And Not 196608 - ElseIf frameNum >= 131072 Then ' 2 << 16 - cmbTranslucency.ListIndex = 2 - frameNum = frameNum And Not 131072 - ElseIf frameNum >= 65536 Then ' 1 << 16 - cmbTranslucency.ListIndex = 1 - frameNum = frameNum And Not 65536 - End If - - If frameNum >= 32768 Then - chkFullbright.Value = 1 - frameNum = frameNum And Not 32768 - Else - chkFullbright.Value = 0 - End If - - txtFrame.Text = frameNum - ElseIf word = "DURATION" Then - txtTics.Text = Val(word2) - ElseIf word = "NEXT" Then - cmbNextstate.ListIndex = Val(word2) - ElseIf word = "ACTION" Then - Call FindComboIndex(cmbAction, UCase(SecondToken(line))) - ElseIf word = "VAR1" Then - txtFuncVar1.Text = Val(word2) - ElseIf word = "VAR2" Then - txtFuncVar2.Text = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadStateInfo(StateNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim token As String - Dim frame As Long - Dim templine As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.c", ForReading, False) - - Do While InStr(ts.ReadLine, "Keep this comment directly above S_NULL") = 0 - Loop - - number = 0 - - Do While number <> StateNum - Do While InStr(ts.ReadLine, "SPR_") = 0 - Loop - number = number + 1 - Loop - - Do While InStr(line, "SPR_") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SPR_") - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = Left(line, endclip) - Call FindComboIndex(cmbSprite, token) - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - frame = Val(Left(line, endclip)) - - If frame >= 32768 Then - chkFullbright.Value = 1 - frame = frame - 32768 - Else - chkFullbright.Value = 0 - End If - - txtFrame.Text = frame - - cmbTranslucency.ListIndex = 0 - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - txtTics.Text = Val(Left(line, endclip)) - - startclip = InStr(line, "{") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, "}") - 1 - cmbAction.Text = TrimComplete(Left(line, endclip)) - If cmbAction.Text = "NULL" Then cmbAction.Text = "None" - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - templine = Left(line, endclip) - - templine = TrimComplete(templine) - 'Check for *FRACUNIT values - endclip = InStr(templine, "*FRACUNIT") - If endclip <> 0 Then - templine = Left(templine, endclip - 1) - templine = Val(templine) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(templine, "MT_") - If endclip <> 0 Then - templine = FindThingNum(templine) & " - " & templine - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(templine, "pw_") - If endclip <> 0 Then - templine = FindPowerNum(templine) & " - " & templine - End If - txtFuncVar1.Text = templine - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - templine = Left(line, endclip) - - templine = TrimComplete(templine) - 'Check for *FRACUNIT values - endclip = InStr(templine, "*FRACUNIT") - If endclip <> 0 Then - templine = Left(templine, endclip - 1) - templine = Val(templine) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(templine, "MT_") - If endclip <> 0 Then - templine = FindThingNum(templine) & " - " & templine - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(templine, "pw_") - If endclip <> 0 Then - templine = FindPowerNum(templine) & " - " & templine - End If - txtFuncVar2.Text = templine - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, "}") - 1 - Call FindComboIndex(cmbNextstate, TrimComplete(Left(line, endclip))) - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub FindComboIndex(ByRef Box As ComboBox, line As String) - Dim i As Integer - - For i = 0 To Box.ListCount - If InStr(UCase(Box.List(i)), UCase(line)) Then - Box.ListIndex = i - Exit For - End If - Next -End Sub - -Private Sub WriteState(Remove As Boolean, num As Integer) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim statefound As Boolean - - statefound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current sound exists in the SOC, delete it. - If word = "FRAME" And Val(word2) = num Then - statefound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "FRAME " & num - cmbSprite.Text = TrimComplete(cmbSprite.Text) - txtFrame.Text = TrimComplete(txtFrame.Text) - txtTics.Text = TrimComplete(txtTics.Text) - cmbAction.Text = TrimComplete(cmbAction.Text) - txtFuncVar1.Text = TrimComplete(txtFuncVar1.Text) - txtFuncVar2.Text = TrimComplete(txtFuncVar2.Text) - cmbNextstate.Text = TrimComplete(cmbNextstate.Text) - cmbTranslucency.Text = TrimComplete(cmbTranslucency.Text) - - If cmbSprite.Text <> "" Then tsTarget.WriteLine "SPRITENUMBER = " & cmbSprite.ListIndex - - flags = Val(txtFrame.Text) - If chkFullbright.Value = 1 Then flags = flags + 32768 - - ' Grrr VB doesn't have bitshifts!! - If cmbTranslucency.Text <> "" Then - flags = flags + cmbTranslucency.ListIndex * 65536 - End If - - If txtFrame.Text <> "" Then tsTarget.WriteLine "SPRITESUBNUMBER = " & flags - If txtTics.Text <> "" Then tsTarget.WriteLine "DURATION = " & Val(txtTics.Text) - If cmbNextstate.Text <> "" Then tsTarget.WriteLine "NEXT = " & cmbNextstate.ListIndex - If cmbAction.Text <> "" Then tsTarget.WriteLine "ACTION " & cmbAction.Text - If txtFuncVar1.Text <> "" Then tsTarget.WriteLine "VAR1 = " & Val(txtFuncVar1.Text) - If txtFuncVar2.Text <> "" Then tsTarget.WriteLine "VAR2 = " & Val(txtFuncVar2.Text) - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If statefound = True Then - MsgBox "State removed from SOC." - Else - MsgBox "State not found in SOC." - End If - Else - MsgBox "State Saved." - End If -End Sub - -Private Sub LoadThings() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Little flag for SOC editor (don't change this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstThings.Clear - - Do While InStr(line, "MT_FIRSTFREESLOT") = 0 - startclip = InStr(line, "MT_") - If InStr(line, "MT_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - lstThings.AddItem number & " - " & line - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) - - For i = 1 To numfreeslots - lstThings.AddItem number & " - " & "MT_FREESLOT" & i - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Function FindThingNum(ThingName As String) As Integer - Dim i As Integer - Dim temp As String - Dim startpoint As Integer - Dim endpoint As Integer - - lstThings.Clear - LoadThings - - For i = 0 To lstThings.ListCount - 1 - temp = lstThings.List(i) - startpoint = InStr(temp, "-") + 2 - endpoint = Len(temp) - startpoint + 1 - temp = Mid(temp, startpoint, endpoint) - If temp = ThingName Then - FindThingNum = Val(lstThings.List(i)) - Exit For - End If - Next -End Function - -Private Function FindPowerNum(PowerName As String) As Integer - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("d_player.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Player powers. (don't edit this comment)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - Do While InStr(line, "NUMPOWERS") = 0 - startclip = InStr(line, PowerName) - If startclip <> 0 Then - FindPowerNum = number - Exit Do - End If - number = number + 1 - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Function diff --git a/tools/SOCEdit/frmStateEdit.frx b/tools/SOCEdit/frmStateEdit.frx deleted file mode 100644 index 8069c37e0..000000000 Binary files a/tools/SOCEdit/frmStateEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmUnlockablesEdit.frm b/tools/SOCEdit/frmUnlockablesEdit.frm deleted file mode 100644 index f43209a78..000000000 --- a/tools/SOCEdit/frmUnlockablesEdit.frm +++ /dev/null @@ -1,391 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmUnlockablesEdit - Caption = "Unlockables Edit" - ClientHeight = 3675 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 8130 - Icon = "frmUnlockablesEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 3675 - ScaleWidth = 8130 - StartUpPosition = 3 'Windows Default - Begin VB.CheckBox chkGrade - Caption = "Must have beaten Ultimate" - Height = 255 - Index = 4 - Left = 5400 - TabIndex = 20 - Tag = "1024" - Top = 2160 - Width = 2655 - End - Begin VB.CheckBox chkGrade - Caption = "Must have beaten Very Hard" - Height = 255 - Index = 3 - Left = 5400 - TabIndex = 19 - Tag = "128" - Top = 1800 - Width = 2655 - End - Begin VB.CheckBox chkGrade - Caption = "Must have all emblems" - Height = 255 - Index = 2 - Left = 5400 - TabIndex = 18 - Tag = "16" - Top = 1440 - Width = 2055 - End - Begin VB.CheckBox chkGrade - Caption = "Must have gotten all 7 emeralds" - Height = 255 - Index = 1 - Left = 5400 - TabIndex = 17 - Tag = "8" - Top = 1080 - Width = 2655 - End - Begin VB.CheckBox chkGrade - Caption = "Game must be completed" - Height = 255 - Index = 0 - Left = 5400 - TabIndex = 16 - Tag = "1" - Top = 720 - Width = 2175 - End - Begin VB.TextBox txtVar - Height = 285 - Left = 4320 - TabIndex = 14 - Top = 2640 - Width = 615 - End - Begin VB.ComboBox cmbType - Height = 315 - ItemData = "frmUnlockablesEdit.frx":0442 - Left = 3360 - List = "frmUnlockablesEdit.frx":044C - TabIndex = 12 - Top = 2160 - Width = 1575 - End - Begin VB.TextBox txtNeededTime - Height = 285 - Left = 4080 - TabIndex = 10 - Top = 1680 - Width = 855 - End - Begin VB.TextBox txtNeededEmblems - Height = 285 - Left = 4440 - TabIndex = 9 - Top = 1200 - Width = 495 - End - Begin VB.TextBox txtObjective - Height = 285 - Left = 3240 - TabIndex = 7 - Top = 720 - Width = 1695 - End - Begin VB.TextBox txtName - Height = 285 - Left = 3240 - TabIndex = 5 - Top = 240 - Width = 1695 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete from SOC" - Height = 375 - Left = 3480 - TabIndex = 3 - Top = 3120 - Width = 1575 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Changes" - Height = 375 - Left = 1800 - TabIndex = 2 - Top = 3120 - Width = 1575 - End - Begin VB.ListBox lstUnlockables - Height = 2985 - ItemData = "frmUnlockablesEdit.frx":046A - Left = 120 - List = "frmUnlockablesEdit.frx":049B - TabIndex = 0 - Top = 480 - Width = 1215 - End - Begin VB.Label lblNote - Caption = "Note: All requirements are combinable." - Height = 495 - Left = 6000 - TabIndex = 22 - Top = 2760 - Width = 1695 - End - Begin VB.Label lblOtherReqs - Caption = "Other Requirements:" - Height = 255 - Left = 5400 - TabIndex = 21 - Top = 360 - Width = 1935 - End - Begin VB.Label lblVar - Alignment = 1 'Right Justify - Caption = "Map # to warp to:" - Height = 255 - Left = 2880 - TabIndex = 15 - Top = 2640 - Width = 1335 - End - Begin VB.Label lblType - Alignment = 1 'Right Justify - Caption = "Type of Unlockable:" - Height = 255 - Left = 1800 - TabIndex = 13 - Top = 2160 - Width = 1455 - End - Begin VB.Label lblNeededTime - Alignment = 1 'Right Justify - Caption = "Needed time on Time Attack rank (in seconds):" - Height = 375 - Left = 1440 - TabIndex = 11 - Top = 1560 - Width = 2535 - End - Begin VB.Label lblNeededEmblems - Alignment = 1 'Right Justify - Caption = "# of Emblems Needed:" - Height = 255 - Left = 2640 - TabIndex = 8 - Top = 1200 - Width = 1695 - End - Begin VB.Label lblObjective - Alignment = 1 'Right Justify - Caption = "Objective:" - Height = 255 - Left = 2400 - TabIndex = 6 - Top = 720 - Width = 735 - End - Begin VB.Label lblName - Alignment = 1 'Right Justify - Caption = "Name:" - Height = 255 - Left = 2640 - TabIndex = 4 - Top = 240 - Width = 495 - End - Begin VB.Label lblHUDItems - Caption = "Unlockables:" - Height = 255 - Left = 120 - TabIndex = 1 - Top = 240 - Width = 975 - End -End -Attribute VB_Name = "frmUnlockablesEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdDelete_Click() - Call WriteUnlockableItem(True) -End Sub - -Private Sub cmdSave_Click() - Call WriteUnlockableItem(False) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub Reload() - txtName.Text = "" - txtObjective.Text = "" - txtNeededEmblems.Text = "" - txtNeededTime.Text = "" - cmbType.Text = "" - txtVar.Text = "" - - Dim i As Integer - - For i = 0 To chkGrade.Count - 1 - chkGrade(i).Value = 0 - Next i - - lstUnlockables.ListIndex = 0 -End Sub - -Private Sub lstUnlockables_Click() - Call ReadSOC(lstUnlockables.ListIndex + 1) -End Sub - -Private Sub ReadSOC(UnlockableNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "UNLOCKABLE" And Val(word2) = UnlockableNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "NAME" Then - txtName.Text = word2 - ElseIf word = "OBJECTIVE" Then - txtObjective.Text = word2 - ElseIf word = "NEEDEDEMBLEMS" Then - txtNeededEmblems.Text = Val(word2) - ElseIf word = "NEEDEDTIME" Then - txtNeededTime.Text = Val(word2) - ElseIf word = "TYPE" Then - cmbType.ListIndex = Val(word2) - ElseIf word = "VAR" Then - txtVar.Text = Val(word2) - ElseIf word = "NEEDEDGRADE" Then - Dim i As Integer - - For i = 0 To chkGrade.Count - 1 - If Val(word2) And chkGrade(i).Tag Then - chkGrade(i).Tag = True - End If - Next i - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteUnlockableItem(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim unlockableremoved As Boolean - - unlockableremoved = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current item exists in the SOC, delete it. - If word = "UNLOCKABLE" And Val(word2) = lstUnlockables.ListIndex + 1 Then - unlockableremoved = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not tsSource.AtEndOfStream - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "UNLOCKABLE " & lstUnlockables.ListIndex + 1 - txtName.Text = TrimComplete(txtName.Text) - txtObjective.Text = TrimComplete(txtObjective.Text) - txtNeededEmblems.Text = TrimComplete(txtNeededEmblems.Text) - txtNeededTime.Text = TrimComplete(txtNeededTime.Text) - txtVar.Text = TrimComplete(txtVar.Text) - - If txtName.Text <> "" Then tsTarget.WriteLine "NAME = " & txtName.Text - If txtObjective.Text <> "" Then tsTarget.WriteLine "OBJECTIVE = " & txtObjective.Text - If txtNeededEmblems.Text <> "" Then tsTarget.WriteLine "NEEDEDEMBLEMS = " & txtNeededEmblems.Text - If txtNeededTime.Text <> "" Then tsTarget.WriteLine "NEEDEDTIME = " & txtNeededTime.Text - If cmbType.ListIndex <> -1 Then tsTarget.WriteLine "TYPE = " & cmbType.ListIndex - If txtVar.Text <> "" Then tsTarget.WriteLine "VAR = " & txtVar.Text - - Dim writegrade As Long - Dim i As Integer - writegrade = 0 - - For i = 0 To chkGrade.Count - 1 - If chkGrade(i).Value = 1 Then - writegrade = writegrade + chkGrade(i).Tag - End If - Next i - - If writegrade > 0 Then tsTarget.WriteLine "NEEDEDGRADE = " & writegrade - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If unlockableremoved = True Then - MsgBox "Unlockable deleted from SOC." - Else - MsgBox "Couldn't find Unlockable in SOC." - End If - Else - MsgBox "Unlockable Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmUnlockablesEdit.frx b/tools/SOCEdit/frmUnlockablesEdit.frx deleted file mode 100644 index d9d464d4e..000000000 Binary files a/tools/SOCEdit/frmUnlockablesEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/icon1.ico b/tools/SOCEdit/icon1.ico deleted file mode 100644 index 1ea9d1005..000000000 Binary files a/tools/SOCEdit/icon1.ico and /dev/null differ diff --git a/tools/SRB2Launcher/ReadMe.txt b/tools/SRB2Launcher/ReadMe.txt deleted file mode 100644 index 9aafe08b8..000000000 --- a/tools/SRB2Launcher/ReadMe.txt +++ /dev/null @@ -1,35 +0,0 @@ -======================================================================== - WIN32 APPLICATION : SRB2Launcher -======================================================================== - - -AppWizard has created this SRB2Launcher application for you. - -This file contains a summary of what you will find in each of the files that -make up your SRB2Launcher application. - -SRB2Launcher.cpp - This is the main application source file. - -SRB2Launcher.dsp - This file (the project file) contains information at the project level and - is used to build a single project or subproject. Other users can share the - project (.dsp) file, but they should export the makefiles locally. - - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named SRB2Launcher.pch and a precompiled types file named StdAfx.obj. - - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - - -///////////////////////////////////////////////////////////////////////////// diff --git a/tools/SRB2Launcher/SRB2Launcher.cpp b/tools/SRB2Launcher/SRB2Launcher.cpp deleted file mode 100644 index 4138676d3..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.cpp +++ /dev/null @@ -1,1155 +0,0 @@ -///////////////////////////// -// // -// Sonic Robo Blast 2 // -// Official Win32 Launcher // -// // -// By // -// SSNTails // -// ah518@tcnet.org // -// (Sonic Team Junior) // -// http://www.srb2.org // -// // -///////////////////////////// -// -// This source code is released under -// Public Domain. I hope it helps you -// learn how to write exciting Win32 -// applications in C! -// -// However, you may not alter this -// program and continue to call it -// the "Official Sonic Robo Blast 2 -// Launcher". -// -// NOTE: Not all files in this project -// are released under this license. -// Any license mentioned in accompanying -// source files overrides the license -// mentioned here, sorry! -// -// SRB2Launcher.cpp : Defines the entry point for the application. -// - -#include "stdafx.h" -#include -#include -#include "SRB2Launcher.h" - -char TempString[256]; - -char Arguments[16384]; - -HWND mainHWND; -HWND hostHWND; -HWND joinHWND; -HINSTANCE g_hInst; - -HANDLE ServerlistThread = 0; - -typedef struct -{ - char nospecialrings; - char suddendeath; - char scoringtype[16]; - char matchboxes[16]; - int respawnitemtime; - int timelimit; - int pointlimit; -} matchsettings_t; - -typedef struct -{ - char raceitemboxes[16]; - int numlaps; -} racesettings_t; - -typedef struct -{ - char nospecialrings; - char matchboxes[16]; - int respawnitemtime; - int timelimit; - int pointlimit; -} tagsettings_t; - -typedef struct -{ - char nospecialrings; - char matchboxes[16]; - int respawnitemtime; - int timelimit; - int flagtime; - int pointlimit; -} ctfsettings_t; - -typedef struct -{ - char nofile; - char nodownload; -} joinsettings_t; - -typedef struct -{ - matchsettings_t match; - racesettings_t race; - tagsettings_t tag; - ctfsettings_t ctf; - char gametype[16]; - char startmap[9]; - int maxplayers; - char advancestage[16]; - int inttime; - char forceskin; - char noautoaim; - char nosend; - char noadvertise; - - // Monitor Toggles... - char teleporters[8]; - char superring[8]; - char silverring[8]; - char supersneakers[8]; - char invincibility[8]; - char jumpshield[8]; - char watershield[8]; - char ringshield[8]; - char fireshield[8]; - char bombshield[8]; - char oneup[8]; - char eggmanbox[8]; -} hostsettings_t; - -typedef struct -{ - hostsettings_t host; - joinsettings_t join; - char EXEName[1024]; - char ConfigFile[1024]; - char ManualParameters[8192]; - char PlayerName[24]; - char PlayerColor[16]; - char PlayerSkin[24]; -} settings_t; - -// Whole structure is just dumped to a binary file when settings are saved. -settings_t launchersettings; - -#define APPTITLE "Official Sonic Robo Blast 2 Launcher" -#define APPVERSION "v0.1" -#define APPAUTHOR "SSNTails" -#define APPCOMPANY "Sonic Team Junior" - -LRESULT CALLBACK MainProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); - -// -// RunSRB2 -// -// Runs SRB2 -// returns true if successful -// -BOOL RunSRB2(void) -{ - SHELLEXECUTEINFO lpExecInfo; - BOOL result; - char EXEName[1024]; - - memset(&lpExecInfo, 0, sizeof(SHELLEXECUTEINFO)); - - lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); - - SendMessage(GetDlgItem(mainHWND, IDC_EXENAME), WM_GETTEXT, sizeof(EXEName), (LPARAM)(LPCSTR)EXEName); - lpExecInfo.lpFile = EXEName; - lpExecInfo.lpParameters = Arguments; - lpExecInfo.nShow = SW_SHOWNORMAL; - lpExecInfo.hwnd = mainHWND; - lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; - lpExecInfo.lpVerb = "open"; - - result = ShellExecuteEx(&lpExecInfo); - - if(!result) - { - MessageBox(mainHWND, "Error starting the game!", "Error", MB_OK|MB_APPLMODAL|MB_ICONERROR); - return false; - } - - return true; -} - -// -// ChooseEXEName -// -// Provides a common dialog box -// for selecting the desired executable. -// -void ChooseEXEName(void) -{ - OPENFILENAME ofn; - char FileBuffer[256]; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = NULL; - FileBuffer[0] = '\0'; - ofn.lpstrFilter = "Executable Files\0*.exe\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(GetOpenFileName(&ofn)) - { - SendMessage(GetDlgItem(mainHWND, IDC_EXENAME), WM_SETTEXT, 0, (LPARAM)(LPCSTR)FileBuffer); - strcpy(launchersettings.EXEName, FileBuffer); - } -} - -// -// ChooseConfigName -// -// Provides a common dialog box -// for selecting the desired cfg file. -// -void ChooseConfigName(void) -{ - OPENFILENAME ofn; - char FileBuffer[256]; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = NULL; - FileBuffer[0] = '\0'; - ofn.lpstrFilter = "Config Files\0*.cfg\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(GetOpenFileName(&ofn)) - { - SendMessage(GetDlgItem(mainHWND, IDC_CONFIGFILE), WM_SETTEXT, 0, (LPARAM)(LPCSTR)FileBuffer); - strcpy(launchersettings.ConfigFile, FileBuffer); - } -} - -// -// Add External File -// -// Provides a common dialog box -// for adding an external file. -// -void AddExternalFile(void) -{ - OPENFILENAME ofn; - char FileBuffer[256]; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = NULL; - FileBuffer[0] = '\0'; - ofn.lpstrFilter = "WAD/SOC Files\0*.soc;*.wad\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(GetOpenFileName(&ofn) && SendMessage(GetDlgItem(mainHWND, IDC_EXTFILECOMBO), CB_FINDSTRING, -1, (LPARAM)(LPCSTR)FileBuffer) == CB_ERR) - SendMessage(GetDlgItem(mainHWND, IDC_EXTFILECOMBO), CB_ADDSTRING, 0, (LPARAM)(LPCSTR)FileBuffer); -} - -// -// CompileArguments -// -// Go through ALL of the settings -// and put them into a parameter -// string. Yikes! -// -void CompileArguments(void) -{ - HWND temp; - int numitems; - int i; - - // Clear out the arguments, if any existed. - memset(Arguments, 0, sizeof(Arguments)); - - - // WAD/SOC Files Added - temp = GetDlgItem(mainHWND, IDC_EXTFILECOMBO); - - if ((numitems = SendMessage(temp, CB_GETCOUNT, 0, 0)) > 0) - { - char tempbuffer[1024]; - - strcpy(Arguments, "-file "); - - for (i = 0; i < numitems; i++) - { - SendMessage(temp, CB_GETLBTEXT, i, (LPARAM)(LPCSTR)tempbuffer); - strcat(Arguments, tempbuffer); - strcat(Arguments, " "); - } - } - - // Manual Parameters - temp = GetDlgItem(mainHWND, IDC_PARAMETERS); - - if (SendMessage(temp, WM_GETTEXTLENGTH, 0, 0) > 0) - { - char tempbuffer[8192]; - - SendMessage(temp, WM_GETTEXT, 8192, (LPARAM)(LPCSTR)tempbuffer); - - strcat(Arguments, tempbuffer); - } -} - -// -// GetConfigVariable -// -// Pulls a value out of the chosen -// config.cfg and places it into the -// string supplied in 'dest' -// -BOOL GetConfigVariable(char* varname, char* dest) -{ - FILE* f; - int size = 0; - char* buffer; - char* posWeWant; - char* stringstart; - char varnamecpy[256]; - - varnamecpy[0] = '\n'; - - strncpy(varnamecpy+1, varname, 255); - - if(!(f = fopen(launchersettings.ConfigFile, "rb"))) - return false; // Oops! - - // Get file size - while(!feof(f)) - { - size++; - fgetc(f); - } - - fseek(f, 0, SEEK_SET); - - buffer = (char*)malloc(size); - - fread(buffer, size, 1, f); - fclose(f); - - posWeWant = strstr(buffer, varname); - - if(posWeWant == NULL) - { - free(buffer); - return false; - } - - posWeWant++; - - // We are now at the line we want. - // Get the variable from it - - while(*posWeWant != '\"') posWeWant++; - - posWeWant++; - - stringstart = posWeWant; - - while(*posWeWant != '\"') posWeWant++; - - *posWeWant = '\0'; - - strcpy(dest, stringstart); - - free(buffer); - - // Phew! - return true; -} - -SOCKET ConnectSocket(char* IPAddress, int portnumber) -{ - DWORD dwDestAddr; - SOCKADDR_IN sockAddrDest; - SOCKET sockDest; - - // Create socket - sockDest = socket(AF_INET, SOCK_STREAM, 0); - - if(sockDest == SOCKET_ERROR) - { -// printf("Could not create socket: %d\n", WSAGetLastError()); - return INVALID_SOCKET; - } - - // Convert address to in_addr (binary) format - dwDestAddr = inet_addr(IPAddress); - - if(dwDestAddr == INADDR_NONE) - { - // It's not a xxx.xxx.xxx.xxx IP, so resolve through DNS - struct hostent* pHE = gethostbyname(IPAddress); - if(pHE == 0) - { -// printf("Unable to resolve address.\n"); - return INVALID_SOCKET; - } - - dwDestAddr = *((u_long*)pHE->h_addr_list[0]); - } - - // Initialize SOCKADDR_IN with IP address, port number and address family - memcpy(&sockAddrDest.sin_addr, &dwDestAddr, sizeof(DWORD)); - - sockAddrDest.sin_port = htons(portnumber); - sockAddrDest.sin_family = AF_INET; - - // Attempt to connect to server - if(connect(sockDest, (LPSOCKADDR)&sockAddrDest, sizeof(sockAddrDest)) == SOCKET_ERROR) - { -// printf("Could not connect to server socket: %d\n", WSAGetLastError()); - closesocket(sockDest); - return INVALID_SOCKET; - } - - return sockDest; -} - -// -// MS_Write(): -// -static int MS_Write(msg_t *msg, SOCKET socket) -{ -#ifdef NONET - msg = NULL; - return MS_WRITE_ERROR; -#else - int len; - - if (msg->length < 0) - msg->length = (long)strlen(msg->buffer); - len = msg->length + HEADER_SIZE; - - msg->type = htonl(msg->type); - msg->length = htonl(msg->length); - - if (send(socket, (char *)msg, len, 0) != len) - return MS_WRITE_ERROR; - return 0; -#endif -} - -// -// MS_Read(): -// -static int MS_Read(msg_t *msg, SOCKET socket) -{ -#ifdef NONET - msg = NULL; - return MS_READ_ERROR; -#else - if (recv(socket, (char *)msg, HEADER_SIZE, 0) != HEADER_SIZE) - return MS_READ_ERROR; - - msg->type = ntohl(msg->type); - msg->length = ntohl(msg->length); - - if (!msg->length) // fix a bug in Windows 2000 - return 0; - - if (recv(socket, (char *)msg->buffer, msg->length, 0) != msg->length) - return MS_READ_ERROR; - return 0; -#endif -} - -/** Gets a list of game servers from the master server. - */ -static inline int GetServersList(SOCKET socket) -{ - msg_t msg; - int count = 0; - - msg.type = GET_SERVER_MSG; - msg.length = 0; - if (MS_Write(&msg, socket) < 0) - return MS_WRITE_ERROR; - - while (MS_Read(&msg, socket) >= 0) - { - if (!msg.length) - { -// if (!count) -// printf("No server currently running.\n"); - return MS_NO_ERROR; - } - count++; - printf(msg.buffer); - } - - return MS_READ_ERROR; -} - -// -// RunSocketStuff -// -// Thread that checks the masterserver for new games. -void RunSocketStuff(HWND hListView) -{ - WSADATA wsaData; - SOCKET sock; - int i = 0; - char ServerAddressAndPort[256]; - char Address[256]; - char Port[8]; - - if(!GetConfigVariable("masterserver", ServerAddressAndPort)) // srb2.servegame.org:28900 - { - ServerlistThread = NULL; - return; - } - - strcpy(Address, ServerAddressAndPort); - - for(i = 0; i < (signed)strlen(Address); i++) - { - if(Address[i] == ':') - { - Address[i] = '\0'; - break; - } - } - - for(i = 0; i < (signed)strlen(ServerAddressAndPort); i++) - { - if(ServerAddressAndPort[i] == ':') - { - strcpy(Port, &ServerAddressAndPort[i+1]); - break; - } - } - - // Address now contains the hostname or IP - // Port now contains the port number - - - // Initialize WinSock - if(WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) - { -// printf("Could not initialize sockets.\n"); - ServerlistThread = NULL; - return; - } - - // Create socket and connect to server - sock = ConnectSocket(/*IPAddress*/0, /*PortNumber*/0); - if(sock == INVALID_SOCKET) - { -// printf("Socket Error: %d\n", WSAGetLastError()); - ServerlistThread = NULL; - return; - } - - // We're connected! - // Now get information from server - - - // Add games to listview box. - ListView_DeleteAllItems(hListView); - -/* - while (MoreServersStillExist) - { - GetTheNextServerInformation(); - AddItemToList(hListView, servername, ping, players, gametype, level); - } -*/ - - // close socket - closesocket(sock); - - // Clean up WinSock - if(WSACleanup() == SOCKET_ERROR) - { -// printf("Could not cleanup sockets: %d\n", WSAGetLastError()); - ServerlistThread = NULL; - return; - } - - printf("Winsock thread terminated successfully.\n"); - ServerlistThread = NULL; - - return; -} - -BOOL GetGameList(HWND hListView) -{ - DWORD dwThreadID; - ServerlistThread = CreateThread( NULL, // default security - 0, // default stack - (LPTHREAD_START_ROUTINE)(void*)RunSocketStuff, // thread function - hListView, // arguments - 0, // default flags - &dwThreadID); // don't need this, but it makes it happy (and compatible with old Win32 OSes) - - if(ServerlistThread == NULL) - return false; - - return true; -} - -void RegisterDialogClass(char* name, WNDPROC callback) -{ - WNDCLASS wnd; - - wnd.style = CS_HREDRAW | CS_VREDRAW; - wnd.cbWndExtra = DLGWINDOWEXTRA; - wnd.cbClsExtra = 0; - wnd.hCursor = LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW)); - wnd.hIcon = LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON1)); - wnd.hInstance = g_hInst; - wnd.lpfnWndProc = callback; - wnd.lpszClassName = name; - wnd.lpszMenuName = NULL; - wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW); - - if(!RegisterClass(&wnd)) - { - return; - } -} - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - // Prevent multiples instances of this app. - CreateMutex(NULL, true, APPTITLE); - - if(GetLastError() == ERROR_ALREADY_EXISTS) - return 0; - - g_hInst = hInstance; - - RegisterDialogClass("SRB2Launcher", MainProc); - - DialogBox(g_hInst, (LPCSTR)IDD_MAIN, NULL, (DLGPROC)MainProc); - - return 0; -} - -// -// InitHostOptionsComboBoxes -// -// Does what it says. -// -void InitHostOptionsComboBoxes(HWND hwnd) -{ - HWND ctrl; - - ctrl = GetDlgItem(hwnd, IDC_MATCHBOXES); - - if(ctrl) - { - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Normal (Default)"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Random"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Non-Random"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - } - - ctrl = GetDlgItem(hwnd, IDC_RACEITEMBOXES); - - if(ctrl) - { - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Normal (Default)"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Random"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Teleports"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - } - - ctrl = GetDlgItem(hwnd, IDC_MATCH_SCORING); - - if(ctrl) - { - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Normal (Default)"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Classic"); - } -} - -LRESULT CALLBACK MatchOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK RaceOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK TagOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK CTFOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK HostProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND temp; - - switch(message) - { - case WM_INITDIALOG: - hostHWND = hwnd; - - temp = GetDlgItem(hwnd, IDC_ADVANCEMAP); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Off"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Next (Default)"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Random"); - - temp = GetDlgItem(hwnd, IDC_GAMETYPE); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Coop"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Match"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Team Match"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Race"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Time-Only Race"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Tag"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"CTF"); - - break; - - case WM_CREATE: - { - - break; - } - - case WM_DESTROY: - { - hostHWND = NULL; - EndDialog(hwnd, LOWORD(wParam)); - break; - } - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - case IDC_OPTIONS: - { - int gametype; - int dialognum; - DLGPROC callbackfunc; - - // Grab the current gametype from the IDC_GAMETYPE - // combo box and then display the appropriate - // options dialog. - temp = GetDlgItem(hostHWND, IDC_GAMETYPE); - switch(SendMessage(temp, CB_GETCURSEL, 0, 0)) - { - case 0: - gametype = 0; - break; - case 1: - gametype = 1; - break; - case 2: - gametype = 1; - break; - case 3: - gametype = 2; - break; - case 4: - gametype = 2; - break; - case 5: - gametype = 3; - break; - case 6: - gametype = 4; - break; - } - - switch(gametype) - { - case 1: - dialognum = IDD_MATCHOPTIONS; - callbackfunc = (DLGPROC)MatchOptionsDlgProc; - break; - case 2: - dialognum = IDD_RACEOPTIONS; - callbackfunc = (DLGPROC)RaceOptionsDlgProc; - break; - case 3: - dialognum = IDD_TAGOPTIONS; - callbackfunc = (DLGPROC)TagOptionsDlgProc; - break; - case 4: - dialognum = IDD_CTFOPTIONS; - callbackfunc = (DLGPROC)CTFOptionsDlgProc; - break; - case 0: - default: // ??? - dialognum = 0; - callbackfunc = NULL; - MessageBox(hostHWND, "This gametype does not have any additional options.", "Not Available", MB_OK|MB_APPLMODAL); - break; - } - - if(dialognum) - DialogBox(g_hInst, (LPCSTR)dialognum, hostHWND, callbackfunc); - } - break; - default: - break; - } - - break; - } - - case WM_PAINT: - { - break; - } - } - - return 0; -} - -// -// AddItemToList -// -// Adds a game to the list view. -// -void AddItemToList(HWND hListView, char* servername, - char* ping, char* players, - char* gametype, char* level) -{ - LVITEM lvTest; - - lvTest.mask = LVIF_TEXT | LVIF_STATE; - - lvTest.pszText = servername; - lvTest.iIndent = 0; - lvTest.stateMask = 0; - lvTest.state = 0; - - lvTest.iSubItem = 0; - lvTest.iItem = ListView_InsertItem(hListView, &lvTest); - - ListView_SetItemText(hListView,lvTest.iItem,1,ping); - - ListView_SetItemText(hListView,lvTest.iItem,2,players); - - ListView_SetItemText(hListView,lvTest.iItem,3,gametype); - - ListView_SetItemText(hListView,lvTest.iItem,4,level); -} - -// -// InitJoinGameColumns -// -// Initializes the column headers on the listview control -// on the Join Game page. -// -void InitJoinGameColumns(HWND hDlg) -{ - HWND hItemList; - LVCOLUMN columns[10]; - int i = 0; - - //Create the columns in the list control - hItemList = GetDlgItem(hDlg, IDC_GAMELIST); - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Server Name"; - columns[i].cchTextMax = 256; - columns[i].cx = 120; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Ping"; - columns[i].cchTextMax = 256; - columns[i].cx = 80; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Players"; - columns[i].cchTextMax = 256; - columns[i].cx = 80; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Game Type"; - columns[i].cchTextMax = 256; - columns[i].cx = 80; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Level"; - columns[i].cchTextMax = 256; - columns[i].cx = 120; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); -} - -LRESULT CALLBACK JoinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - joinHWND = hwnd; - InitJoinGameColumns(hwnd); - // Start server listing thread - // and grab game list. - GetGameList(GetDlgItem(hwnd, IDC_GAMELIST)); - break; - - case WM_DESTROY: - joinHWND = NULL; - // Terminate server listing thread. - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - case IDC_SEARCHGAMES: - if(ServerlistThread == NULL) - GetGameList(GetDlgItem(hwnd, IDC_GAMELIST)); - break; - default: - break; - } - - break; - } - - case WM_PAINT: - { - break; - } - } - - return 0; -} - -void InitializeDefaults(void) -{ - memset(&launchersettings, 0, sizeof(launchersettings)); - strcpy(launchersettings.EXEName, "srb2win.exe"); - strcpy(launchersettings.ConfigFile, "config.cfg"); -} - -LRESULT CALLBACK MainProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND temp; - - switch(message) - { - case WM_INITDIALOG: - mainHWND = hwnd; - InitializeDefaults(); - SendMessage(GetDlgItem(hwnd, IDC_EXENAME), WM_SETTEXT, 0, (LPARAM)(LPCSTR)launchersettings.EXEName); - SendMessage(GetDlgItem(hwnd, IDC_CONFIGFILE), WM_SETTEXT, 0, (LPARAM)(LPCSTR)launchersettings.ConfigFile); - break; - - case WM_CREATE: - { - - break; - } - - case WM_DESTROY: - { - PostQuitMessage(0); - break; - } - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - case IDC_ABOUT: // The About button. - sprintf(TempString, "%s %s by %s - %s", APPTITLE, APPVERSION, APPAUTHOR, APPCOMPANY); - MessageBox(mainHWND, TempString, "About", MB_OK|MB_APPLMODAL); - break; - case IDC_FINDEXENAME: - ChooseEXEName(); - break; - case IDC_FINDCONFIGNAME: - ChooseConfigName(); - break; - case IDC_ADDFILE: - AddExternalFile(); - break; - case IDC_REMOVEFILE: - temp = GetDlgItem(mainHWND, IDC_EXTFILECOMBO); - SendMessage(temp, CB_DELETESTRING, SendMessage(temp, CB_GETCURSEL, 0, 0), 0); - break; - case IDC_HOSTGAME: - DialogBox(g_hInst, (LPCSTR)IDD_HOSTGAME, mainHWND, (DLGPROC)HostProc); - break; - case IDC_JOINGAME: - DialogBox(g_hInst, (LPCSTR)IDD_JOINGAME, mainHWND, (DLGPROC)JoinProc); - break; - case IDC_GO: - CompileArguments(); - RunSRB2(); - break; - default: - break; - } - - break; - } - - case WM_PAINT: - { - break; - } - } - - return 0; -} - diff --git a/tools/SRB2Launcher/SRB2Launcher.dsp b/tools/SRB2Launcher/SRB2Launcher.dsp deleted file mode 100644 index 386dc301c..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.dsp +++ /dev/null @@ -1,144 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SRB2Launcher" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SRB2Launcher - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SRB2Launcher.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SRB2Launcher.mak" CFG="SRB2Launcher - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SRB2Launcher - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SRB2Launcher - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SRB2Launcher - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "SRB2Launcher - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SRB2Launcher - Win32 Release" -# Name "SRB2Launcher - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\SRB2Launcher.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\lilsocklib.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\SRB2Launcher.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\bitmap1.bmp -# End Source File -# Begin Source File - -SOURCE=.\icon1.ico -# End Source File -# Begin Source File - -SOURCE=.\Script1.rc -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/tools/SRB2Launcher/SRB2Launcher.dsw b/tools/SRB2Launcher/SRB2Launcher.dsw deleted file mode 100644 index b716faced..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SRB2Launcher"=.\SRB2Launcher.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/tools/SRB2Launcher/SRB2Launcher.h b/tools/SRB2Launcher/SRB2Launcher.h deleted file mode 100644 index 3b9049f82..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.h +++ /dev/null @@ -1,8 +0,0 @@ -extern char TempString[256]; -extern char EXEName[1024]; -extern char Arguments[16384]; - -#define APPTITLE "Official Sonic Robo Blast 2 Launcher" -#define APPVERSION "v0.1" -#define APPAUTHOR "SSNTails" -#define APPCOMPANY "Sonic Team Junior" diff --git a/tools/SRB2Launcher/Script1.rc b/tools/SRB2Launcher/Script1.rc deleted file mode 100644 index 1a27c0414..000000000 --- a/tools/SRB2Launcher/Script1.rc +++ /dev/null @@ -1,355 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MAIN DIALOG DISCARDABLE 0, 0, 272, 226 -STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Official Sonic Robo Blast 2 Launcher v0.1" -FONT 8, "MS Sans Serif" -BEGIN - COMBOBOX IDC_LAUNCHCONFIG,125,15,135,155,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Saved Launch Configuration",IDC_STATIC,120,5,145,45 - GROUPBOX "WAD/SOC Files",IDC_STATIC,120,55,145,45 - COMBOBOX IDC_EXTFILECOMBO,125,65,135,95,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - CONTROL 102,IDC_STATIC,"Static",SS_BITMAP,5,90,107,79 - PUSHBUTTON "&About",IDC_ABOUT,125,210,25,10 - DEFPUSHBUTTON "&Go!",IDC_GO,60,150,50,14 - PUSHBUTTON "Add",IDC_ADDFILE,225,80,35,15 - PUSHBUTTON "Remove",IDC_REMOVEFILE,185,80,35,15 - PUSHBUTTON "Save",IDC_SAVELAUNCHCFG,220,30,40,15 - GROUPBOX "Multiplayer",IDC_STATIC,5,5,105,50 - PUSHBUTTON "&Join A Game",IDC_JOINGAME,10,15,50,15 - PUSHBUTTON "&Host A Game",IDC_HOSTGAME,55,35,50,15 - EDITTEXT IDC_PARAMETERS,160,190,105,30,ES_MULTILINE | - ES_AUTOVSCROLL | WS_VSCROLL - RTEXT "Manual Parameters:",IDC_STATIC,115,190,40,15 - GROUPBOX "Executable Name",IDC_STATIC,120,105,145,50 - EDITTEXT IDC_EXENAME,125,115,95,12,ES_AUTOHSCROLL - PUSHBUTTON "Choose...",IDC_FINDEXENAME,225,115,35,10 - PUSHBUTTON "General &Options",IDC_OPTIONS,55,60,50,20,BS_MULTILINE - EDITTEXT IDC_CONFIGFILE,125,140,95,12,ES_AUTOHSCROLL - LTEXT "Configuration File:",IDC_STATIC,125,130,60,10 - PUSHBUTTON "Choose...",IDC_FINDCONFIGNAME,225,140,35,10 - CONTROL "List1",IDC_LIST1,"SysListView32",WS_BORDER | WS_TABSTOP, - 20,180,85,40 -END - -IDD_JOINGAME DIALOG DISCARDABLE 0, 0, 367, 166 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Join Game" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "&Refresh List",IDC_SEARCHGAMES,5,140,55,20,BS_MULTILINE - CONTROL "List1",IDC_GAMELIST,"SysListView32",LVS_REPORT | - LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,5,15,240,120 - EDITTEXT IDC_NAME,295,10,65,12,ES_AUTOHSCROLL - COMBOBOX IDC_COLOR,295,30,65,130,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Name:",IDC_STATIC,265,10,25,10 - RTEXT "Color:",IDC_STATIC,265,30,25,10 - COMBOBOX IDC_SKIN,295,50,65,110,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Character:",IDC_STATIC,255,50,35,10 - EDITTEXT IDC_ADDRESS,255,115,70,12,ES_AUTOHSCROLL - LTEXT "Manual Address:",IDC_STATIC,255,105,60,10 - CONTROL "Don't check server for files.",IDC_NOFILE,"Button", - BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,255,70,105, - 10 - DEFPUSHBUTTON "&Go!",IDC_JOINSTART,330,115,30,15 - LTEXT "Double-Click on a game to join:",IDC_STATIC,5,5,215,10 - CONTROL "Don't download files",IDC_NODOWNLOAD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,255,90,105,10 -END - -IDD_HOSTGAME DIALOG DISCARDABLE 0, 0, 287, 156 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Host Game" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Game Type",IDC_STATIC,5,5,110,65 - PUSHBUTTON "&Options...",IDC_OPTIONS,55,30,40,15 - COMBOBOX IDC_GAMETYPE,10,15,85,100,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Max # of players:",IDC_STATIC,35,86,70,10 - EDITTEXT IDC_MAXPLAYERS,110,86,20,12,ES_AUTOHSCROLL - GROUPBOX "General Options",IDC_STATIC,5,75,275,75 - COMBOBOX IDC_STARTMAP,40,50,70,95,CBS_DROPDOWN | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Start on map #:",IDC_STATIC,10,45,25,20 - CONTROL "Force players to use host's character",IDC_FORCESKIN, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,140, - 85,135,10 - COMBOBOX IDC_ADVANCEMAP,45,105,85,50,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - RTEXT "Advance Stage:",IDC_STATIC,10,100,30,20 - CONTROL "Don't advertise server on Internet",IDC_INTERNETSERVER, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,140, - 130,120,10 - RTEXT "Intermission Delay Between Levels (in seconds):", - IDC_STATIC,10,125,90,15 - EDITTEXT IDC_INTTIME,105,130,20,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Don't allow autoaim",IDC_DISABLEAUTOAIM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,100,75,10 - CONTROL "Disable WAD/SOC Downloading",IDC_NODOWNLOAD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,115,120,10 - PUSHBUTTON "Monitor &Toggles...",IDC_MONITORTOGGLES,125,45,40,20, - BS_MULTILINE -END - -IDD_MATCHOPTIONS DIALOG DISCARDABLE 0, 0, 142, 141 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Match Options" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Don't use special ring weapons.",IDC_SPECIALRINGS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,5,115,10 - RTEXT "Item Box Behavior:",IDC_STATIC,5,50,60,10 - EDITTEXT IDC_RESPAWNITEMTIME,115,70,20,12,ES_AUTOHSCROLL | - ES_NUMBER - COMBOBOX IDC_MATCHBOXES,70,50,65,65,CBS_DROPDOWN | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Item Respawn Time (in seconds):",IDC_STATIC,5,70,105,10 - EDITTEXT IDC_TIMELIMIT,115,84,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Time Limit (in minutes):",IDC_STATIC,35,84,75,10 - RTEXT "Point Limit:",IDC_STATIC,70,100,40,10 - EDITTEXT IDC_POINTLIMIT,115,100,20,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Sudden Death Mode",IDC_SUDDENDEATH,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,20,80,10 - COMBOBOX IDC_MATCH_SCORING,70,35,65,65,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - RTEXT "Scoring Type:",IDC_STATIC,15,35,50,10 - PUSHBUTTON "Cance&l",IDC_CANCEL,100,120,35,15 - DEFPUSHBUTTON "O&K",IDC_OK,60,120,35,15 -END - -IDD_RACEOPTIONS DIALOG DISCARDABLE 0, 0, 142, 71 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Race Options" -FONT 8, "MS Sans Serif" -BEGIN - RTEXT "Item Box Behavior:",IDC_STATIC,5,10,60,10 - COMBOBOX IDC_RACEITEMBOXES,70,10,65,55,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_NUMLAPS,115,30,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Number of Laps:",IDC_STATIC,55,30,55,10 - PUSHBUTTON "Cance&l",IDC_CANCEL,100,50,35,15 - DEFPUSHBUTTON "O&K",IDC_OK,60,50,35,15 -END - -IDD_CTFOPTIONS DIALOG DISCARDABLE 0, 0, 142, 126 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "CTF Options" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Don't use special ring weapons.",IDC_SPECIALRINGS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,5,115,10 - RTEXT "Item Box Behavior:",IDC_STATIC,5,20,60,10 - COMBOBOX IDC_MATCHBOXES,70,20,65,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Item Respawn Time (in seconds):",IDC_STATIC,5,40,105,10 - EDITTEXT IDC_RESPAWNITEMTIME,115,40,20,12,ES_AUTOHSCROLL | - ES_NUMBER - RTEXT "Time Limit (in minutes):",IDC_STATIC,35,70,75,10 - EDITTEXT IDC_TIMELIMIT,115,70,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Point Limit:",IDC_STATIC,70,86,40,10 - EDITTEXT IDC_POINTLIMIT,115,86,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Flag Respawn Time (in seconds):",IDC_STATIC,5,55,105,10 - EDITTEXT IDC_FLAGTIME,115,55,20,12,ES_AUTOHSCROLL | ES_NUMBER - PUSHBUTTON "Cance&l",IDC_CANCEL,100,105,35,15 - DEFPUSHBUTTON "O&K",IDC_OK,60,105,35,15 -END - -IDD_TAGOPTIONS DIALOG DISCARDABLE 0, 0, 142, 111 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Tag Options" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Don't use special ring weapons.",IDC_SPECIALRINGS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,5,115,10 - COMBOBOX IDC_MATCHBOXES,70,20,65,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Item Box Behavior:",IDC_STATIC,5,20,60,10 - DEFPUSHBUTTON "O&K",IDC_OK,60,90,35,15 - PUSHBUTTON "Cance&l",IDC_CANCEL,100,90,35,15 - RTEXT "Item Respawn Time (in seconds):",IDC_STATIC,5,40,105,10 - EDITTEXT IDC_RESPAWNITEMTIME,115,40,20,12,ES_AUTOHSCROLL | - ES_NUMBER - RTEXT "Time Limit (in minutes):",IDC_STATIC,35,55,75,10 - EDITTEXT IDC_TIMELIMIT,115,55,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Point Limit:",IDC_STATIC,70,70,40,10 - EDITTEXT IDC_POINTLIMIT,115,70,20,12,ES_AUTOHSCROLL | ES_NUMBER -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 265 - TOPMARGIN, 7 - BOTTOMMARGIN, 219 - END - - IDD_JOINGAME, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 360 - TOPMARGIN, 7 - BOTTOMMARGIN, 159 - END - - IDD_HOSTGAME, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 280 - TOPMARGIN, 7 - BOTTOMMARGIN, 149 - END - - IDD_MATCHOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 134 - END - - IDD_RACEOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 64 - END - - IDD_CTFOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 119 - END - - IDD_TAGOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 104 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_BITMAP1 BITMAP DISCARDABLE "bitmap1.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON1 ICON DISCARDABLE "icon1.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_JOINGAME DLGINIT -BEGIN - IDC_SKIN, 0x403, 6, 0 -0x6f53, 0x696e, 0x0063, - IDC_SKIN, 0x403, 6, 0 -0x6154, 0x6c69, 0x0073, - IDC_SKIN, 0x403, 9, 0 -0x6e4b, 0x6375, 0x6c6b, 0x7365, "\000" - 0 -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/tools/SRB2Launcher/StdAfx.cpp b/tools/SRB2Launcher/StdAfx.cpp deleted file mode 100644 index 444cafebf..000000000 --- a/tools/SRB2Launcher/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// SRB2Launcher.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/tools/SRB2Launcher/StdAfx.h b/tools/SRB2Launcher/StdAfx.h deleted file mode 100644 index 549cbf9ee..000000000 --- a/tools/SRB2Launcher/StdAfx.h +++ /dev/null @@ -1,29 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include -#include -#include -#include "lilsocklib.h" -#include "resource.h" - - -// TODO: reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/tools/SRB2Launcher/bitmap1.bmp b/tools/SRB2Launcher/bitmap1.bmp deleted file mode 100644 index 01b7cecd9..000000000 Binary files a/tools/SRB2Launcher/bitmap1.bmp and /dev/null differ diff --git a/tools/SRB2Launcher/i_tcp.c b/tools/SRB2Launcher/i_tcp.c deleted file mode 100644 index 259b416d3..000000000 --- a/tools/SRB2Launcher/i_tcp.c +++ /dev/null @@ -1,57 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// -// -// DESCRIPTION: -// TCP/IP stuff. -// -//----------------------------------------------------------------------------- - - - - -#include -#include - - -#include "launcher.h" -#include "mserv.h" //Hurdler: support master server - - - - -static int init_tcp_driver = 0; - - -void I_InitTcpDriver(void) -{ - if (!init_tcp_driver) - { -#ifdef __WIN32__ - WSADATA winsockdata; - if( WSAStartup(MAKEWORD(1,1),&winsockdata) ) - I_Error("No Tcp/Ip driver detected"); -#endif -#ifdef __DJGPP_ - if( !__lsck_init() ) - I_Error("No Tcp/Ip driver detected"); -#endif - init_tcp_driver = 1; - } -} diff --git a/tools/SRB2Launcher/i_tcp.h b/tools/SRB2Launcher/i_tcp.h deleted file mode 100644 index 9cd34f930..000000000 --- a/tools/SRB2Launcher/i_tcp.h +++ /dev/null @@ -1,34 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// -// -// DESCRIPTION: -// Header file for the TCP/IP routines -// -//----------------------------------------------------------------------------- - - -#ifndef _I_TCP_H_ -#define _I_TCP_H_ - -extern int sock_port; - -void I_InitTcpDriver(void); - -#endif // !defined(_I_TCP_H_) diff --git a/tools/SRB2Launcher/icon1.ico b/tools/SRB2Launcher/icon1.ico deleted file mode 100644 index f54ce0d6a..000000000 Binary files a/tools/SRB2Launcher/icon1.ico and /dev/null differ diff --git a/tools/SRB2Launcher/launcher.c b/tools/SRB2Launcher/launcher.c deleted file mode 100644 index 4967a95cc..000000000 --- a/tools/SRB2Launcher/launcher.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include "launcher.h" - -int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) -{ - return TRUE; -} - - -void CONS_Printf(char *fmt, ...) -{ - MessageBox(NULL, fmt, "Master Server", 0); -} - -void I_Error (char *error, ...) -{ - MessageBox(NULL, error, "Master Server", MB_ICONERROR); -} diff --git a/tools/SRB2Launcher/launcher.h b/tools/SRB2Launcher/launcher.h deleted file mode 100644 index 12b10aad5..000000000 --- a/tools/SRB2Launcher/launcher.h +++ /dev/null @@ -1,34 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// -// -// DESCRIPTION: -// Header file for the launcher routines -// -//----------------------------------------------------------------------------- - - -#ifndef _LAUNCHER_H_ -#define _LAUNCHER_H_ - - -void CONS_Printf(char *fmt, ...); -void I_Error (char *error, ...); - -#endif // !defined(_LAUNCHER_H_) diff --git a/tools/SRB2Launcher/lilsocklib.h b/tools/SRB2Launcher/lilsocklib.h deleted file mode 100644 index 232f3753a..000000000 --- a/tools/SRB2Launcher/lilsocklib.h +++ /dev/null @@ -1,52 +0,0 @@ -// Unlike lilsocklib.c, since this takes code from SRB2, -// it is under the GPL, rather than public domain. =( -// -#ifndef __LILSOCKLIB_H__ -#define __LILSOCKLIB_H__ - -#define SD_BOTH 0x02 - -#define PACKET_SIZE 1024 - -#define MS_NO_ERROR 0 -#define MS_SOCKET_ERROR -201 -#define MS_CONNECT_ERROR -203 -#define MS_WRITE_ERROR -210 -#define MS_READ_ERROR -211 -#define MS_CLOSE_ERROR -212 -#define MS_GETHOSTBYNAME_ERROR -220 -#define MS_GETHOSTNAME_ERROR -221 -#define MS_TIMEOUT_ERROR -231 - -// see master server code for the values -#define ADD_SERVER_MSG 101 -#define REMOVE_SERVER_MSG 103 -#ifdef MASTERSERVERS12 -#define ADD_SERVERv2_MSG 104 -#endif -#define GET_SERVER_MSG 200 -#define GET_SHORT_SERVER_MSG 205 -#ifdef MASTERSERVERS12 -#define ASK_SERVER_MSG 206 -#define ANSWER_ASK_SERVER_MSG 207 -#endif - -#define HEADER_SIZE ((long)sizeof (long)*3) - -#define HEADER_MSG_POS 0 -#define IP_MSG_POS 16 -#define PORT_MSG_POS 32 -#define HOSTNAME_MSG_POS 40 - -/** A message to be exchanged with the master server. - */ -typedef struct -{ - long id; ///< Unused? - long type; ///< Type of message. - long length; ///< Length of the message. - char buffer[PACKET_SIZE]; ///< Actual contents of the message. -} msg_t; - -SOCKET ConnectSocket(char* IPAddress); -#endif diff --git a/tools/SRB2Launcher/mserv.c b/tools/SRB2Launcher/mserv.c deleted file mode 100644 index 0dd00e2bb..000000000 --- a/tools/SRB2Launcher/mserv.c +++ /dev/null @@ -1,400 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// -// -// DESCRIPTION: -// Commands used to communicate with the master server -// -//----------------------------------------------------------------------------- - - -#ifdef WIN32 -#include // socket(),... -#else -#include -#endif - - - - -#include "launcher.h" - -#include "mserv.h" -#include "i_tcp.h" - - - - - -// ================================ DEFINITIONS =============================== - -#define PACKET_SIZE 1024 - -#define MS_NO_ERROR 0 -#define MS_SOCKET_ERROR -201 -#define MS_CONNECT_ERROR -203 -#define MS_WRITE_ERROR -210 -#define MS_READ_ERROR -211 -#define MS_CLOSE_ERROR -212 -#define MS_GETHOSTBYNAME_ERROR -220 -#define MS_GETHOSTNAME_ERROR -221 -#define MS_TIMEOUT_ERROR -231 - -// see master server code for the values -#define GET_SERVER_MSG 200 - - -#define HEADER_SIZE ((long)sizeof(long)*3) - -#define HEADER_MSG_POS 0 -#define IP_MSG_POS 16 -#define PORT_MSG_POS 32 -#define HOSTNAME_MSG_POS 40 - -#ifndef SOCKET -#define SOCKET int -#endif - -typedef struct { - long id; - long type; - long length; - char buffer[PACKET_SIZE]; -} msg_t; - - -// win32 or djgpp -#if defined( WIN32) || defined( __DJGPP__ ) -#define ioctl ioctlsocket -#define close closesocket -#endif - -#if defined( WIN32) || defined( __OS2__) -// it seems windows doesn't define that... maybe some other OS? OS/2 -int inet_aton(char *hostname, struct in_addr *addr) -{ - return ( (addr->s_addr=inet_addr(hostname)) != INADDR_NONE ); -} -#endif - - - -enum { MSCS_NONE, MSCS_WAITING, MSCS_REGISTERED, MSCS_FAILED } con_state = MSCS_NONE; - - -static SOCKET socket_fd = -1; // TCP/IP socket -static struct sockaddr_in addr; -static struct timeval select_timeout; -static fd_set wset; - -int MS_Connect(char *ip_addr, char *str_port, int async); -static int MS_Read(msg_t *msg); -static int MS_Write(msg_t *msg); -static int MS_GetIP(char *); - -void ExtractServerInfo(char *serverout, struct SERVERLIST *serverlist); - - - - - - - - - - -void CloseConnection(void) -{ - if(socket_fd > 0) close(socket_fd); - socket_fd = -1; -} - - - - -/* -** MS_GetIP() -*/ -static int MS_GetIP(char *hostname) -{ - struct hostent *host_ent; - - if (!inet_aton(hostname, &addr.sin_addr)) { - //TODO: only when we are connected to Internet, or use a non bloking call - host_ent = gethostbyname(hostname); - if (host_ent==NULL) - return MS_GETHOSTBYNAME_ERROR; - memcpy(&addr.sin_addr, host_ent->h_addr_list[0], sizeof(struct in_addr)); - } - return 0; -} - - - - - - -/* -** MS_Connect() -*/ -int MS_Connect(char *ip_addr, char *str_port, int async) -{ - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - I_InitTcpDriver(); // this is done only if not already done - - if ((socket_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) - return MS_SOCKET_ERROR; - - if (MS_GetIP(ip_addr)==MS_GETHOSTBYNAME_ERROR) - return MS_GETHOSTBYNAME_ERROR; - addr.sin_port = htons((u_short)atoi(str_port)); - - if (async) // do asynchronous connection - { - int res = 1; - - ioctl(socket_fd, FIONBIO, &res); - res = connect(socket_fd, (struct sockaddr *) &addr, sizeof(addr)); - if (res < 0) - { - // humm, on win32 it doesn't work with EINPROGRESS (stupid windows) - if (WSAGetLastError() != WSAEWOULDBLOCK) - { - con_state = MSCS_FAILED; - CloseConnection(); - return MS_CONNECT_ERROR; - } - } - con_state = MSCS_WAITING; - FD_ZERO(&wset); - FD_SET(socket_fd, &wset); - select_timeout.tv_sec = 0, select_timeout.tv_usec = 0; - } - else - { - if (connect(socket_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) - return MS_CONNECT_ERROR; - } - - return 0; -} - - - - - - -/* - * MS_Write(): - */ -static int MS_Write(msg_t *msg) -{ - int len; - - if (msg->length < 0) - msg->length = strlen(msg->buffer); - len = msg->length+HEADER_SIZE; - - //msg->id = htonl(msg->id); - msg->type = htonl(msg->type); - msg->length = htonl(msg->length); - - if (send(socket_fd, (char*)msg, len, 0) != len) - return MS_WRITE_ERROR; - - return 0; -} - - - - - - -/* - * MS_Read(): - */ -static int MS_Read(msg_t *msg) -{ - if (recv(socket_fd, (char*)msg, HEADER_SIZE, 0) != HEADER_SIZE) - return MS_READ_ERROR; - - msg->type = ntohl(msg->type); - msg->length = ntohl(msg->length); - - if (!msg->length) //Hurdler: fix a bug in Windows 2000 - return 0; - - if (recv(socket_fd, (char*)msg->buffer, msg->length, 0) != msg->length) - return MS_READ_ERROR; - - return 0; -} - - - - - - - - -/***************************************************************************/ - - - - - - - - - -/* GetServerListEx */ -EXPORT int __stdcall GetServerListEx(char *host, char *str_port, struct SERVERLIST serverlist[], short max_servers) -{ - msg_t msg; - int count = 0; - - - /* Attempt to connect to list server. */ - MS_Connect(host, str_port, 0); - - /* Poll the list server. If it fails, depart with an error code of -1. */ - msg.type = GET_SERVER_MSG; - msg.length = 0; - if (MS_Write(&msg) < 0) - return -1; - - - - /* Get a description of each server in turn. */ - /* What we get is exactly the same as the output to the console when using LISTSERV. */ - while (MS_Read(&msg) >= 0) - { - if(msg.length == 0 || count >= max_servers) - { - CloseConnection(); - return count; - } - - ExtractServerInfo(msg.buffer, &serverlist[count]); - - count++; - } - - - CloseConnection(); - return -2; -} - - - - - - - - - - - -/* GetServerList */ -/* Warning: Large kludge follows! This function is only included for backwards-compatibility. */ -/* Use GetServerListVB or GetServerListEx instead. */ -EXPORT int __stdcall GetServerList(char *host, char *str_port, - - struct SERVERLIST *serverlist1,struct SERVERLIST *serverlist2,struct SERVERLIST *serverlist3, - struct SERVERLIST *serverlist4,struct SERVERLIST *serverlist5,struct SERVERLIST *serverlist6, - struct SERVERLIST *serverlist7,struct SERVERLIST *serverlist8,struct SERVERLIST *serverlist9, - struct SERVERLIST *serverlist10,struct SERVERLIST *serverlist11,struct SERVERLIST *serverlist12, - struct SERVERLIST *serverlist13,struct SERVERLIST *serverlist14,struct SERVERLIST *serverlist15, - struct SERVERLIST *serverlist16) -{ - msg_t msg; - int count = 0; - struct SERVERLIST *serverlist[16]; - - - /* Attempt to connect to list server. */ - MS_Connect(host, str_port, 0); - - /* Poll the list server. If it fails, bomb with an error code of -1. */ - msg.type = GET_SERVER_MSG; - msg.length = 0; - if (MS_Write(&msg) < 0) - return -1; - - serverlist[0] = serverlist1; - serverlist[1] = serverlist2; - serverlist[2] = serverlist3; - serverlist[3] = serverlist4; - serverlist[4] = serverlist5; - serverlist[5] = serverlist6; - serverlist[6] = serverlist7; - serverlist[7] = serverlist8; - serverlist[8] = serverlist9; - serverlist[9] = serverlist10; - serverlist[10] = serverlist11; - serverlist[11] = serverlist12; - serverlist[12] = serverlist13; - serverlist[13] = serverlist14; - serverlist[14] = serverlist15; - serverlist[15] = serverlist16; - - - - - while (MS_Read(&msg) >= 0 && count < 16) - { - if(msg.length == 0 || count >= 16) - { - CloseConnection(); - return count; - } - - ExtractServerInfo(msg.buffer, serverlist[count]); - - count++; - } - - - CloseConnection(); - - - return -2; -} - - - -void ExtractServerInfo(char *serverout, struct SERVERLIST *serverlist) -{ - char *lines[5]; - int i; - - i=0; - lines[0] = strtok(serverout, "\r\n"); - for(i=1; i<5; i++) - { - lines[i] = strtok(NULL, "\r\n"); - } - - strcpy(serverlist->ip, strstr(lines[0], ": ")+2); - strcpy(serverlist->port, strstr(lines[1], ": ")+2); - strcpy(serverlist->name, strstr(lines[2], ": ")+2); - strcpy(serverlist->version, strstr(lines[3], ": ")+2); - strcpy(serverlist->perm, strstr(lines[4], ": ")+2); -} diff --git a/tools/SRB2Launcher/mserv.h b/tools/SRB2Launcher/mserv.h deleted file mode 100644 index 8f32ae632..000000000 --- a/tools/SRB2Launcher/mserv.h +++ /dev/null @@ -1,64 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// -// -// DESCRIPTION: -// Header file for the master server routines -// -//----------------------------------------------------------------------------- - -#ifndef _MSERV_H_ -#define _MSERV_H_ - - - -#ifndef EXPORT -#ifdef __cplusplus -#define EXPORT extern "C" __declspec (dllexport) -#else -#define EXPORT __declspec (dllexport) -#endif -#endif - - - -struct SERVERLIST -{ - char ip[16]; - char port[6]; - char name[32]; - char version[16]; - char perm[4]; -}; - - - -EXPORT int __stdcall GetServerListEx(char *ip_addr, char *str_port, struct SERVERLIST serverlist[], short max_servers); -EXPORT int __stdcall GetServerList(char *ip_addr, char *str_port, - struct SERVERLIST *serverlist1,struct SERVERLIST *serverlist2,struct SERVERLIST *serverlist3, - struct SERVERLIST *serverlist4,struct SERVERLIST *serverlist5,struct SERVERLIST *serverlist6, - struct SERVERLIST *serverlist7,struct SERVERLIST *serverlist8,struct SERVERLIST *serverlist9, - struct SERVERLIST *serverlist10,struct SERVERLIST *serverlist11,struct SERVERLIST *serverlist12, - struct SERVERLIST *serverlist13,struct SERVERLIST *serverlist14,struct SERVERLIST *serverlist15, - struct SERVERLIST *serverlist16); - - - - -#endif // !defined(_MSERV_H_) diff --git a/tools/SRB2Launcher/mservsdk.h b/tools/SRB2Launcher/mservsdk.h deleted file mode 100644 index 722288e0b..000000000 --- a/tools/SRB2Launcher/mservsdk.h +++ /dev/null @@ -1,65 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// -// -// DESCRIPTION: -// Header file for the master server SDK. -// -//----------------------------------------------------------------------------- - -#ifndef _MSERVSDK_H_ -#define _MSERVSDK_H_ - - - -#ifndef IMPORT -#ifdef __cplusplus -#define IMPORT extern "C" __declspec (dllimport) -#else -#define IMPORT __declspec (dllimport) -#endif -#endif - - - - -struct SERVERLIST -{ - char ip[16]; - char port[6]; - char name[32]; - char version[16]; - char perm[4]; -}; - - - -IMPORT int __stdcall GetServerListEx(char *host, char *str_port, struct SERVERLIST serverlist[], short max_servers); -IMPORT int __stdcall GetServerList(char *host, char *str_port, - struct SERVERLIST *serverlist1,struct SERVERLIST *serverlist2,struct SERVERLIST *serverlist3, - struct SERVERLIST *serverlist4,struct SERVERLIST *serverlist5,struct SERVERLIST *serverlist6, - struct SERVERLIST *serverlist7,struct SERVERLIST *serverlist8,struct SERVERLIST *serverlist9, - struct SERVERLIST *serverlist10,struct SERVERLIST *serverlist11,struct SERVERLIST *serverlist12, - struct SERVERLIST *serverlist13,struct SERVERLIST *serverlist14,struct SERVERLIST *serverlist15, - struct SERVERLIST *serverlist16); - - - - -#endif // !defined(_MSERVSDK_H_) diff --git a/tools/SRB2Launcher/resource.h b/tools/SRB2Launcher/resource.h deleted file mode 100644 index d787fef41..000000000 --- a/tools/SRB2Launcher/resource.h +++ /dev/null @@ -1,71 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Script1.rc -// -#define IDD_MAIN 101 -#define IDB_BITMAP1 102 -#define IDI_ICON1 103 -#define IDD_JOINGAME 104 -#define IDD_HOSTGAME 106 -#define IDD_MATCHOPTIONS 108 -#define IDD_RACEOPTIONS 109 -#define IDD_CTFOPTIONS 110 -#define IDD_TAGOPTIONS 111 -#define IDC_GO 1001 -#define IDC_LAUNCHCONFIG 1002 -#define IDC_EXTFILECOMBO 1003 -#define IDC_ABOUT 1005 -#define IDC_ADDFILE 1006 -#define IDC_REMOVEFILE 1007 -#define IDC_SAVELAUNCHCFG 1008 -#define IDC_JOINGAME 1010 -#define IDC_HOSTGAME 1011 -#define IDC_SOUNDOPTS 1012 -#define IDC_PARAMETERS 1013 -#define IDC_EXENAME 1014 -#define IDC_FINDEXENAME 1015 -#define IDC_SEARCHGAMES 1016 -#define IDC_GAMELIST 1018 -#define IDC_NAME 1020 -#define IDC_COLOR 1021 -#define IDC_SKIN 1022 -#define IDC_ADDRESS 1023 -#define IDC_NOFILE 1024 -#define IDC_JOINSTART 1026 -#define IDC_NODOWNLOAD 1027 -#define IDC_OPTIONS 1028 -#define IDC_GAMETYPE 1029 -#define IDC_MAXPLAYERS 1030 -#define IDC_STARTMAP 1031 -#define IDC_FORCESKIN 1032 -#define IDC_ADVANCEMAP 1033 -#define IDC_INTERNETSERVER 1034 -#define IDC_SPECIALRINGS 1036 -#define IDC_MATCHBOXES 1037 -#define IDC_OK 1038 -#define IDC_CANCEL 1039 -#define IDC_RESPAWNITEMTIME 1040 -#define IDC_TIMELIMIT 1041 -#define IDC_POINTLIMIT 1042 -#define IDC_FLAGTIME 1048 -#define IDC_RACEITEMBOXES 1051 -#define IDC_NUMLAPS 1052 -#define IDC_SUDDENDEATH 1060 -#define IDC_MATCH_SCORING 1061 -#define IDC_INTTIME 1064 -#define IDC_DISABLEAUTOAIM 1065 -#define IDC_MONITORTOGGLES 1067 -#define IDC_CONFIGFILE 1069 -#define IDC_FINDCONFIGNAME 1070 -#define IDC_LIST1 1071 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 117 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1072 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/tools/SRB2MP/Makefile b/tools/SRB2MP/Makefile deleted file mode 100644 index 92e112d7a..000000000 --- a/tools/SRB2MP/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Makfile of SRB2MP - -CFLAGS +=-Wall -mms-bitfields -fno-exceptions -LDFLAGS +=-mwindows -lfmod -WINDRESFLAGS= - -SRC=lump.c SRB2MP.c - -ifdef DEBUGMODE -CFLAGS +=-g -D_DEBUG -LDFLAGS +=-g -else -CFLAGS :=-Os -s $(CFLAGS) -LDFLAGS :=-s $(LDFLAGS) -endif - -OBJ=$(SRC:.c=.o) # replaces the .c from SRC with .o -EXTRAOBJ=Script1.res -EXE=SRB2MP.exe - -ifdef PREFIX -CC=$(PREFIX)-gcc -WINDRES ?=$(PREFIX)-windres -endif - -WINDRES ?=windres - -RM=rm - -%.o: %.c StdAfx.h lump.h resource.h - $(CC) $(CFLAGS) -o $@ -c $< - -%.res: %.rc resource.h - $(WINDRES) -i $< -O rc $(WINDRESFLAGS) -o $@ -O coff - -.PHONY : all # .PHONY ignores files named all -all: $(EXE) # all is dependent on $(EXE) to be complete - -$(EXE): $(OBJ) $(EXTRAOBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist - $(CC) $(OBJ) $(EXTRAOBJ) $(LDFLAGS) -o $@ - -.PHONY : clean # .PHONY ignores files named clean -clean: - -$(RM) $(OBJ) $(EXTRAOBJ) diff --git a/tools/SRB2MP/SRB2MP.c b/tools/SRB2MP/SRB2MP.c deleted file mode 100644 index 69cc21040..000000000 --- a/tools/SRB2MP/SRB2MP.c +++ /dev/null @@ -1,464 +0,0 @@ -// SRB2MP.cpp : Defines the entry point for the application. -// - -#include "StdAfx.h" -#include "lump.h" - -#define APPTITLE "SRB2 Music Player" -#define APPVERSION "v0.1" -#define APPAUTHOR "SSNTails" -#define APPCOMPANY "Sonic Team Junior" - -static FSOUND_STREAM *fmus = NULL; -static int fsoundchannel = -1; -static FMUSIC_MODULE *mod = NULL; -static struct wadfile* wfptr = NULL; - -static inline VOID M_SetVolume(int volume) -{ - if (mod && FMUSIC_GetType(mod) != FMUSIC_TYPE_NONE) - FMUSIC_SetMasterVolume(mod, volume); - if (fsoundchannel != -1) - FSOUND_SetVolume(fsoundchannel, volume); -} - -static inline BOOL M_InitMusic(VOID) -{ - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version!\nYou should be using FMOD %.02f\n", FMOD_VERSION); - return FALSE; - } - -#ifdef _DEBUG - FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); -#endif - - if (!FSOUND_Init(44100, 1, FSOUND_INIT_GLOBALFOCUS)) - { - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return FALSE; - } - return TRUE; -} - -static inline VOID M_FreeMusic(VOID) -{ - if (mod) - { - FMUSIC_StopSong(mod); - FMUSIC_FreeSong(mod); - mod = NULL; - } - if (fmus) - { - FSOUND_Stream_Stop(fmus); - FSOUND_Stream_Close(fmus); - fmus = NULL; - fsoundchannel = -1; - } -} - -static inline VOID M_ShutdownMusic(VOID) -{ - M_FreeMusic(); - FSOUND_Close(); - //remove(musicfile); // Delete the temp file -} - -static inline VOID M_PauseMusic(VOID) -{ - if (mod && !FMUSIC_GetPaused(mod)) - FMUSIC_SetPaused(mod, TRUE); - if (fsoundchannel != -1 && FSOUND_IsPlaying(fsoundchannel)) - FSOUND_SetPaused(fsoundchannel, TRUE); -} - -static inline VOID M_ResumeMusic(VOID) -{ - if (mod && FMUSIC_GetPaused(mod)) - FMUSIC_SetPaused(mod, FALSE); - if (fsoundchannel != -1 && FSOUND_GetPaused(fsoundchannel)) - FSOUND_SetPaused(fsoundchannel, FALSE); -} - -static inline VOID M_StopMusic(VOID) -{ - if (mod) - FMUSIC_StopSong(mod); - if (fsoundchannel != -1 && fmus && FSOUND_IsPlaying(fsoundchannel)) - FSOUND_Stream_Stop(fmus); -} - -static inline VOID M_StartFMODSong(LPVOID data, int len, int looping, HWND hDlg) -{ - const int loops = FSOUND_LOOP_NORMAL|FSOUND_LOADMEMORY; - const int nloop = FSOUND_LOADMEMORY; - M_FreeMusic(); - - if (looping) - mod = FMUSIC_LoadSongEx(data, 0, len, loops, NULL, 0); - else - mod = FMUSIC_LoadSongEx(data, 0, len, nloop, NULL, 0); - - if (mod) - { - FMUSIC_SetLooping(mod, (signed char)looping); - FMUSIC_SetPanSeperation(mod, 0.0f); - } - else - { - if (looping) - fmus = FSOUND_Stream_Open(data, loops, 0, len); - else - fmus = FSOUND_Stream_Open(data, nloop, 0, len); - } - - if (!fmus && !mod) - { - MessageBoxA(hDlg, FMOD_ErrorString(FSOUND_GetError()), "Error", MB_OK|MB_APPLMODAL); - return; - } - - // Scan the OGG for the COMMENT= field for a custom loop point - if (looping && fmus) - { - const BYTE *origpos, *dataum = data; - size_t scan, size = len; - - CHAR buffer[512]; - BOOL titlefound = FALSE, artistfound = FALSE; - - unsigned int loopstart = 0; - - origpos = dataum; - - for(scan = 0; scan < size; scan++) - { - if (!titlefound) - { - if (*dataum++ == 'T') - if (*dataum++ == 'I') - if (*dataum++ == 'T') - if (*dataum++ == 'L') - if (*dataum++ == 'E') - if (*dataum++ == '=') - { - size_t titlecount = 0; - CHAR title[256]; - BYTE length = *(dataum-10) - 6; - - while(titlecount < length) - title[titlecount++] = *dataum++; - - title[titlecount] = '\0'; - - sprintf(buffer, "Title: %s", title); - - SendMessage(GetDlgItem(hDlg, IDC_TITLE), WM_SETTEXT, 0, (LPARAM)(LPCSTR)buffer); - - titlefound = TRUE; - } - } - } - - dataum = origpos; - - for(scan = 0; scan < size; scan++) - { - if (!artistfound) - { - if (*dataum++ == 'A') - if (*dataum++ == 'R') - if (*dataum++ == 'T') - if (*dataum++ == 'I') - if (*dataum++ == 'S') - if (*dataum++ == 'T') - if (*dataum++ == '=') - { - size_t artistcount = 0; - CHAR artist[256]; - BYTE length = *(dataum-11) - 7; - - while(artistcount < length) - artist[artistcount++] = *dataum++; - - artist[artistcount] = '\0'; - - sprintf(buffer, "By: %s", artist); - - SendMessage(GetDlgItem(hDlg, IDC_ARTIST), WM_SETTEXT, 0, (LPARAM)(LPCSTR)buffer); - - artistfound = TRUE; - } - } - } - - dataum = origpos; - - for(scan = 0; scan < size; scan++) - { - if (*dataum++ == 'C'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'M'){ - if (*dataum++ == 'M'){ - if (*dataum++ == 'E'){ - if (*dataum++ == 'N'){ - if (*dataum++ == 'T'){ - if (*dataum++ == '='){ - if (*dataum++ == 'L'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'P'){ - if (*dataum++ == 'P'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'I'){ - if (*dataum++ == 'N'){ - if (*dataum++ == 'T'){ - if (*dataum++ == '=') - { - size_t newcount = 0; - CHAR looplength[64]; - while (*dataum != 1 && newcount < 63) - { - looplength[newcount++] = *dataum++; - } - - looplength[newcount] = '\n'; - - loopstart = atoi(looplength); - } - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - } - - if (loopstart > 0) - { - const int length = FSOUND_Stream_GetLengthMs(fmus); - const int freq = 44100; - const unsigned int loopend = (unsigned int)((freq/1000.0f)*length-(freq/1000.0f)); - if (!FSOUND_Stream_SetLoopPoints(fmus, loopstart, loopend)) - { - printf("FMOD(Start,FSOUND_Stream_SetLoopPoints): %s\n", - FMOD_ErrorString(FSOUND_GetError())); - } - } - } - - if (mod) - FMUSIC_PlaySong(mod); - if (fmus) - fsoundchannel = FSOUND_Stream_PlayEx(FSOUND_FREE, fmus, NULL, FALSE); - - M_SetVolume(128); -} - -static inline VOID FreeWADLumps(VOID) -{ - M_FreeMusic(); - if (wfptr) free_wadfile(wfptr); - wfptr = NULL; -} - -static inline VOID ReadWADLumps(LPCSTR WADfilename, HWND hDlg) -{ - HWND listbox = GetDlgItem(hDlg, IDC_PLAYLIST); - FILE* f; - struct lumplist *curlump; - - SendMessage(listbox, LB_RESETCONTENT, 0, 0); - FreeWADLumps(); - f = fopen(WADfilename, "rb"); - wfptr = read_wadfile(f); - fclose(f); - - /* start of C_LIST */ - /* Loop through the lump list, printing lump info */ - for(curlump = wfptr->head->next; curlump; curlump = curlump->next) - { - LPCSTR lumpname = get_lump_name(curlump->cl); - if (!strncmp(lumpname, "O_", 2) || !strncmp(lumpname, "D_", 2)) - SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)(LPCSTR)get_lump_name(curlump->cl)); - } - /* end of C_LIST */ -} - -// -// OpenWadfile -// -// Provides a common dialog box -// for selecting the desired wad file. -// -static inline VOID OpenWadfile(HWND hDlg) -{ - OPENFILENAMEA ofn; - CHAR FileBuffer[256] = ""; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = hDlg; - ofn.lpstrFilter = "WAD Files\0*.wad\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if (GetOpenFileNameA(&ofn)) - ReadWADLumps(FileBuffer, hDlg); -} - -static inline VOID PlayLump(HWND hDlg) -{ - HWND listbox = GetDlgItem(hDlg, IDC_PLAYLIST); - LRESULT cursel = SendMessage(listbox, LB_GETCURSEL, 0, 0); - - /* Start of C_EXTRACT */ - CHAR argv[9]; - - SendMessage(listbox, LB_GETTEXT, cursel, (LPARAM)(LPCSTR)argv); - - /* Extract LUMPNAME FILENAME pairs */ - if (wfptr) - { - struct lumplist *extracted; - - printf("Extracting lump %s...\n", argv); - /* Find the lump to extract */ - extracted = find_previous_lump(wfptr->head, NULL, argv); - if (extracted == NULL || (extracted = extracted->next) == NULL) - return; - - /* Extract lump */ - M_StartFMODSong(extracted->cl->data, extracted->cl->len, FALSE, hDlg); - - /* end of extracting LUMPNAME FILENAME pairs */ - - } /* end of C_EXTRACT */ - return; -} - -static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - return DefWindowProc(hWnd, message, wParam, lParam); -} - -static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - M_InitMusic(); - break; - - case WM_CLOSE: - EndDialog(hDlg, message); - break; - - case WM_DESTROY: - FreeWADLumps(); - M_ShutdownMusic(); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - EndDialog(hDlg, message); - return TRUE; - case IDC_ABOUT: // The About button. - { - char TempString[256]; - sprintf(TempString, "%s %s by %s - %s", APPTITLE, APPVERSION, APPAUTHOR, APPCOMPANY); - MessageBoxA(hDlg, TempString, "About", MB_OK|MB_APPLMODAL); - } - return TRUE; - case IDC_OPEN: - OpenWadfile(hDlg); - return TRUE; - case IDC_PLAY: - PlayLump(hDlg); - return TRUE; - default: - break; - } - break; - } - } - - return FALSE; -} - -static inline VOID RegisterDialogClass(LPCSTR name, WNDPROC callback, HINSTANCE hInst) -{ - WNDCLASSA wnd; - - wnd.style = CS_HREDRAW | CS_VREDRAW; - wnd.cbWndExtra = DLGWINDOWEXTRA; - wnd.cbClsExtra = 0; - wnd.hCursor = LoadCursorA(NULL,(LPCSTR)MAKEINTRESOURCE(IDC_ARROW)); - wnd.hIcon = LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON1)); - wnd.hInstance = hInst; - wnd.lpfnWndProc = callback; - wnd.lpszClassName = name; - wnd.lpszMenuName = NULL; - wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW); - - if (!RegisterClassA(&wnd)) - { - return; - } -} - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - // Prevent multiples instances of this app. - CreateMutexA(NULL, TRUE, APPTITLE); - - if (GetLastError() == ERROR_ALREADY_EXISTS) - return 0; - - RegisterDialogClass("SRB2MP", MainWndproc, hInstance); - - DialogBoxA(hInstance, (LPCSTR)IDD_MAIN, NULL, DialogProc); - - return 0; -} diff --git a/tools/SRB2MP/SRB2MP.dsp b/tools/SRB2MP/SRB2MP.dsp deleted file mode 100644 index f2e700fb5..000000000 --- a/tools/SRB2MP/SRB2MP.dsp +++ /dev/null @@ -1,148 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SRB2MP" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SRB2MP - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SRB2MP.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SRB2MP.mak" CFG="SRB2MP - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SRB2MP - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SRB2MP - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SRB2MP - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fmodvc.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "SRB2MP - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fmodvc.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SRB2MP - Win32 Release" -# Name "SRB2MP - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\lump.c -# End Source File -# Begin Source File - -SOURCE=.\SRB2MP.c -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.c -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\lump.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\icon1.ico -# End Source File -# Begin Source File - -SOURCE=.\icon2.ico -# End Source File -# Begin Source File - -SOURCE=.\icon3.ico -# End Source File -# Begin Source File - -SOURCE=.\Script1.rc -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/tools/SRB2MP/SRB2MP.dsw b/tools/SRB2MP/SRB2MP.dsw deleted file mode 100644 index b73bd1ac7..000000000 --- a/tools/SRB2MP/SRB2MP.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SRB2MP"=.\SRB2MP.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/tools/SRB2MP/Script1.aps b/tools/SRB2MP/Script1.aps deleted file mode 100644 index 994653cb1..000000000 Binary files a/tools/SRB2MP/Script1.aps and /dev/null differ diff --git a/tools/SRB2MP/Script1.rc b/tools/SRB2MP/Script1.rc deleted file mode 100644 index 3fa7bd572..000000000 --- a/tools/SRB2MP/Script1.rc +++ /dev/null @@ -1,118 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MAIN DIALOG DISCARDABLE 0, 0, 262, 170 -STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "SRB2 Music Player" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "E&xit",IDCANCEL,205,145,50,19 - PUSHBUTTON "&About",IDC_ABOUT,230,15,23,10 - LISTBOX IDC_WADLIST,5,30,112,110,LBS_SORT | LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP - LISTBOX IDC_PLAYLIST,140,30,114,110,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Play",IDC_PLAY,140,145,60,20 - PUSHBUTTON "->",IDC_ADD,120,35,15,15 - PUSHBUTTON "<-",IDC_REMOVE,120,55,15,15 - PUSHBUTTON "&Open WAD...",IDC_OPEN,5,10,50,15 - ICON IDI_ICON1,IDC_STATIC,205,5,20,20 - LTEXT "Title:",IDC_TITLE,5,140,125,10 - LTEXT "By:",IDC_ARTIST,5,150,125,15 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 255 - TOPMARGIN, 7 - BOTTOMMARGIN, 163 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON1 ICON DISCARDABLE "icon1.ico" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/tools/SRB2MP/StdAfx.c b/tools/SRB2MP/StdAfx.c deleted file mode 100644 index 4f305cd1a..000000000 --- a/tools/SRB2MP/StdAfx.c +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// SRB2MP.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "StdAfx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/tools/SRB2MP/StdAfx.h b/tools/SRB2MP/StdAfx.h deleted file mode 100644 index 84ac428b8..000000000 --- a/tools/SRB2MP/StdAfx.h +++ /dev/null @@ -1,35 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -//#define UNICODE - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include -#include - -// TODO: reference additional headers your program requires here -#ifdef __MINGW32__ -#include -#include -#else -#include -#include -#endif -#include "resource.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/tools/SRB2MP/icon1.ico b/tools/SRB2MP/icon1.ico deleted file mode 100644 index 7548e7caf..000000000 Binary files a/tools/SRB2MP/icon1.ico and /dev/null differ diff --git a/tools/SRB2MP/lump.c b/tools/SRB2MP/lump.c deleted file mode 100644 index 4cf355401..000000000 --- a/tools/SRB2MP/lump.c +++ /dev/null @@ -1,471 +0,0 @@ -/* - LumpMod v0.21, a command-line utility for working with lumps in wad files. - Copyright (C) 2003 Thunder Palace Entertainment. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.c: Provides functions for dealing with lumps -*/ - -#include "StdAfx.h" -#include -#include -#include "lump.h" - -/* Read contents of a wad file and store them in memory. - * fpoint is the file to read, opened with "rb" mode. - * A pointer to a new wadfile struct will be returned, or NULL on error. - */ -struct wadfile *read_wadfile(FILE *fpoint) { - struct wadfile *wfptr; - struct lumplist *curlump; - unsigned long diroffset, filelen; - unsigned long count; - - /* Allocate memory for wadfile struct */ - wfptr = (struct wadfile*)malloc(sizeof(struct wadfile)); - if(wfptr == NULL) return NULL; - - /* Read first four characters (PWAD or IWAD) */ - if(fread(wfptr->id, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Read number of lumps */ - if(fread(&(wfptr->numlumps), 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* If number of lumps is zero, nothing more needs to be done */ - if(wfptr->numlumps == 0) { - wfptr->head = NULL; - return wfptr; - } - - /* Read offset of directory */ - if(fread(&diroffset, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Verify that the directory as long as it needs to be */ - fseek(fpoint, 0, SEEK_END); - filelen = ftell(fpoint); - if((filelen - diroffset) / DIRENTRYLEN < wfptr->numlumps) { - free(wfptr); - return NULL; - } - - /* Allocate memory for head lumplist item and set head pointer */ - curlump = (struct lumplist*)malloc(sizeof(struct lumplist)); - if(curlump == NULL) { - free(wfptr); - return NULL; - } - wfptr->head = curlump; - curlump->cl = NULL; - - /* Read directory entries and lumps */ - for(count = 0; count < wfptr->numlumps; count++) { - long lumpdataoffset; - - /* Advance to a new list item */ - curlump->next = (struct lumplist*)malloc(sizeof(struct lumplist)); - if(curlump->next == NULL) { - free_wadfile(wfptr); - return NULL; - } - curlump = curlump->next; - curlump->next = NULL; - - /* Allocate memory for the lump info */ - curlump->cl = (struct lump*)malloc(sizeof(struct lump)); - if(curlump->cl == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Seek to the proper position in the file */ - if(fseek(fpoint, diroffset + (count * DIRENTRYLEN), SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Read offset of lump data */ - if(fread(&lumpdataoffset, 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read size of lump in bytes */ - if(fread(&(curlump->cl->len), 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read lump name */ - if(fread(curlump->cl->name, 8, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read actual lump data, unless lump size is 0 */ - if(curlump->cl->len > 0) { - if(fseek(fpoint, lumpdataoffset, SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Allocate memory for data */ - curlump->cl->data = (unsigned char*)malloc(curlump->cl->len); - if(curlump->cl->data == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Fill the data buffer */ - if(fread(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - } else curlump->cl->data = NULL; - } /* End of directory reading loop */ - - return wfptr; -} - -/* Free a wadfile from memory as well as all related structures. - */ -void free_wadfile(struct wadfile *wfptr) { - struct lumplist *curlump, *nextlump; - - if(wfptr == NULL) return; - curlump = wfptr->head; - - /* Free items in the lump list */ - while(curlump != NULL) { - - /* Free the actual lump and its data, if necessary */ - if(curlump->cl != NULL) { - if(curlump->cl->data != NULL) free(curlump->cl->data); - free(curlump->cl); - } - - /* Advance to next lump and free this one */ - nextlump = curlump->next; - free(curlump); - curlump = nextlump; - } - - free(wfptr); -} - -/* Write complete wadfile to a file stream, opened with "wb" mode. - * fpoint is the stream to write to. - * wfptr is a pointer to the wadfile structure to use. - * Return zero on success, nonzero on failure. - */ -int write_wadfile(FILE *fpoint, struct wadfile *wfptr) { - struct lumplist *curlump; - long lumpdataoffset, diroffset; - - if(wfptr == NULL) return 1; - - /* Write four-character ID ("PWAD" or "IWAD") */ - if(fwrite(wfptr->id, 4, 1, fpoint) < 1) return 2; - - /* Write number of lumps */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 3; - - /* Offset of directory is not known yet. For now, write number of lumps - * again, just to fill the space. - */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 4; - - /* Loop through lump list, writing lump data */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list or for lumps of - zero length */ - if(curlump->cl == NULL || curlump->cl->data == NULL) continue; - - /* Write the data */ - if(fwrite(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) - return 5; - } - - /* Current position is where directory will start */ - diroffset = ftell(fpoint); - - /* Offset for the first lump's data is always 12 */ - lumpdataoffset = 12; - - /* Loop through lump list again, this time writing directory entries */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list */ - if(curlump->cl == NULL) continue; - - /* Write offset for lump data */ - if(fwrite(&lumpdataoffset, 4, 1, fpoint) < 1) return 6; - - /* Write size of lump data */ - if(fwrite(&(curlump->cl->len), 4, 1, fpoint) < 1) return 7; - - /* Write lump name */ - if(fwrite(curlump->cl->name, 8, 1, fpoint) < 1) return 8; - - /* Increment lumpdataoffset variable as appropriate */ - lumpdataoffset += curlump->cl->len; - } - - /* Go back to header and write the proper directory offset */ - fseek(fpoint, 8, SEEK_SET); - if(fwrite(&diroffset, 4, 1, fpoint) < 1) return 9; - - return 0; -} - -/* Get the name of a lump, as a null-terminated string. - * item is a pointer to the lump (not lumplist) whose name will be obtained. - * Return NULL on error. - */ -char *get_lump_name(struct lump *item) { - char convname[9], *retname; - - if(item == NULL) return NULL; - memcpy(convname, item->name, 8); - convname[8] = '\0'; - - retname = (char*)malloc(strlen(convname) + 1); - if(retname != NULL) strcpy(retname, convname); - return retname; -} - -/* Find the lump after start and before end having a certain name. - * Return a pointer to the list item for that lump, or return NULL if no lump - * by that name is found or lumpname is too long. - * lumpname is a null-terminated string. - * If end parameter is NULL, search to the end of the entire list. - */ -struct lumplist *find_previous_lump(struct lumplist *start, struct lumplist - *end, char *lumpname) { - struct lumplist *curlump, *lastlump; - char *curname; - int found = 0; - - /* Verify that parameters are valid */ - if(start==NULL || start==end || lumpname==NULL || strlen(lumpname) > 8) - return NULL; - - /* Loop through the list from start parameter */ - lastlump = start; - for(curlump = start->next; curlump != end && curlump != NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Compare names to see if this is the lump we want */ - if(strcmp(curname, lumpname) == 0) { - found = 1; - break; - } - - /* Free memory allocated to curname */ - free(curname); - - lastlump = curlump; - } - - if(found) return lastlump; - return NULL; -} - -/* Remove a lump from the list, free it, and free its data. - * before is the lump immediately preceding the lump to be removed. - * wfptr is a pointer to the wadfile structure to which the removed lump - * belongs, so that numlumps can be decreased. - */ -void remove_next_lump(struct wadfile *wfptr, struct lumplist *before) { - struct lumplist *removed; - - /* Verify that parameters are valid */ - if(before == NULL || before->next == NULL || wfptr == NULL) return; - - /* Update linked list to omit removed lump */ - removed = before->next; - before->next = removed->next; - - /* Free lump info and data if necessary */ - if(removed->cl != NULL) { - if(removed->cl->data != NULL) free(removed->cl->data); - free(removed->cl); - } - - free(removed); - - /* Decrement numlumps */ - wfptr->numlumps--; -} - -/* Add a lump. - * The lump will follow prev in the list and be named name, with a data size - * of len. - * A copy will be made of the data. - * Return zero on success or nonzero on failure. - */ -int add_lump(struct wadfile *wfptr, struct lumplist *prev, char *name, long - len, unsigned char *data) { - struct lump *newlump; - struct lumplist *newlumplist; - unsigned char *copydata; - - /* Verify that parameters are valid */ - if(wfptr == NULL || prev == NULL || name == NULL || strlen(name) > 8) - return 1; - - /* Allocate space for newlump and newlumplist */ - newlump = (struct lump*)malloc(sizeof(struct lump)); - newlumplist = (struct lumplist*)malloc(sizeof(struct lumplist)); - if(newlump == NULL || newlumplist == NULL) return 2; - - /* Copy lump data and set up newlump */ - if(len == 0 || data == NULL) { - newlump->len = 0; - newlump->data = NULL; - } else { - newlump->len = len; - copydata = (unsigned char*)malloc(len); - if(copydata == NULL) return 3; - memcpy(copydata, data, len); - newlump->data = copydata; - } - - /* Set name of newlump */ - memset(newlump->name, '\0', 8); - if(strlen(name) == 8) memcpy(newlump->name, name, 8); - else strcpy(newlump->name, name); - - /* Set up newlumplist and alter prev appropriately */ - newlumplist->cl = newlump; - newlumplist->next = prev->next; - prev->next = newlumplist; - - /* Increment numlumps */ - wfptr->numlumps++; - - return 0; -} - -/* Rename a lump. - * renamed is a pointer to the lump (not lumplist) that needs renaming. - * newname is a null-terminated string with the new name. - * Return zero on success or nonzero on failure. - */ -int rename_lump(struct lump *renamed, char *newname) { - - /* Verify that parameters are valid. */ - if(newname == NULL || renamed == NULL || strlen(newname) > 8) return 1; - - /* Do the renaming. */ - memset(renamed->name, '\0', 8); - if(strlen(newname) == 8) memcpy(renamed->name, newname, 8); - else strcpy(renamed->name, newname); - - return 0; -} - -/* Find the last lump in a wadfile structure. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump(struct wadfile *wfptr) { - struct lumplist *curlump; - - if(wfptr == NULL || wfptr->head == NULL) return NULL; - curlump = wfptr->head; - - while(curlump->next != NULL) curlump = curlump->next; - return curlump; -} - -/* Find the last lump between start and end. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump_between(struct lumplist *start, struct - lumplist *end) { - struct lumplist *curlump; - - if(start == NULL) return NULL; - curlump = start; - - while(curlump->next != end) { - curlump = curlump->next; - if(curlump == NULL) break; - } - - return curlump; -} - -/* Find the next section lump. A section lump is MAPxx (0 <= x <= 9), ExMy - * (0 <= x <= 9, 0 <= y <= 9), or any lump whose name ends in _START or _END. - * Return NULL if there are no section lumps after start. - */ -struct lumplist *find_next_section_lump(struct lumplist *start) { - struct lumplist *curlump, *found = NULL; - char *curname; - - /* Verify that parameter is valid */ - if(start == NULL || start->next == NULL) return NULL; - - /* Loop through the list from start parameter */ - for(curlump = start->next; curlump != NULL && found == NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Check to see if this is a section lump */ - if(strlen(curname) == 5 && strncmp("MAP", curname, 3) == 0 && - isdigit(curname[3]) && isdigit(curname[4])) - found = curlump; - else if(strlen(curname) == 4 && curname[0] == 'E' && curname[2] == - 'M' && isdigit(curname[1]) && isdigit(curname[3])) - found = curlump; - else if(strlen(curname) == 7 && strcmp("_START", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 8 && strcmp("_START", &curname[2]) == 0) - found = curlump; - else if(strlen(curname) == 5 && strcmp("_END", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 6 && strcmp("_END", &curname[2]) == 0) - found = curlump; - - /* Free memory allocated to curname */ - free(curname); - } - - return found; -} diff --git a/tools/SRB2MP/lump.h b/tools/SRB2MP/lump.h deleted file mode 100644 index b36b84441..000000000 --- a/tools/SRB2MP/lump.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - LumpMod v0.21, a command-line utility for working with lumps in wad files. - Copyright (C) 2003 Thunder Palace Entertainment. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.h: Defines constants, structures, and functions used in lump.c -*/ - -#ifndef __LUMP_H -#define __LUMP_H - -/* Entries in the wadfile directory are 16 bytes */ -#define DIRENTRYLEN 16 - -/* Lumps and associated info */ -struct lump { - long len; - unsigned char *data; - char name[8]; -}; - -/* Linked list of lumps */ -struct lumplist { - struct lump *cl; /* actual content of the lump */ - struct lumplist *next; -}; - -/* Structure to contain all wadfile data */ -struct wadfile { - char id[4]; /* IWAD or PWAD */ - unsigned long numlumps; /* 32-bit integer */ - struct lumplist *head; /* points to first entry */ -}; - -/* Function declarations */ -struct wadfile *read_wadfile(FILE *); -void free_wadfile(struct wadfile *); -int write_wadfile(FILE *, struct wadfile *); -char *get_lump_name(struct lump *); -struct lumplist *find_previous_lump(struct lumplist *, struct lumplist *, char *); -void remove_next_lump(struct wadfile *, struct lumplist *); -int add_lump(struct wadfile *, struct lumplist *, char *, long, unsigned char *); -int rename_lump(struct lump *, char *); -struct lumplist *find_last_lump(struct wadfile *); -struct lumplist *find_last_lump_between(struct lumplist *, struct lumplist *); -struct lumplist *find_next_section_lump(struct lumplist *); - -#endif diff --git a/tools/SRB2MP/resource.h b/tools/SRB2MP/resource.h deleted file mode 100644 index 56924e34a..000000000 --- a/tools/SRB2MP/resource.h +++ /dev/null @@ -1,26 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Script1.rc -// -#define IDD_MAIN 101 -#define IDI_ICON1 102 -#define IDC_ABOUT 1000 -#define IDC_WADLIST 1001 -#define IDC_PLAYLIST 1002 -#define IDC_PLAY 1003 -#define IDC_ADD 1004 -#define IDC_REMOVE 1005 -#define IDC_OPEN 1006 -#define IDC_TITLE 1007 -#define IDC_ARTIST 1008 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1009 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/tools/SRB2Updater/Bunny.cs b/tools/SRB2Updater/Bunny.cs deleted file mode 100644 index 71934ee31..000000000 --- a/tools/SRB2Updater/Bunny.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace SRB2Updater -{ - public class Bunny - { - List Keys = new List{System.Windows.Forms.Keys.Up, System.Windows.Forms.Keys.Up, - System.Windows.Forms.Keys.Down, System.Windows.Forms.Keys.Down, - System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right, - System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right, - System.Windows.Forms.Keys.B, System.Windows.Forms.Keys.A}; - private int mPosition = -1; - - public int Position - { - get { return mPosition; } - private set { mPosition = value; } - } - - public bool IsCompletedBy(Keys key) - { - - if (Keys[Position + 1] == key) - { - // move to next - Position++; - } - else if (Position == 1 && key == System.Windows.Forms.Keys.Up) - { - // stay where we are - } - else if (Keys[0] == key) - { - // restart at 1st - Position = 0; - } - else - { - // no match in sequence - Position = -1; - } - - if (Position == Keys.Count - 1) - { - Position = -1; - return true; - } - return false; - } - } -} diff --git a/tools/SRB2Updater/Debug.Designer.cs b/tools/SRB2Updater/Debug.Designer.cs deleted file mode 100644 index 6ec72f904..000000000 --- a/tools/SRB2Updater/Debug.Designer.cs +++ /dev/null @@ -1,266 +0,0 @@ -namespace SRB2Updater -{ - partial class Debug - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lblOverallPercentage = new System.Windows.Forms.Label(); - this.lblPercent = new System.Windows.Forms.Label(); - this.lblOverall = new System.Windows.Forms.Label(); - this.lblCurrent = new System.Windows.Forms.Label(); - this.lblTotal = new System.Windows.Forms.Label(); - this.lblRead = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.lblKonami = new System.Windows.Forms.Label(); - this.lblRandom = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // lblOverallPercentage - // - this.lblOverallPercentage.AutoSize = true; - this.lblOverallPercentage.Location = new System.Drawing.Point(176, 150); - this.lblOverallPercentage.Name = "lblOverallPercentage"; - this.lblOverallPercentage.Size = new System.Drawing.Size(21, 13); - this.lblOverallPercentage.TabIndex = 26; - this.lblOverallPercentage.Text = "0%"; - // - // lblPercent - // - this.lblPercent.AutoSize = true; - this.lblPercent.Location = new System.Drawing.Point(176, 90); - this.lblPercent.Name = "lblPercent"; - this.lblPercent.Size = new System.Drawing.Size(21, 13); - this.lblPercent.TabIndex = 25; - this.lblPercent.Text = "0%"; - // - // lblOverall - // - this.lblOverall.AutoSize = true; - this.lblOverall.Location = new System.Drawing.Point(176, 120); - this.lblOverall.Name = "lblOverall"; - this.lblOverall.Size = new System.Drawing.Size(41, 13); - this.lblOverall.TabIndex = 24; - this.lblOverall.Text = "0 bytes"; - // - // lblCurrent - // - this.lblCurrent.AutoSize = true; - this.lblCurrent.Location = new System.Drawing.Point(176, 60); - this.lblCurrent.Name = "lblCurrent"; - this.lblCurrent.Size = new System.Drawing.Size(41, 13); - this.lblCurrent.TabIndex = 23; - this.lblCurrent.Text = "0 bytes"; - // - // lblTotal - // - this.lblTotal.AutoSize = true; - this.lblTotal.Location = new System.Drawing.Point(176, 0); - this.lblTotal.Name = "lblTotal"; - this.lblTotal.Size = new System.Drawing.Size(41, 13); - this.lblTotal.TabIndex = 21; - this.lblTotal.Text = "0 bytes"; - // - // lblRead - // - this.lblRead.AutoSize = true; - this.lblRead.Location = new System.Drawing.Point(176, 30); - this.lblRead.Name = "lblRead"; - this.lblRead.Size = new System.Drawing.Size(41, 13); - this.lblRead.TabIndex = 22; - this.lblRead.Text = "0 bytes"; - this.lblRead.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(105, 13); - this.label1.TabIndex = 27; - this.label1.Text = "Total Download Size"; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.tableLayoutPanel1.Controls.Add(this.label6, 0, 5); - this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.lblOverallPercentage, 1, 5); - this.tableLayoutPanel1.Controls.Add(this.lblTotal, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.lblOverall, 1, 4); - this.tableLayoutPanel1.Controls.Add(this.lblPercent, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.lblRead, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.lblCurrent, 1, 2); - this.tableLayoutPanel1.Controls.Add(this.label7, 0, 6); - this.tableLayoutPanel1.Controls.Add(this.lblKonami, 1, 6); - this.tableLayoutPanel1.Controls.Add(this.lblRandom, 1, 7); - this.tableLayoutPanel1.Controls.Add(this.label9, 0, 7); - this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 9; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(260, 355); - this.tableLayoutPanel1.TabIndex = 28; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 150); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(98, 13); - this.label6.TabIndex = 32; - this.label6.Text = "Overall Percentage"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(3, 120); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(132, 13); - this.label5.TabIndex = 31; - this.label5.Text = "Bytes Downloaded Overall"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(3, 90); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(118, 13); - this.label4.TabIndex = 30; - this.label4.Text = "Current File Percentage"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 60); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(146, 13); - this.label3.TabIndex = 29; - this.label3.Text = "Downloaded from Current File"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 30); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(62, 13); - this.label2.TabIndex = 28; - this.label2.Text = "Bytes Read"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(3, 180); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(42, 13); - this.label7.TabIndex = 33; - this.label7.Text = "Konami"; - // - // lblKonami - // - this.lblKonami.AutoSize = true; - this.lblKonami.Location = new System.Drawing.Point(176, 180); - this.lblKonami.Name = "lblKonami"; - this.lblKonami.Size = new System.Drawing.Size(16, 13); - this.lblKonami.TabIndex = 34; - this.lblKonami.Text = "-1"; - // - // lblRandom - // - this.lblRandom.AutoSize = true; - this.lblRandom.Location = new System.Drawing.Point(176, 210); - this.lblRandom.Name = "lblRandom"; - this.lblRandom.Size = new System.Drawing.Size(13, 13); - this.lblRandom.TabIndex = 37; - this.lblRandom.Text = "0"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(3, 210); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(47, 13); - this.label9.TabIndex = 38; - this.label9.Text = "Random"; - // - // Debug - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 379); - this.Controls.Add(this.tableLayoutPanel1); - this.Name = "Debug"; - this.Text = "Debug"; - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label lblOverallPercentage; - private System.Windows.Forms.Label lblPercent; - private System.Windows.Forms.Label lblOverall; - private System.Windows.Forms.Label lblCurrent; - private System.Windows.Forms.Label lblTotal; - private System.Windows.Forms.Label lblRead; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label lblKonami; - private System.Windows.Forms.Label lblRandom; - private System.Windows.Forms.Label label9; - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/Debug.cs b/tools/SRB2Updater/Debug.cs deleted file mode 100644 index 5cb54dd37..000000000 --- a/tools/SRB2Updater/Debug.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace SRB2Updater -{ - public partial class Debug : Form - { - public Debug() - { - InitializeComponent(); - } - - public String strOverall - { - get { return this.lblOverall.Text; } - set { this.lblOverall.Text = value; } - } - - public String strKonami - { - get { return this.lblKonami.Text; } - set { this.lblKonami.Text = value; } - } - - public String strRandom - { - get { return this.lblRandom.Text; } - set { this.lblRandom.Text = value; } - } - - public String strOverallPercentage - { - get { return this.lblOverallPercentage.Text; } - set { this.lblOverallPercentage.Text = value; } - } - - public String strCurrent - { - get { return this.lblCurrent.Text; } - set { this.lblCurrent.Text = value; } - } - - public String strPercent - { - get { return this.lblPercent.Text; } - set { this.lblPercent.Text = value; } - } - - public String strRead - { - get { return this.lblRead.Text; } - set { this.lblRead.Text = value; } - } - - public String strTotal - { - get { return this.lblTotal.Text; } - set { this.lblTotal.Text = value; } - } - } -} diff --git a/tools/SRB2Updater/Debug.resx b/tools/SRB2Updater/Debug.resx deleted file mode 100644 index ff31a6db5..000000000 --- a/tools/SRB2Updater/Debug.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/tools/SRB2Updater/Launcher.Designer.cs b/tools/SRB2Updater/Launcher.Designer.cs deleted file mode 100644 index 9126eba54..000000000 --- a/tools/SRB2Updater/Launcher.Designer.cs +++ /dev/null @@ -1,766 +0,0 @@ -namespace SRB2Updater -{ - partial class Launcher - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Launcher)); - this.panel1 = new System.Windows.Forms.Panel(); - this.panel3 = new System.Windows.Forms.Panel(); - this.btnOptions = new System.Windows.Forms.Button(); - this.btnCheckFiles = new System.Windows.Forms.Button(); - this.btnStartSRB2 = new System.Windows.Forms.Button(); - this.panel2 = new System.Windows.Forms.Panel(); - this.lblProgress = new System.Windows.Forms.Label(); - this.update_optional = new System.Windows.Forms.CheckBox(); - this.progress_overall = new System.Windows.Forms.ProgressBar(); - this.progress_currentFile = new System.Windows.Forms.ProgressBar(); - this.tab_web = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.panel10 = new System.Windows.Forms.Panel(); - this.webBrowser3 = new System.Windows.Forms.WebBrowser(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.panel9 = new System.Windows.Forms.Panel(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.tabPage3 = new System.Windows.Forms.TabPage(); - this.panel8 = new System.Windows.Forms.Panel(); - this.fileList = new System.Windows.Forms.DataGridView(); - this.name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.filename = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.status = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.localmd5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.md5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.optional = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.calculated = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.serverTab = new System.Windows.Forms.TabPage(); - this.panel6 = new System.Windows.Forms.Panel(); - this.listViewServers = new System.Windows.Forms.ListView(); - this.colhdrName = new System.Windows.Forms.ColumnHeader("(none)"); - this.colhdrGametype = new System.Windows.Forms.ColumnHeader(); - this.colhdrPing = new System.Windows.Forms.ColumnHeader(); - this.colhdrPlayers = new System.Windows.Forms.ColumnHeader(); - this.colhdrVersion = new System.Windows.Forms.ColumnHeader(); - this.panel4 = new System.Windows.Forms.Panel(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.btnConnect = new System.Windows.Forms.Button(); - this.panel5 = new System.Windows.Forms.Panel(); - this.bannerRandom = new System.Windows.Forms.Panel(); - this.backgroundWorkerQueryServers = new System.ComponentModel.BackgroundWorker(); - this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.webBrowser2 = new System.Windows.Forms.WebBrowser(); - this.panel1.SuspendLayout(); - this.panel3.SuspendLayout(); - this.panel2.SuspendLayout(); - this.tab_web.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.panel10.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.panel9.SuspendLayout(); - this.tabPage3.SuspendLayout(); - this.panel8.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.fileList)).BeginInit(); - this.serverTab.SuspendLayout(); - this.panel6.SuspendLayout(); - this.panel4.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.panel5.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.panel1.Controls.Add(this.panel3); - this.panel1.Controls.Add(this.panel2); - this.panel1.Location = new System.Drawing.Point(12, 415); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(772, 125); - this.panel1.TabIndex = 0; - // - // panel3 - // - this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel3.Controls.Add(this.btnOptions); - this.panel3.Controls.Add(this.btnCheckFiles); - this.panel3.Controls.Add(this.btnStartSRB2); - this.panel3.Location = new System.Drawing.Point(557, 10); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(204, 104); - this.panel3.TabIndex = 1; - // - // btnOptions - // - this.btnOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnOptions.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnOptions.Location = new System.Drawing.Point(105, 72); - this.btnOptions.Name = "btnOptions"; - this.btnOptions.Size = new System.Drawing.Size(96, 29); - this.btnOptions.TabIndex = 2; - this.btnOptions.Text = "Options"; - this.btnOptions.UseVisualStyleBackColor = true; - this.btnOptions.Click += new System.EventHandler(this.btnOptions_Click); - // - // btnCheckFiles - // - this.btnCheckFiles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnCheckFiles.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCheckFiles.Location = new System.Drawing.Point(4, 72); - this.btnCheckFiles.Name = "btnCheckFiles"; - this.btnCheckFiles.Size = new System.Drawing.Size(96, 29); - this.btnCheckFiles.TabIndex = 1; - this.btnCheckFiles.Text = "Check Files"; - this.btnCheckFiles.UseVisualStyleBackColor = true; - this.btnCheckFiles.Click += new System.EventHandler(this.update_Load); - // - // btnStartSRB2 - // - this.btnStartSRB2.BackColor = System.Drawing.Color.Transparent; - this.btnStartSRB2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnStartSRB2.Location = new System.Drawing.Point(4, 4); - this.btnStartSRB2.Name = "btnStartSRB2"; - this.btnStartSRB2.Size = new System.Drawing.Size(197, 62); - this.btnStartSRB2.TabIndex = 0; - this.btnStartSRB2.Text = "Start"; - this.btnStartSRB2.UseVisualStyleBackColor = false; - this.btnStartSRB2.Click += new System.EventHandler(this.btnStartSRB2_Click); - // - // panel2 - // - this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel2.Controls.Add(this.lblProgress); - this.panel2.Controls.Add(this.update_optional); - this.panel2.Controls.Add(this.progress_overall); - this.panel2.Controls.Add(this.progress_currentFile); - this.panel2.Location = new System.Drawing.Point(10, 10); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(541, 105); - this.panel2.TabIndex = 0; - // - // lblProgress - // - this.lblProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblProgress.AutoSize = true; - this.lblProgress.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblProgress.ForeColor = System.Drawing.Color.Black; - this.lblProgress.Location = new System.Drawing.Point(6, 68); - this.lblProgress.Name = "lblProgress"; - this.lblProgress.Size = new System.Drawing.Size(299, 14); - this.lblProgress.TabIndex = 14; - this.lblProgress.Text = "Click \'Check Files\' to check for and apply updates."; - // - // update_optional - // - this.update_optional.AutoSize = true; - this.update_optional.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.update_optional.Location = new System.Drawing.Point(372, 68); - this.update_optional.Name = "update_optional"; - this.update_optional.Size = new System.Drawing.Size(160, 18); - this.update_optional.TabIndex = 13; - this.update_optional.Text = "Download Optional Updates"; - this.update_optional.UseVisualStyleBackColor = true; - // - // progress_overall - // - this.progress_overall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progress_overall.Location = new System.Drawing.Point(9, 36); - this.progress_overall.Name = "progress_overall"; - this.progress_overall.Size = new System.Drawing.Size(522, 26); - this.progress_overall.TabIndex = 1; - // - // progress_currentFile - // - this.progress_currentFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progress_currentFile.Location = new System.Drawing.Point(9, 4); - this.progress_currentFile.Name = "progress_currentFile"; - this.progress_currentFile.Size = new System.Drawing.Size(522, 26); - this.progress_currentFile.TabIndex = 0; - // - // tab_web - // - this.tab_web.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tab_web.Controls.Add(this.tabPage1); - this.tab_web.Controls.Add(this.tabPage2); - this.tab_web.Controls.Add(this.tabPage3); - this.tab_web.Controls.Add(this.serverTab); - this.tab_web.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - this.tab_web.Location = new System.Drawing.Point(0, 138); - this.tab_web.Name = "tab_web"; - this.tab_web.SelectedIndex = 0; - this.tab_web.Size = new System.Drawing.Size(770, 256); - this.tab_web.TabIndex = 1; - // - // tabPage1 - // - this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage1.Controls.Add(this.panel10); - this.tabPage1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tabPage1.Location = new System.Drawing.Point(4, 23); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(762, 229); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "News & Updates"; - // - // panel10 - // - this.panel10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel10.Controls.Add(this.webBrowser3); - this.panel10.Location = new System.Drawing.Point(4, 6); - this.panel10.Name = "panel10"; - this.panel10.Padding = new System.Windows.Forms.Padding(5); - this.panel10.Size = new System.Drawing.Size(748, 217); - this.panel10.TabIndex = 14; - // - // webBrowser3 - // - this.webBrowser3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.webBrowser3.Location = new System.Drawing.Point(8, 8); - this.webBrowser3.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser3.Name = "webBrowser3"; - this.webBrowser3.Size = new System.Drawing.Size(732, 201); - this.webBrowser3.TabIndex = 0; - this.webBrowser3.Url = new System.Uri("http://update.srb2.org/files_beta/files_beta.xml", System.UriKind.Absolute); - // - // tabPage2 - // - this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage2.Controls.Add(this.panel9); - this.tabPage2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - this.tabPage2.Location = new System.Drawing.Point(4, 23); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(762, 229); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Change Log"; - // - // panel9 - // - this.panel9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel9.Controls.Add(this.webBrowser1); - this.panel9.Location = new System.Drawing.Point(4, 6); - this.panel9.Name = "panel9"; - this.panel9.Padding = new System.Windows.Forms.Padding(5); - this.panel9.Size = new System.Drawing.Size(748, 217); - this.panel9.TabIndex = 13; - // - // webBrowser1 - // - this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.webBrowser1.Location = new System.Drawing.Point(8, 8); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.Size = new System.Drawing.Size(732, 201); - this.webBrowser1.TabIndex = 0; - this.webBrowser1.Url = new System.Uri("http://update.srb2.org/files_beta/changelog.html", System.UriKind.Absolute); - // - // tabPage3 - // - this.tabPage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage3.Controls.Add(this.panel8); - this.tabPage3.Location = new System.Drawing.Point(4, 23); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(762, 229); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Download List"; - // - // panel8 - // - this.panel8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel8.Controls.Add(this.fileList); - this.panel8.Location = new System.Drawing.Point(4, 6); - this.panel8.Name = "panel8"; - this.panel8.Padding = new System.Windows.Forms.Padding(5); - this.panel8.Size = new System.Drawing.Size(748, 217); - this.panel8.TabIndex = 12; - // - // fileList - // - this.fileList.AllowUserToAddRows = false; - this.fileList.AllowUserToDeleteRows = false; - this.fileList.AllowUserToResizeRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black; - this.fileList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.fileList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.fileList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.fileList.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.fileList.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(2); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.fileList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; - this.fileList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.fileList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.name, - this.filename, - this.status, - this.localmd5, - this.md5, - this.optional, - this.calculated}); - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle4.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.fileList.DefaultCellStyle = dataGridViewCellStyle4; - this.fileList.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.fileList.Location = new System.Drawing.Point(8, 8); - this.fileList.MultiSelect = false; - this.fileList.Name = "fileList"; - this.fileList.ReadOnly = true; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.fileList.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; - this.fileList.RowHeadersVisible = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black; - this.fileList.RowsDefaultCellStyle = dataGridViewCellStyle6; - this.fileList.RowTemplate.DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.fileList.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.fileList.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.fileList.RowTemplate.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.Black; - this.fileList.RowTemplate.ReadOnly = true; - this.fileList.Size = new System.Drawing.Size(732, 201); - this.fileList.TabIndex = 11; - // - // name - // - this.name.DataPropertyName = "name"; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - this.name.DefaultCellStyle = dataGridViewCellStyle3; - this.name.FillWeight = 128.7982F; - this.name.HeaderText = "Name"; - this.name.Name = "name"; - this.name.ReadOnly = true; - // - // filename - // - this.filename.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; - this.filename.DataPropertyName = "filename"; - this.filename.HeaderText = "File"; - this.filename.Name = "filename"; - this.filename.ReadOnly = true; - this.filename.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.filename.Width = 150; - // - // status - // - this.status.DataPropertyName = "status"; - this.status.FillWeight = 128.7982F; - this.status.HeaderText = "Status"; - this.status.Name = "status"; - this.status.ReadOnly = true; - // - // localmd5 - // - this.localmd5.DataPropertyName = "localmd5"; - this.localmd5.FillWeight = 13.60544F; - this.localmd5.HeaderText = "localmd5"; - this.localmd5.Name = "localmd5"; - this.localmd5.ReadOnly = true; - this.localmd5.Visible = false; - // - // md5 - // - this.md5.DataPropertyName = "md5"; - this.md5.FillWeight = 128.7982F; - this.md5.HeaderText = "md5"; - this.md5.Name = "md5"; - this.md5.ReadOnly = true; - this.md5.Visible = false; - // - // optional - // - this.optional.DataPropertyName = "optional"; - this.optional.HeaderText = "optional"; - this.optional.Name = "optional"; - this.optional.ReadOnly = true; - this.optional.Visible = false; - // - // calculated - // - this.calculated.DataPropertyName = "calculated"; - this.calculated.HeaderText = "calculated"; - this.calculated.Name = "calculated"; - this.calculated.ReadOnly = true; - this.calculated.Visible = false; - // - // serverTab - // - this.serverTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.serverTab.Controls.Add(this.panel6); - this.serverTab.Controls.Add(this.panel4); - this.serverTab.Location = new System.Drawing.Point(4, 23); - this.serverTab.Name = "serverTab"; - this.serverTab.Padding = new System.Windows.Forms.Padding(3); - this.serverTab.Size = new System.Drawing.Size(762, 229); - this.serverTab.TabIndex = 3; - this.serverTab.Text = "Master Server"; - // - // panel6 - // - this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel6.Controls.Add(this.listViewServers); - this.panel6.Location = new System.Drawing.Point(4, 6); - this.panel6.Name = "panel6"; - this.panel6.Padding = new System.Windows.Forms.Padding(5); - this.panel6.Size = new System.Drawing.Size(603, 217); - this.panel6.TabIndex = 6; - // - // listViewServers - // - this.listViewServers.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewServers.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.listViewServers.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.listViewServers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.colhdrName, - this.colhdrGametype, - this.colhdrPing, - this.colhdrPlayers, - this.colhdrVersion}); - this.listViewServers.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.listViewServers.FullRowSelect = true; - this.listViewServers.HideSelection = false; - this.listViewServers.Location = new System.Drawing.Point(9, 8); - this.listViewServers.Name = "listViewServers"; - this.listViewServers.ShowItemToolTips = true; - this.listViewServers.Size = new System.Drawing.Size(586, 201); - this.listViewServers.TabIndex = 1; - this.listViewServers.UseCompatibleStateImageBehavior = false; - this.listViewServers.View = System.Windows.Forms.View.Details; - this.listViewServers.ItemActivate += new System.EventHandler(this.listViewServers_ItemActivate); - this.listViewServers.SelectedIndexChanged += new System.EventHandler(this.listViewServers_SelectedIndexChanged); - this.listViewServers.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewServers_ColumnClick); - // - // colhdrName - // - this.colhdrName.Tag = ""; - this.colhdrName.Text = "Server Name"; - this.colhdrName.Width = 231; - // - // colhdrGametype - // - this.colhdrGametype.Text = "Gametype"; - this.colhdrGametype.Width = 92; - // - // colhdrPing - // - this.colhdrPing.Text = "Ping (ms)"; - this.colhdrPing.Width = 87; - // - // colhdrPlayers - // - this.colhdrPlayers.Text = "Players"; - this.colhdrPlayers.Width = 88; - // - // colhdrVersion - // - this.colhdrVersion.Text = "Version"; - this.colhdrVersion.Width = 87; - // - // panel4 - // - this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel4.Controls.Add(this.groupBox1); - this.panel4.Controls.Add(this.button1); - this.panel4.Controls.Add(this.button3); - this.panel4.Controls.Add(this.btnConnect); - this.panel4.Location = new System.Drawing.Point(613, 6); - this.panel4.Name = "panel4"; - this.panel4.Padding = new System.Windows.Forms.Padding(5); - this.panel4.Size = new System.Drawing.Size(139, 217); - this.panel4.TabIndex = 5; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Location = new System.Drawing.Point(9, 114); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(122, 95); - this.groupBox1.TabIndex = 5; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Key"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.ForeColor = System.Drawing.Color.Black; - this.label4.Location = new System.Drawing.Point(6, 77); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 14); - this.label4.TabIndex = 3; - this.label4.Text = "Normal Game"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.ForeColor = System.Drawing.Color.DimGray; - this.label3.Location = new System.Drawing.Point(6, 57); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(78, 14); - this.label3.TabIndex = 2; - this.label3.Text = "Game is Full"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.Green; - this.label2.Location = new System.Drawing.Point(6, 37); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(99, 14); - this.label2.TabIndex = 1; - this.label2.Text = "Cheats Enabled"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Red; - this.label1.Location = new System.Drawing.Point(6, 17); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(57, 14); - this.label1.TabIndex = 0; - this.label1.Text = "Modified"; - // - // button1 - // - this.button1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F); - this.button1.Location = new System.Drawing.Point(8, 8); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(123, 29); - this.button1.TabIndex = 2; - this.button1.Text = "Refresh List"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.btnRefresh_Click); - // - // button3 - // - this.button3.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F); - this.button3.Location = new System.Drawing.Point(8, 78); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(123, 29); - this.button3.TabIndex = 4; - this.button3.Text = "Join Game (IP)"; - this.button3.UseVisualStyleBackColor = true; - // - // btnConnect - // - this.btnConnect.Enabled = false; - this.btnConnect.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F); - this.btnConnect.Location = new System.Drawing.Point(8, 43); - this.btnConnect.Name = "btnConnect"; - this.btnConnect.Size = new System.Drawing.Size(123, 29); - this.btnConnect.TabIndex = 3; - this.btnConnect.Text = "Join Game (List)"; - this.btnConnect.UseVisualStyleBackColor = true; - this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click); - // - // panel5 - // - this.panel5.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel5.Controls.Add(this.tab_web); - this.panel5.Controls.Add(this.bannerRandom); - this.panel5.Location = new System.Drawing.Point(12, 13); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(772, 396); - this.panel5.TabIndex = 1; - // - // bannerRandom - // - this.bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner4; - this.bannerRandom.Location = new System.Drawing.Point(0, -2); - this.bannerRandom.Name = "bannerRandom"; - this.bannerRandom.Size = new System.Drawing.Size(768, 123); - this.bannerRandom.TabIndex = 3; - // - // backgroundWorkerQueryServers - // - this.backgroundWorkerQueryServers.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorkerQueryServers_DoWork); - // - // openFileDialog1 - // - this.openFileDialog1.DefaultExt = "exe"; - this.openFileDialog1.Filter = "Executables files|*.exe|All files|*.*"; - // - // webBrowser2 - // - this.webBrowser2.Location = new System.Drawing.Point(8, 8); - this.webBrowser2.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser2.Name = "webBrowser2"; - this.webBrowser2.Size = new System.Drawing.Size(567, 201); - this.webBrowser2.TabIndex = 0; - this.webBrowser2.Url = new System.Uri("http://update.srb2.org/files_beta/changelog.html", System.UriKind.Absolute); - // - // Launcher - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.ClientSize = new System.Drawing.Size(796, 552); - this.Controls.Add(this.panel5); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.KeyPreview = true; - this.Name = "Launcher"; - this.Text = "Launcher"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Launcher_FormClosed); - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Launcher_KeyUp); - this.panel1.ResumeLayout(false); - this.panel3.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.tab_web.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.panel10.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - this.panel9.ResumeLayout(false); - this.tabPage3.ResumeLayout(false); - this.panel8.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.fileList)).EndInit(); - this.serverTab.ResumeLayout(false); - this.panel6.ResumeLayout(false); - this.panel4.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.panel5.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Button btnOptions; - private System.Windows.Forms.Button btnCheckFiles; - private System.Windows.Forms.Button btnStartSRB2; - private System.Windows.Forms.TabControl tab_web; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Panel panel5; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.Panel bannerRandom; - private System.Windows.Forms.ProgressBar progress_overall; - private System.Windows.Forms.ProgressBar progress_currentFile; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.DataGridView fileList; - private System.Windows.Forms.CheckBox update_optional; - private System.Windows.Forms.Label lblProgress; - private System.Windows.Forms.DataGridViewTextBoxColumn name; - private System.Windows.Forms.DataGridViewTextBoxColumn filename; - private System.Windows.Forms.DataGridViewTextBoxColumn status; - private System.Windows.Forms.DataGridViewTextBoxColumn localmd5; - private System.Windows.Forms.DataGridViewTextBoxColumn md5; - private System.Windows.Forms.DataGridViewTextBoxColumn optional; - private System.Windows.Forms.DataGridViewTextBoxColumn calculated; - private System.Windows.Forms.TabPage serverTab; - private System.Windows.Forms.ListView listViewServers; - private System.Windows.Forms.ColumnHeader colhdrName; - private System.Windows.Forms.ColumnHeader colhdrGametype; - private System.Windows.Forms.ColumnHeader colhdrPing; - private System.Windows.Forms.ColumnHeader colhdrPlayers; - private System.Windows.Forms.ColumnHeader colhdrVersion; - private System.ComponentModel.BackgroundWorker backgroundWorkerQueryServers; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button btnConnect; - private System.Windows.Forms.OpenFileDialog openFileDialog1; - private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.Panel panel8; - private System.Windows.Forms.Panel panel9; - private System.Windows.Forms.Panel panel10; - private System.Windows.Forms.WebBrowser webBrowser3; - private System.Windows.Forms.WebBrowser webBrowser2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label4; - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/Launcher.cs b/tools/SRB2Updater/Launcher.cs deleted file mode 100644 index df2fdf712..000000000 --- a/tools/SRB2Updater/Launcher.cs +++ /dev/null @@ -1,658 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -//using System.Data.OleDb; -using System.Xml; -//using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Net; -using System.IO; -using System.Threading; -using System.Security.Cryptography; -//using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Drawing; -using System.Media; - -namespace SRB2Updater -{ - public partial class Launcher : Form - { - private Settings settings = new Settings(); - private Debug debug = new Debug(); - // The thread inside which the download happens - private Thread thrDownload; - private Thread thrTotal; - // The stream of data retrieved from the web server - private Stream strResponse; - // The stream of data that we write to the harddrive - private Stream strLocal; - // The request to the web server for file information - private HttpWebRequest webRequest; - // The response from the web server containing information about the file - private HttpWebResponse webResponse; - // The progress of the download in percentage - private static int PercentProgress; - private static int OverallPercentProgress; - // Overall progress as a percentage - private static Int64 OverallProgress; - // Progress stored, for calculating overall - private static Int64 CurrentProgress; - // Total File Size of entire update - private static Int64 TotalSize; - // The delegate which we will call from the thread to update the form - private delegate void UpdateProgessCallback(Int64 BytesRead, Int64 TotalBytes); - private delegate void OverallProgessCallback(Int64 BytesRead); - // When to pause - bool goPause = false; - // Download Details - string downFile; - // Updating - bool filesGot = false; - bool downloadStatus = false; - bool doneCalculate = false; - string formTitle = "Sonic Robo Blast 2 Launcher"; - bool loadedBat = false; - ProcessStartInfo startinfo = new ProcessStartInfo(); - private ServerQuerier sq; - private string MSFail; - - public Launcher(string[] args) - { - InitializeComponent(); - settings.GetSettings(); - sq = new ServerQuerier(); - ServerInfoListViewAdder silva = new ServerInfoListViewAdder(sq, this); - try - { - sq.SetMasterServer(settings.msAddress, Convert.ToUInt16(settings.msPort)); - } - catch (Exception exception) - { - MSFail = exception.Message; - } - sq.StartListening(silva); - backgroundWorkerQueryServers.RunWorkerAsync(); - foreach (string arg in args) - { - if (arg == "-debug") - { - debug.Show(); - break; - } - } - RandomBanner(); - } - - public string getMD5(string filename) - { - StringBuilder sb = new StringBuilder(); - FileInfo f = new FileInfo(filename); - FileStream fs = f.OpenRead(); - MD5 md5 = new MD5CryptoServiceProvider(); - byte[] hash = md5.ComputeHash(fs); - fs.Close(); - foreach (byte hex in hash) - sb.Append(hex.ToString("x2")); - string md5sum = sb.ToString(); - return md5sum; - } - - public void PlayIt() - { - SoundPlayer player = new SoundPlayer(Properties.Resources.Kotaku); - player.Play(); - } - - public void RandomBanner() - { - Random random = new Random(); - int rand = random.Next(0, 4); - //this.bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner; - switch (rand) - { - case 0: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner; - break; - case 1: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner2; - break; - case 2: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner3; - break; - case 3: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner4; - break; - default: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner; - break; - } - - debug.strRandom = Convert.ToString(rand); - } - - private void updateList(bool doCalculate) - { - if (filesGot == false) - { - - XmlDataDocument xmlDatadoc = new XmlDataDocument(); - xmlDatadoc.DataSet.ReadXml("http://update.srb2.org/files_beta/files_beta.xml"); - DataSet ds = new DataSet("Files DataSet"); - ds = xmlDatadoc.DataSet; - fileList.DataSource = ds.DefaultViewManager; - fileList.DataMember = "File"; - filesGot = true; - } - if (downloadStatus == false) - { - foreach (DataGridViewRow fileRow in fileList.Rows) - { - if (!File.Exists(fileRow.Cells["filename"].Value.ToString()) && fileRow.Cells["filename"].Value.ToString() != "srb2update.update") - { -// fileRow.DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); - fileRow.Cells["localmd5"].Value = "not_found"; - } else { - if (fileRow.Cells["filename"].Value.ToString() == "srb2update.update") - fileRow.Cells["localmd5"].Value = getMD5("srb2update.exe"); - else - fileRow.Cells["localmd5"].Value = getMD5(fileRow.Cells["filename"].Value.ToString()); - } - if (fileRow.Cells["localmd5"].Value.ToString() != fileRow.Cells["md5"].Value.ToString()) - { -// if (fileRow.Cells["localmd5"].Value.ToString() != "not_found") -// fileRow.DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - fileRow.Cells["status"].Value = "Queued"; - - } - else - { - fileRow.Cells["status"].Value = "Up to date"; - } - } - if (doCalculate) - { - thrTotal = new Thread(new ParameterizedThreadStart(CalculateTotalSize)); - thrTotal.Start(0); - } - if (doneCalculate) - { - foreach (DataGridViewRow fileRow in fileList.Rows) - { - if (fileRow.Cells["localmd5"].Value.ToString() != fileRow.Cells["md5"].Value.ToString()) - { - if (fileRow.Cells["optional"].Value.ToString() == "1" && !update_optional.Checked) - fileRow.Cells["Status"].Value = "Skipped (Optional)"; - else - { - downFile = fileRow.Cells["filename"].Value.ToString(); - thrDownload = new Thread(new ParameterizedThreadStart(Download)); - thrDownload.Start(0); - fileRow.Cells["Status"].Value = "Downloading..."; - downloadStatus = true; - break; - } - } - else - { - fileRow.Cells["Status"].Value = "Up to date"; - } - CurrentProgress = 0; - } - } - } - } - - private void UpdateProgress(Int64 BytesRead, Int64 TotalBytes) - { - // Calculate the download progress in percentages - PercentProgress = Convert.ToInt32((BytesRead * 100) / TotalBytes); - // Make progress on the progress bar - progress_currentFile.Value = PercentProgress; - // Display the current progress on the form - lblProgress.Text = downFile + " - " + (BytesRead / 1024) + "KB of " + (TotalBytes / 1024) + "KB (" + PercentProgress + "%)"; - this.Text = formTitle + " :: Downloading " + downFile + " (" + PercentProgress + "%)"; - debug.strPercent = PercentProgress.ToString() + "%"; - if (BytesRead >= TotalBytes - 1) - updateList(false); - } - - private void UpdateOverallProgress(Int64 BytesRead) - { - // Calculate progress change and add to OverallProgress... - OverallProgress += BytesRead - CurrentProgress; - // Calculate the download progress in percentages - if (TotalSize < 1) - TotalSize = 1; - OverallPercentProgress = Convert.ToInt32((OverallProgress * 100) / TotalSize); - // Make progress on the progress bar - if (OverallPercentProgress > 100) - OverallPercentProgress = 100; - progress_overall.Value = OverallPercentProgress; - if (OverallProgress >= TotalSize) - { - lblProgress.Text = "Done"; - btnCheckFiles.Enabled = true; - } - CurrentProgress = BytesRead; - debug.strCurrent = Convert.ToString(CurrentProgress) + " bytes"; - debug.strOverall = Convert.ToString(OverallProgress) + " bytes"; - debug.strOverallPercentage = Convert.ToString(OverallPercentProgress) + "%"; - debug.strRead = Convert.ToString(BytesRead) + " bytes"; - debug.strTotal = Convert.ToString(TotalSize) + " bytes"; - } - - private void CalculateTotalSize(object startpoint) - { - foreach (DataGridViewRow fileRow in fileList.Rows) - { - if ((fileRow.Cells["optional"].Value.ToString() == "0" || update_optional.Checked) && fileRow.Cells["localmd5"].Value.ToString() != fileRow.Cells["md5"].Value.ToString()) - { - try - { - // Create a request to the file we are downloading - webRequest = (HttpWebRequest)WebRequest.Create("http://update.srb2.org/files_beta/" + fileRow.Cells["filename"].Value.ToString()); - // Set the starting point of the request - webRequest.AddRange(0); - - // Set default authentication for retrieving the file - webRequest.Credentials = CredentialCache.DefaultCredentials; - // Retrieve the response from the server - webResponse = (HttpWebResponse)webRequest.GetResponse(); - // Ask the server for the file size and store it - Int64 fileSize = webResponse.ContentLength; - TotalSize = TotalSize + fileSize; - } - finally - { - // When the above code has ended, close the streams - webResponse.Close(); - } - } - } - doneCalculate = true; - updateList(false); - } - - private void Download(object startpoint) - { - try - { - string filename = Convert.ToString(startpoint); - // Create a request to the file we are downloading - webRequest = (HttpWebRequest)WebRequest.Create("http://update.srb2.org/files_beta/" + downFile); - // Set the starting point of the request - webRequest.AddRange(0); - - // Set default authentication for retrieving the file - webRequest.Credentials = CredentialCache.DefaultCredentials; - // Retrieve the response from the server - webResponse = (HttpWebResponse)webRequest.GetResponse(); - // Ask the server for the file size and store it - Int64 fileSize = webResponse.ContentLength; - - // Open the URL for download - strResponse = webResponse.GetResponseStream(); - - // Create a new file stream where we will be saving the data (local drive) - strLocal = new FileStream(downFile, FileMode.Create, FileAccess.Write, FileShare.None); - // It will store the current number of bytes we retrieved from the server - int bytesSize = 0; - // A buffer for storing and writing the data retrieved from the server - byte[] downBuffer = new byte[2048]; - - // Loop through the buffer until the buffer is empty - while ((bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0) - { - // Write the data from the buffer to the local hard drive - strLocal.Write(downBuffer, 0, bytesSize); - // Invoke the method that updates the form's label and progress bar - this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { strLocal.Length, fileSize }); - this.Invoke(new OverallProgessCallback(this.UpdateOverallProgress), new object[] { strLocal.Length }); - - if (goPause == true) - { - break; - } - } - } - finally - { - // When the above code has ended, close the streams - strResponse.Close(); - strLocal.Close(); - // And update the row! - downloadStatus = false; - if (downFile == "srb2update.update" && loadedBat != true) - { - MessageBox.Show("The updater will now restart to apply a patch.", "Self Update", MessageBoxButtons.OK); - CreateUpdaterBat(); - startinfo.WindowStyle = ProcessWindowStyle.Hidden; - startinfo.FileName = "srb2update.bat"; - System.Diagnostics.Process.Start(startinfo); - downloadStatus = false; - Environment.Exit(0); - } else - updateList(false); - } - } - - private void CreateUpdaterBat() - { - File.WriteAllText("srb2update.bat", "ping 127.0.0.1\ncopy srb2update.update srb2update.exe\ndel srb2update.update\nsrb2update.exe\nexit"); - } - - - private void update_Load(object sender, EventArgs e) - { - lblProgress.Text = "Getting File List..."; - if (File.Exists("srb2update.bat")) - File.Delete("srb2update.bat"); - TotalSize = 0; - CurrentProgress = 0; - OverallPercentProgress = 0; - OverallProgress = 0; - btnCheckFiles.Enabled = false; - updateList(true); - } - - private void btnOptions_Click(object sender, EventArgs e) - { - new Options(settings).ShowDialog(); - } - - private class ServerInfoListViewAdder : ServerQuerier.ServerInfoReceiveHandler - { - private delegate ListViewItem AddToListCallback(ListViewItem lvi); - private Launcher form1; - private Dictionary dicGametypes = new Dictionary(); - private static Dictionary> dicDefaultFiles = - new Dictionary>(); - - static ServerInfoListViewAdder() - { - dicDefaultFiles.Add( - ServerQuerier.ServerInfoVer.SIV_PREME, - new List( - new string[] { - "srb2.srb", "sonic.plr", "tails.plr", "knux.plr", - "auto.wpn", "bomb.wpn", "home.wpn", "rail.wpn", "infn.wpn", - "drill.dta", "soar.dta", "music.dta" - }) - ); - - dicDefaultFiles.Add( - ServerQuerier.ServerInfoVer.SIV_ME, - new List( - new string[] { - "srb2.wad", "sonic.plr", "tails.plr", "knux.plr", - "rings.wpn", "drill.dta", "soar.dta", "music.dta" - }) - ); - } - - - public ServerInfoListViewAdder(ServerQuerier sq, Launcher form1) - : base(sq) - { - this.form1 = form1; - - // Gametypes. - dicGametypes.Add(0, "Co-op"); - dicGametypes.Add(1, "Match"); - dicGametypes.Add(2, "Race"); - dicGametypes.Add(3, "Tag"); - dicGametypes.Add(4, "CTF"); - dicGametypes.Add(5, "Chaos"); - - // Don't think these are actually used. - dicGametypes.Add(42, "Team Match"); - dicGametypes.Add(43, "Time-Only Race"); - } - - public override void ProcessServerInfo(ServerQuerier.SRB2ServerInfo srb2si) - { - ListView lv = form1.listViewServers; - - // Build a list item. - ListViewItem lvi = new ListViewItem(srb2si.strName); - - // So we can get address and whatever else we might need. - lvi.Tag = srb2si; - - // Gametype string, or number if not recognised. - if (dicGametypes.ContainsKey(srb2si.byGametype)) - lvi.SubItems.Add(dicGametypes[srb2si.byGametype]); - else - lvi.SubItems.Add(Convert.ToString(srb2si.byGametype)); - - lvi.SubItems.Add(Convert.ToString(srb2si.uiTime)); - lvi.SubItems.Add(srb2si.byPlayers + "/" + srb2si.byMaxplayers); - lvi.SubItems.Add(srb2si.strVersion); - - // Make the tooltip. - BuildTooltip(lvi, form1.settings.ShowDefaultWads); - - // Is the game full? - if (srb2si.byPlayers >= srb2si.byMaxplayers) - lvi.ForeColor = Color.DimGray; - // Modified? - else if (srb2si.bModified) - lvi.ForeColor = Color.Red; - - // Thread-safe goodness. - if (lv.InvokeRequired) - { - // Call ourselves in the context of the form's thread. - AddToListCallback addtolistcallback = new AddToListCallback(lv.Items.Add); - lv.Invoke(addtolistcallback, new object[] { lvi }); - } - else - { - // Add it! - lv.Items.Add(lvi); - } - - } - - public override void HandleException(Exception e) - { - - } - - public static void BuildTooltip(ListViewItem lvi, bool bShowDefaultWads) - { - string strWads = String.Empty; - ServerQuerier.SRB2ServerInfo srb2si = (ServerQuerier.SRB2ServerInfo)lvi.Tag; - - foreach (ServerQuerier.AddedWad aw in srb2si.listFiles) - { - List listDefaultFiles = dicDefaultFiles[srb2si.siv]; - - if (bShowDefaultWads || !listDefaultFiles.Contains(aw.strFilename)) - { - strWads += String.Format("\n{0} ({1:f1} KB)", aw.strFilename, Convert.ToSingle(aw.uiSize) / 1024); - if (aw.bImportant) - { - if (aw.downloadtype == ServerQuerier.DownloadTypes.DT_TOOBIG) - strWads += " (too big to download)"; - else if (aw.downloadtype == ServerQuerier.DownloadTypes.DT_DISABLED) - strWads += " (downloading disabled)"; - } - else strWads += " (unimportant)"; - } - } - - lvi.ToolTipText = "Current map: " + srb2si.strMapName + "\n"; - if (strWads != String.Empty) - lvi.ToolTipText += "Wads added:" + strWads; - else lvi.ToolTipText += "No wads added"; - } - } - - private void backgroundWorkerQueryServers_DoWork(object sender, DoWorkEventArgs e) - { - MSClient msclient = new MSClient(); - - try - { - List listServers = msclient.GetServerList(settings.msAddress, Convert.ToUInt16(settings.msPort)); - - - // Query each of the individual servers asynchronously. - foreach (MSServerEntry msse in listServers) - { - sq.Query(msse.strAddress, msse.unPort); - } - } - catch (System.Net.Sockets.SocketException sockexception) - { - MSFail = sockexception.Message; - } - catch (Exception exception) - { - MSFail = exception.Message; - } - } - - private void btnRefresh_Click(object sender, EventArgs e) - { - if (!backgroundWorkerQueryServers.IsBusy) - { - // Clear the server list. - listViewServers.Items.Clear(); - - // Disable the Connect button. - btnConnect.Enabled = false; - - // Query the MS and the individual servers in another thread. - backgroundWorkerQueryServers.RunWorkerAsync(); - } - } - - private void btnConnect_Click(object sender, EventArgs e) - { - if (listViewServers.SelectedItems.Count > 0) - { - ConnectToServerFromListItem(listViewServers.SelectedItems[0]); - } - } - - private void ConnectToServerFromListItem(ListViewItem lvi) - { - ServerQuerier.SRB2ServerInfo srb2si = (ServerQuerier.SRB2ServerInfo)lvi.Tag; - - // Prompt to get a binary if we need one. - if (!settings.HasBinaryForVersion(srb2si.strVersion) && - MessageBox.Show("To join this game, you must register an executable file for version " + srb2si.strVersion + ". Would you like to do so?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes && - openFileDialog1.ShowDialog() == DialogResult.OK) - { - settings.SetBinary(srb2si.strVersion, openFileDialog1.FileName); - settings.SaveSettings(); - } - - // Go! - ConnectToServer(srb2si.strAddress, srb2si.unPort, srb2si.strVersion); - } - - private void ConnectToServer(string strAddress, ushort unPort, string strVersion) - { - // Make sure we now have a binary. - if (settings.HasBinaryForVersion(strVersion)) - { - try - { - string strBinary = settings.GetBinary(strVersion); - string strDirectory = System.IO.Path.GetDirectoryName(strBinary); - if (strDirectory != String.Empty) - System.IO.Directory.SetCurrentDirectory(strDirectory); - System.Diagnostics.Process.Start(strBinary, System.String.Format("-connect {0}:{1} {2}", strAddress, unPort, settings.Params)).Close(); - if (settings.CloseOnStart) - Environment.Exit(0); - } - catch (Exception exception) - { - MessageBox.Show("Unable to start SRB2: " + exception.Message + ".", "SRB2 MS Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - private class ListViewSorter : System.Collections.IComparer - { - private int iColumn; - public int Column { get { return iColumn; } } - public SortOrder so; - - public ListViewSorter(int iColumn) - { - this.iColumn = iColumn; - so = SortOrder.Ascending; - } - - public int Compare(object x, object y) - { - ListViewItem lviX = (ListViewItem)x; - ListViewItem lviY = (ListViewItem)y; - - return ((so == SortOrder.Ascending) ? 1 : -1) * String.Compare(lviX.SubItems[iColumn].Text, lviY.SubItems[iColumn].Text); - } - - public void ToggleSortOrder() - { - if (so != SortOrder.Ascending) - so = SortOrder.Ascending; - else - so = SortOrder.Descending; - } - } - - private void listViewServers_ColumnClick(object sender, ColumnClickEventArgs e) - { - if (listViewServers.ListViewItemSorter != null && - ((ListViewSorter)listViewServers.ListViewItemSorter).Column == e.Column) - { - ((ListViewSorter)listViewServers.ListViewItemSorter).ToggleSortOrder(); - listViewServers.Sort(); - } - else - { - listViewServers.ListViewItemSorter = new ListViewSorter(e.Column); - } - } - - private void listViewServers_SelectedIndexChanged(object sender, EventArgs e) - { - btnConnect.Enabled = (listViewServers.SelectedItems.Count > 0); - } - - private void listViewServers_ItemActivate(object sender, EventArgs e) - { - ConnectToServerFromListItem(listViewServers.SelectedItems[0]); - } - - private void Launcher_FormClosed(object sender, FormClosedEventArgs e) - { - Environment.Exit(0); - } - - private Bunny sequence = new Bunny(); - - private void Launcher_KeyUp(object sender, KeyEventArgs e) - { - if (sequence.IsCompletedBy(e.KeyCode)) - { - PlayIt(); - } - debug.strKonami = Convert.ToString(sequence.Position); - } - - private void btnStartSRB2_Click(object sender, EventArgs e) - { - System.Diagnostics.Process.Start("srb2win.exe", System.String.Format("{0}", settings.Params)).Close(); - if(settings.CloseOnStart) - Environment.Exit(0); - } - } -} diff --git a/tools/SRB2Updater/Launcher.resx b/tools/SRB2Updater/Launcher.resx deleted file mode 100644 index 464d72c21..000000000 --- a/tools/SRB2Updater/Launcher.resx +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - 17, 17 - - - 585, 17 - - - - - AAABAAEAICAAAAEACACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAADg4OAIAAAABQABkAlgAAALkAAABQGQAAcwAlAJYAMQBzJQAAuQA9AJYxAACWAGIAMjIyALk9 - AAD/JSUAPj4+AFZWVgD/SEgAYmJiAABilgBubm4Aenp6AP9rawCAgIAAhoaGAJKSkgD/jo4Anp6eAKSg - oAD/jqsAqqqqAGuP/wC2trYAwMDAAI6r/wDCwsIAa8b/AM7OzgCO1P8A2traAObm5gDy8vIA////AAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAGgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQ8PHQAAAAAAAAAAAAAAACMgJSUlJSUZ - AAAAABMNBgoPDw8AAAAAAAAAAAAAACInJycnJycnJyclFgYGBggPDw8PDwAAAAAAAAAAAAAjJycnJycn - JycnGScnFQkGCA8PDw8AAAAAAAAAAAAAISMnJycjIyMjJycnJycVDwYGDw8PDwAAAAAAAAAAAAAQAAEj - HygqKSkkHyMnJwoPDwYJDw8PAAAAAAAAAAAAACkTHxwrKysrKysrGhkMDw8PCwYJDw8AAAAAAAAAACkp - JA0pACkrKysrKyspDw8PDw8PAwYIAAAAAAAAAAAAACsiARwAISsrKysrKysSDw8PDw8PAwYAAAAAAAAA - AAAAKyIAEAAfKysrKysrKxcPDw8PDw8PDwgIABYAABcSCAArKAMPACIrKysrKysrGw8PDw8PDw8PDw8P - Dw8PDw8RACsoBA8EISsrKysrKyseDw8PDw8PDw8PDw8PDw8PDwAAKx8PDw8VKSsrKysrKxcPDw8PDw8P - Dw8PDw8PDw8AACooFQ8PDw8aKCsrKysmDw8PDw8PDw8PDw8PDw8PFQAAAAAKDw8PDw8VIigoIgoPDw8P - Dw8PDw8PDw8PDxEAAAAAAAoPDw8PDw8XFxcXEhIPDwUPDw8PDw8PDw8YAAAAAAAACA8PDw8SFxcXFxcX - FxcPFQ8PDw8PDw8KAAAAAAAAAAAACg8PEhcXFxcXFxcXFxkjBRISEhISGAAAAAAAAAAAIRcXCA8XFxcX - FxcXFxcaJyMFDwoLEQAAAAAAAAAAAAAAFxcSDxIXFxcXFxcSEyAlIwILCwsIAAAAAAAAAAAAABcXEg8A - EhIXFxcXEgoPDBUUBwsLCwsLAAAAAAAAAAAAFxcAAAAAFxIXFxcXFxIKDw8ICwsLDg4LAAAAAAAAAAAA - AAAAAAAAABISFxcXFw8PDw8PDw8PDwAAAAAAAAAAAAAAAAAAAAAAAAASEhcSDw8PDw8PDxIAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAFwoSDw8SFwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///////////////////3////w//APAf/AAAH/gAAD/wAAA/8AAAP/AAAD/AAAB/4AA - Af+AAABYgAAAAIAAAAGAAAADAAAAA8AAAAfAAAAPwAAAP+AAAH+AAAH/wAAB/4QAAP+eAAB//4AA///g - Af//+A////////////////// - - - \ No newline at end of file diff --git a/tools/SRB2Updater/MSClient.cs b/tools/SRB2Updater/MSClient.cs deleted file mode 100644 index 40cb0d984..000000000 --- a/tools/SRB2Updater/MSClient.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net.Sockets; -using System.Net; -using System.IO; - -namespace SRB2Updater -{ - class MSClient - { - private Socket socket; - - /// - /// Constructs an MS client object. - /// - public MSClient() - { - socket = new Socket( - AddressFamily.InterNetwork, - SocketType.Stream, - ProtocolType.IP); - } - - /// - /// Gets list of servers reported by the MS. - /// - /// Hostname or IP address of MS. - /// Port of MS. - /// List of running servers. - public List GetServerList(string strAddress, ushort unPort) - { - // Resolve the address if necessary. - IPHostEntry iphe = Dns.GetHostEntry(strAddress); - - int iIPIndex = 0; - while (iIPIndex < iphe.AddressList.Length && - iphe.AddressList[iIPIndex].AddressFamily != socket.AddressFamily) - { - iIPIndex++; - } - - // No addresses from our family? - if (iIPIndex >= iphe.AddressList.Length) - throw new SocketException((int)SocketError.HostNotFound); - - socket.Connect(iphe.AddressList[iIPIndex], unPort); - - // Send a request for the short server list. - byte[] byPacket = new byte[12]; - BinaryWriter bw = new BinaryWriter(new MemoryStream(byPacket)); - bw.Write((uint)0); // Unused - bw.Write((uint)IPAddress.HostToNetworkOrder(205)); // GET_SHORT_SERVER_MSG - bw.Write((uint)0); // Length of tail. - socket.Send(byPacket); - - List listServers = new List(); - - // Don't sit and wait for ever. - socket.ReceiveTimeout = 10000; - - // Keep reading packets. We break if we receive the sentinel end-packet. - byte[] byServer = new byte[12 + 80]; - while (true) - { - int iLen = socket.Receive(byServer); - BinaryReader br = new BinaryReader(new MemoryStream(byServer)); - - // Ignore the first eight bytes. - br.ReadInt64(); - - // Is that the list finished? - int iTailLen = IPAddress.NetworkToHostOrder(br.ReadInt32()); - if (iTailLen == 0) - break; - else if (iTailLen != iLen - 12) - { - // MS is in a bad mood. - //throw new Exception("Bad packet."); - break; - } - - // Otherwise, add the server to the list. - MSServerEntry msse = new MSServerEntry(); - - br.ReadBytes(16); // Skip. - msse.strAddress = Encoding.ASCII.GetString(br.ReadBytes(16)); - - string str = Encoding.ASCII.GetString(br.ReadBytes(8)); - int iPos = str.IndexOf("\0"); - if (iPos >= 0) - str = str.Remove(iPos); - msse.unPort = Convert.ToUInt16(str); - - msse.strName = Encoding.ASCII.GetString(br.ReadBytes(32)); - iPos = msse.strName.IndexOf("\0"); - if (iPos >= 0) - msse.strName = msse.strName.Remove(iPos); - - msse.strVersion = Encoding.ASCII.GetString(br.ReadBytes(8)); - iPos = msse.strVersion.IndexOf("\0"); - if (iPos >= 0) - msse.strVersion = msse.strVersion.Remove(iPos); - - listServers.Add(msse); - } - - return listServers; - } - } - - public struct MSServerEntry - { - public string strAddress; - public ushort unPort; - public string strName; - public string strVersion; - public bool bPermanent; - } - -} diff --git a/tools/SRB2Updater/Options.Designer.cs b/tools/SRB2Updater/Options.Designer.cs deleted file mode 100644 index 01234549d..000000000 --- a/tools/SRB2Updater/Options.Designer.cs +++ /dev/null @@ -1,628 +0,0 @@ -namespace SRB2Updater -{ - partial class Options - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Options)); - this.groupDisplay = new System.Windows.Forms.GroupBox(); - this.label2 = new System.Windows.Forms.Label(); - this.txtHeight = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.txtWidth = new System.Windows.Forms.TextBox(); - this.chkCustomResolution = new System.Windows.Forms.CheckBox(); - this.chkDisplayWindowed = new System.Windows.Forms.CheckBox(); - this.panel1 = new System.Windows.Forms.Panel(); - this.btnCancel = new System.Windows.Forms.Button(); - this.btnSave = new System.Windows.Forms.Button(); - this.panel2 = new System.Windows.Forms.Panel(); - this.groupMS = new System.Windows.Forms.GroupBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtMSPort = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtMSAddress = new System.Windows.Forms.TextBox(); - this.panel3 = new System.Windows.Forms.Panel(); - this.panel7 = new System.Windows.Forms.Panel(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.txtParams = new System.Windows.Forms.TextBox(); - this.label9 = new System.Windows.Forms.Label(); - this.panel4 = new System.Windows.Forms.Panel(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.listviewBinaries = new System.Windows.Forms.ListView(); - this.colhdrVersion = new System.Windows.Forms.ColumnHeader(); - this.colhdrBinary = new System.Windows.Forms.ColumnHeader(); - this.textboxBinary = new System.Windows.Forms.TextBox(); - this.btnAdd = new System.Windows.Forms.Button(); - this.btnDel = new System.Windows.Forms.Button(); - this.label5 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.btnBrowse = new System.Windows.Forms.Button(); - this.textboxVersion = new System.Windows.Forms.TextBox(); - this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.panel5 = new System.Windows.Forms.Panel(); - this.panel6 = new System.Windows.Forms.Panel(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.chkShowDefaultWads = new System.Windows.Forms.CheckBox(); - this.chkCloseOnStart = new System.Windows.Forms.CheckBox(); - this.groupDisplay.SuspendLayout(); - this.panel1.SuspendLayout(); - this.panel2.SuspendLayout(); - this.groupMS.SuspendLayout(); - this.panel3.SuspendLayout(); - this.panel7.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.panel4.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.panel5.SuspendLayout(); - this.panel6.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.SuspendLayout(); - // - // groupDisplay - // - this.groupDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupDisplay.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.groupDisplay.Controls.Add(this.label2); - this.groupDisplay.Controls.Add(this.txtHeight); - this.groupDisplay.Controls.Add(this.label1); - this.groupDisplay.Controls.Add(this.txtWidth); - this.groupDisplay.Controls.Add(this.chkCustomResolution); - this.groupDisplay.Controls.Add(this.chkDisplayWindowed); - this.groupDisplay.Location = new System.Drawing.Point(8, 8); - this.groupDisplay.Name = "groupDisplay"; - this.groupDisplay.Size = new System.Drawing.Size(268, 102); - this.groupDisplay.TabIndex = 1; - this.groupDisplay.TabStop = false; - this.groupDisplay.Text = "Display Settings"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(128, 74); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(46, 15); - this.label2.TabIndex = 5; - this.label2.Text = "Height:"; - // - // txtHeight - // - this.txtHeight.Location = new System.Drawing.Point(175, 71); - this.txtHeight.MaxLength = 4; - this.txtHeight.Name = "txtHeight"; - this.txtHeight.Size = new System.Drawing.Size(46, 21); - this.txtHeight.TabIndex = 4; - this.txtHeight.Text = "768"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(19, 74); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(41, 15); - this.label1.TabIndex = 3; - this.label1.Text = "Width:"; - // - // txtWidth - // - this.txtWidth.Location = new System.Drawing.Point(66, 71); - this.txtWidth.MaxLength = 4; - this.txtWidth.Name = "txtWidth"; - this.txtWidth.Size = new System.Drawing.Size(46, 21); - this.txtWidth.TabIndex = 2; - this.txtWidth.Text = "1024"; - // - // chkCustomResolution - // - this.chkCustomResolution.AutoSize = true; - this.chkCustomResolution.Location = new System.Drawing.Point(6, 46); - this.chkCustomResolution.Name = "chkCustomResolution"; - this.chkCustomResolution.Size = new System.Drawing.Size(159, 19); - this.chkCustomResolution.TabIndex = 1; - this.chkCustomResolution.Text = "Use Custom Resolution"; - this.chkCustomResolution.UseVisualStyleBackColor = true; - this.chkCustomResolution.CheckedChanged += new System.EventHandler(this.chkCustomResolution_CheckedChanged); - // - // chkDisplayWindowed - // - this.chkDisplayWindowed.AutoSize = true; - this.chkDisplayWindowed.Location = new System.Drawing.Point(6, 20); - this.chkDisplayWindowed.Name = "chkDisplayWindowed"; - this.chkDisplayWindowed.Size = new System.Drawing.Size(117, 19); - this.chkDisplayWindowed.TabIndex = 0; - this.chkDisplayWindowed.Text = "Windowed Mode"; - this.chkDisplayWindowed.UseVisualStyleBackColor = true; - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel1.Controls.Add(this.groupDisplay); - this.panel1.Location = new System.Drawing.Point(14, 13); - this.panel1.Name = "panel1"; - this.panel1.Padding = new System.Windows.Forms.Padding(5); - this.panel1.Size = new System.Drawing.Size(284, 118); - this.panel1.TabIndex = 2; - // - // btnCancel - // - this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCancel.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCancel.Location = new System.Drawing.Point(260, 525); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 3; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // btnSave - // - this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnSave.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnSave.Location = new System.Drawing.Point(174, 525); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(75, 23); - this.btnSave.TabIndex = 4; - this.btnSave.Text = "Ok"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // panel2 - // - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel2.Controls.Add(this.groupMS); - this.panel2.Location = new System.Drawing.Point(13, 13); - this.panel2.Name = "panel2"; - this.panel2.Padding = new System.Windows.Forms.Padding(5); - this.panel2.Size = new System.Drawing.Size(286, 95); - this.panel2.TabIndex = 5; - // - // groupMS - // - this.groupMS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupMS.Controls.Add(this.label4); - this.groupMS.Controls.Add(this.txtMSPort); - this.groupMS.Controls.Add(this.label3); - this.groupMS.Controls.Add(this.txtMSAddress); - this.groupMS.Location = new System.Drawing.Point(9, 8); - this.groupMS.Name = "groupMS"; - this.groupMS.Size = new System.Drawing.Size(269, 79); - this.groupMS.TabIndex = 0; - this.groupMS.TabStop = false; - this.groupMS.Text = "Connection"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(41, 51); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(32, 15); - this.label4.TabIndex = 3; - this.label4.Text = "Port:"; - // - // txtMSPort - // - this.txtMSPort.Location = new System.Drawing.Point(79, 48); - this.txtMSPort.Name = "txtMSPort"; - this.txtMSPort.Size = new System.Drawing.Size(86, 21); - this.txtMSPort.TabIndex = 2; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(17, 23); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 15); - this.label3.TabIndex = 1; - this.label3.Text = "Address:"; - // - // txtMSAddress - // - this.txtMSAddress.Location = new System.Drawing.Point(79, 20); - this.txtMSAddress.Name = "txtMSAddress"; - this.txtMSAddress.Size = new System.Drawing.Size(184, 21); - this.txtMSAddress.TabIndex = 0; - // - // panel3 - // - this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.panel3.Controls.Add(this.panel7); - this.panel3.Controls.Add(this.panel4); - this.panel3.Controls.Add(this.panel1); - this.panel3.Location = new System.Drawing.Point(6, 6); - this.panel3.Name = "panel3"; - this.panel3.Padding = new System.Windows.Forms.Padding(10); - this.panel3.Size = new System.Drawing.Size(312, 467); - this.panel3.TabIndex = 6; - // - // panel7 - // - this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel7.Controls.Add(this.groupBox3); - this.panel7.Location = new System.Drawing.Point(15, 350); - this.panel7.Name = "panel7"; - this.panel7.Padding = new System.Windows.Forms.Padding(5); - this.panel7.Size = new System.Drawing.Size(283, 106); - this.panel7.TabIndex = 7; - // - // groupBox3 - // - this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox3.Controls.Add(this.chkCloseOnStart); - this.groupBox3.Controls.Add(this.txtParams); - this.groupBox3.Controls.Add(this.label9); - this.groupBox3.Location = new System.Drawing.Point(13, 8); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(258, 83); - this.groupBox3.TabIndex = 12; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Command Line"; - // - // txtParams - // - this.txtParams.Location = new System.Drawing.Point(83, 20); - this.txtParams.Name = "txtParams"; - this.txtParams.Size = new System.Drawing.Size(167, 21); - this.txtParams.TabIndex = 6; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(5, 23); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(75, 15); - this.label9.TabIndex = 7; - this.label9.Text = "Parameters:"; - // - // panel4 - // - this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel4.Controls.Add(this.groupBox1); - this.panel4.Location = new System.Drawing.Point(15, 137); - this.panel4.Name = "panel4"; - this.panel4.Padding = new System.Windows.Forms.Padding(5); - this.panel4.Size = new System.Drawing.Size(284, 207); - this.panel4.TabIndex = 6; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.listviewBinaries); - this.groupBox1.Controls.Add(this.textboxBinary); - this.groupBox1.Controls.Add(this.btnAdd); - this.groupBox1.Controls.Add(this.btnDel); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.btnBrowse); - this.groupBox1.Controls.Add(this.textboxVersion); - this.groupBox1.Location = new System.Drawing.Point(13, 8); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(259, 191); - this.groupBox1.TabIndex = 12; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Executables"; - // - // listviewBinaries - // - this.listviewBinaries.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listviewBinaries.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.colhdrVersion, - this.colhdrBinary}); - this.listviewBinaries.FullRowSelect = true; - this.listviewBinaries.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listviewBinaries.HideSelection = false; - this.listviewBinaries.Location = new System.Drawing.Point(6, 19); - this.listviewBinaries.Name = "listviewBinaries"; - this.listviewBinaries.Size = new System.Drawing.Size(245, 83); - this.listviewBinaries.TabIndex = 0; - this.listviewBinaries.UseCompatibleStateImageBehavior = false; - this.listviewBinaries.View = System.Windows.Forms.View.Details; - this.listviewBinaries.SelectedIndexChanged += new System.EventHandler(this.listviewBinaries_SelectedIndexChanged); - // - // colhdrVersion - // - this.colhdrVersion.Text = "Version"; - // - // colhdrBinary - // - this.colhdrBinary.Text = "Binary"; - this.colhdrBinary.Width = 198; - // - // textboxBinary - // - this.textboxBinary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textboxBinary.Enabled = false; - this.textboxBinary.Location = new System.Drawing.Point(84, 161); - this.textboxBinary.Name = "textboxBinary"; - this.textboxBinary.Size = new System.Drawing.Size(93, 21); - this.textboxBinary.TabIndex = 4; - this.textboxBinary.TextChanged += new System.EventHandler(this.textboxBinary_TextChanged); - // - // btnAdd - // - this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnAdd.Location = new System.Drawing.Point(51, 104); - this.btnAdd.Name = "btnAdd"; - this.btnAdd.Size = new System.Drawing.Size(98, 25); - this.btnAdd.TabIndex = 1; - this.btnAdd.Text = "&Add"; - this.btnAdd.UseVisualStyleBackColor = true; - this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); - // - // btnDel - // - this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnDel.Enabled = false; - this.btnDel.Location = new System.Drawing.Point(155, 104); - this.btnDel.Name = "btnDel"; - this.btnDel.Size = new System.Drawing.Size(98, 25); - this.btnDel.TabIndex = 2; - this.btnDel.Text = "&Delete"; - this.btnDel.UseVisualStyleBackColor = true; - this.btnDel.Click += new System.EventHandler(this.btnDel_Click); - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 138); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(51, 15); - this.label5.TabIndex = 2; - this.label5.Text = "Version:"; - // - // label7 - // - this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 164); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(44, 15); - this.label7.TabIndex = 3; - this.label7.Text = "Binary:"; - // - // btnBrowse - // - this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnBrowse.Enabled = false; - this.btnBrowse.Location = new System.Drawing.Point(183, 161); - this.btnBrowse.Name = "btnBrowse"; - this.btnBrowse.Size = new System.Drawing.Size(68, 21); - this.btnBrowse.TabIndex = 5; - this.btnBrowse.Text = "&Browse..."; - this.btnBrowse.UseVisualStyleBackColor = true; - this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); - // - // textboxVersion - // - this.textboxVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textboxVersion.Enabled = false; - this.textboxVersion.Location = new System.Drawing.Point(84, 135); - this.textboxVersion.Name = "textboxVersion"; - this.textboxVersion.Size = new System.Drawing.Size(167, 21); - this.textboxVersion.TabIndex = 3; - this.textboxVersion.TextChanged += new System.EventHandler(this.textboxVersion_TextChanged); - // - // openFileDialog1 - // - this.openFileDialog1.DefaultExt = "exe"; - this.openFileDialog1.Filter = "Executable files|*.exe|All files|*.*"; - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(12, 12); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(332, 507); - this.tabControl1.TabIndex = 7; - // - // tabPage1 - // - this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage1.Controls.Add(this.panel3); - this.tabPage1.Location = new System.Drawing.Point(4, 24); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(324, 479); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "SRB2"; - // - // tabPage2 - // - this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage2.Controls.Add(this.panel5); - this.tabPage2.Location = new System.Drawing.Point(4, 24); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(324, 479); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Master Server"; - // - // panel5 - // - this.panel5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.panel5.Controls.Add(this.panel6); - this.panel5.Controls.Add(this.panel2); - this.panel5.Location = new System.Drawing.Point(6, 6); - this.panel5.Name = "panel5"; - this.panel5.Padding = new System.Windows.Forms.Padding(10); - this.panel5.Size = new System.Drawing.Size(312, 507); - this.panel5.TabIndex = 7; - // - // panel6 - // - this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel6.Controls.Add(this.groupBox2); - this.panel6.Location = new System.Drawing.Point(13, 114); - this.panel6.Name = "panel6"; - this.panel6.Padding = new System.Windows.Forms.Padding(5); - this.panel6.Size = new System.Drawing.Size(286, 61); - this.panel6.TabIndex = 6; - // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.chkShowDefaultWads); - this.groupBox2.Location = new System.Drawing.Point(9, 8); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(269, 45); - this.groupBox2.TabIndex = 0; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "List Settings"; - // - // chkShowDefaultWads - // - this.chkShowDefaultWads.AutoSize = true; - this.chkShowDefaultWads.Location = new System.Drawing.Point(6, 20); - this.chkShowDefaultWads.Name = "chkShowDefaultWads"; - this.chkShowDefaultWads.Size = new System.Drawing.Size(201, 19); - this.chkShowDefaultWads.TabIndex = 8; - this.chkShowDefaultWads.Text = "Show default files in list of wads"; - this.chkShowDefaultWads.UseVisualStyleBackColor = true; - // - // chkCloseOnStart - // - this.chkCloseOnStart.AutoSize = true; - this.chkCloseOnStart.Location = new System.Drawing.Point(9, 47); - this.chkCloseOnStart.Name = "chkCloseOnStart"; - this.chkCloseOnStart.Size = new System.Drawing.Size(216, 19); - this.chkCloseOnStart.TabIndex = 9; - this.chkCloseOnStart.Text = "Close Launcher when SRB2 starts"; - this.chkCloseOnStart.UseVisualStyleBackColor = true; - // - // Options - // - this.AcceptButton = this.btnSave; - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.ClientSize = new System.Drawing.Size(356, 560); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this.btnSave); - this.Controls.Add(this.btnCancel); - this.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "Options"; - this.Text = "Options"; - this.groupDisplay.ResumeLayout(false); - this.groupDisplay.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.groupMS.ResumeLayout(false); - this.groupMS.PerformLayout(); - this.panel3.ResumeLayout(false); - this.panel7.ResumeLayout(false); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.panel4.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - this.panel5.ResumeLayout(false); - this.panel6.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupDisplay; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.CheckBox chkDisplayWindowed; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtWidth; - private System.Windows.Forms.CheckBox chkCustomResolution; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox txtHeight; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.Button btnSave; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.GroupBox groupMS; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtMSAddress; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtMSPort; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.OpenFileDialog openFileDialog1; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.ListView listviewBinaries; - private System.Windows.Forms.ColumnHeader colhdrVersion; - private System.Windows.Forms.ColumnHeader colhdrBinary; - private System.Windows.Forms.TextBox textboxBinary; - private System.Windows.Forms.Button btnAdd; - private System.Windows.Forms.Button btnDel; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Button btnBrowse; - private System.Windows.Forms.TextBox textboxVersion; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Panel panel5; - private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox chkShowDefaultWads; - private System.Windows.Forms.Panel panel7; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.TextBox txtParams; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.CheckBox chkCloseOnStart; - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/Options.cs b/tools/SRB2Updater/Options.cs deleted file mode 100644 index a45cb13af..000000000 --- a/tools/SRB2Updater/Options.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.IO; - -namespace SRB2Updater -{ - public partial class Options : Form - { - private Settings settings; - public Options(Settings settings) - { - InitializeComponent(); - this.settings = settings; - SetOptions(); - } - - private void SetOptions() - { - chkDisplayWindowed.Checked = settings.displayWindowed; - chkCustomResolution.Checked = settings.displayCustom; - txtHeight.Text = settings.displayHeight.ToString(); - txtWidth.Text = settings.displayWidth.ToString(); - txtMSPort.Text = settings.msPort.ToString(); - settings.AddBinariesToListView(listviewBinaries); - txtMSAddress.Text = settings.msAddress.ToString(); - txtParams.Text = settings.Params.ToString(); - chkCloseOnStart.Checked = settings.CloseOnStart; - chkShowDefaultWads.Checked = settings.ShowDefaultWads; - if (settings.displayCustom) - { - txtHeight.Enabled = true; - txtWidth.Enabled = true; - } - else - { - txtHeight.Enabled = false; - txtWidth.Enabled = false; - } - } - - private void chkCustomResolution_CheckedChanged(object sender, EventArgs e) - { - if (chkCustomResolution.Checked) - { - txtHeight.Enabled = true; - txtWidth.Enabled = true; - } - else - { - txtHeight.Enabled = false; - txtWidth.Enabled = false; - } - } - - private void btnSave_Click(object sender, EventArgs e) - { - settings.displayCustom = chkCustomResolution.Checked; - settings.displayHeight = Convert.ToInt32(txtHeight.Text); - settings.displayWidth = Convert.ToInt32(txtWidth.Text); - settings.displayWindowed = chkDisplayWindowed.Checked; - settings.msAddress = txtMSAddress.Text; - settings.ShowDefaultWads = chkShowDefaultWads.Checked; - settings.Params = txtParams.Text; - settings.msPort = Convert.ToInt32(txtMSPort.Text); - settings.CloseOnStart = chkCloseOnStart.Checked; - settings.SaveSettings(); - settings.SetBinariesFromListView(listviewBinaries); - Close(); - } - - private void btnCancel_Click(object sender, EventArgs e) - { - Close(); - } - - private void btnAdd_Click(object sender, EventArgs e) - { - listviewBinaries.Items.Add(new ListViewItem(new string[] { "[New Version]", "" })); - } - - private void btnDel_Click(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - listviewBinaries.Items.Remove(listviewBinaries.SelectedItems[0]); - } - - private void btnBrowse_Click(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0 && - openFileDialog1.ShowDialog() == DialogResult.OK) - textboxBinary.Text = openFileDialog1.FileName; - } - - private void textboxVersion_TextChanged(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - listviewBinaries.SelectedItems[0].Text = textboxVersion.Text; - } - - private void textboxBinary_TextChanged(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - listviewBinaries.SelectedItems[0].SubItems[1].Text = textboxBinary.Text; - } - - private void listviewBinaries_SelectedIndexChanged(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - { - btnDel.Enabled = true; - btnBrowse.Enabled = true; - textboxVersion.Text = listviewBinaries.SelectedItems[0].Text; - textboxBinary.Text = listviewBinaries.SelectedItems[0].SubItems[1].Text; - textboxVersion.Enabled = true; - textboxBinary.Enabled = true; - } - else - { - btnDel.Enabled = false; - btnBrowse.Enabled = false; - textboxVersion.Text = ""; - textboxBinary.Text = ""; - textboxVersion.Enabled = false; - textboxBinary.Enabled = false; - } - } - } -} diff --git a/tools/SRB2Updater/Options.resx b/tools/SRB2Updater/Options.resx deleted file mode 100644 index ee0d50c3f..000000000 --- a/tools/SRB2Updater/Options.resx +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - - - AAABAAEAICAAAAEACACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAADg4OAIAAAABQABkAlgAAALkAAABQGQAAcwAlAJYAMQBzJQAAuQA9AJYxAACWAGIAMjIyALk9 - AAD/JSUAPj4+AFZWVgD/SEgAYmJiAABilgBubm4Aenp6AP9rawCAgIAAhoaGAJKSkgD/jo4Anp6eAKSg - oAD/jqsAqqqqAGuP/wC2trYAwMDAAI6r/wDCwsIAa8b/AM7OzgCO1P8A2traAObm5gDy8vIA////AAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAGgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQ8PHQAAAAAAAAAAAAAAACMgJSUlJSUZ - AAAAABMNBgoPDw8AAAAAAAAAAAAAACInJycnJycnJyclFgYGBggPDw8PDwAAAAAAAAAAAAAjJycnJycn - JycnGScnFQkGCA8PDw8AAAAAAAAAAAAAISMnJycjIyMjJycnJycVDwYGDw8PDwAAAAAAAAAAAAAQAAEj - HygqKSkkHyMnJwoPDwYJDw8PAAAAAAAAAAAAACkTHxwrKysrKysrGhkMDw8PCwYJDw8AAAAAAAAAACkp - JA0pACkrKysrKyspDw8PDw8PAwYIAAAAAAAAAAAAACsiARwAISsrKysrKysSDw8PDw8PAwYAAAAAAAAA - AAAAKyIAEAAfKysrKysrKxcPDw8PDw8PDwgIABYAABcSCAArKAMPACIrKysrKysrGw8PDw8PDw8PDw8P - Dw8PDw8RACsoBA8EISsrKysrKyseDw8PDw8PDw8PDw8PDw8PDwAAKx8PDw8VKSsrKysrKxcPDw8PDw8P - Dw8PDw8PDw8AACooFQ8PDw8aKCsrKysmDw8PDw8PDw8PDw8PDw8PFQAAAAAKDw8PDw8VIigoIgoPDw8P - Dw8PDw8PDw8PDxEAAAAAAAoPDw8PDw8XFxcXEhIPDwUPDw8PDw8PDw8YAAAAAAAACA8PDw8SFxcXFxcX - FxcPFQ8PDw8PDw8KAAAAAAAAAAAACg8PEhcXFxcXFxcXFxkjBRISEhISGAAAAAAAAAAAIRcXCA8XFxcX - FxcXFxcaJyMFDwoLEQAAAAAAAAAAAAAAFxcSDxIXFxcXFxcSEyAlIwILCwsIAAAAAAAAAAAAABcXEg8A - EhIXFxcXEgoPDBUUBwsLCwsLAAAAAAAAAAAAFxcAAAAAFxIXFxcXFxIKDw8ICwsLDg4LAAAAAAAAAAAA - AAAAAAAAABISFxcXFw8PDw8PDw8PDwAAAAAAAAAAAAAAAAAAAAAAAAASEhcSDw8PDw8PDxIAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAFwoSDw8SFwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///////////////////3////w//APAf/AAAH/gAAD/wAAA/8AAAP/AAAD/AAAB/4AA - Af+AAABYgAAAAIAAAAGAAAADAAAAA8AAAAfAAAAPwAAAP+AAAH+AAAH/wAAB/4QAAP+eAAB//4AA///g - Af//+A////////////////// - - - \ No newline at end of file diff --git a/tools/SRB2Updater/Program.cs b/tools/SRB2Updater/Program.cs deleted file mode 100644 index 51c0be56e..000000000 --- a/tools/SRB2Updater/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace SRB2Updater -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Launcher(args)); - } - } -} diff --git a/tools/SRB2Updater/Properties/AssemblyInfo.cs b/tools/SRB2Updater/Properties/AssemblyInfo.cs deleted file mode 100644 index abc46e8cd..000000000 --- a/tools/SRB2Updater/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SRB2 Automatic Updater")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Sonic Team Junior")] -[assembly: AssemblyProduct("Sonic Robo Blast 2")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("94c164ce-02a9-4966-948f-004d35760ba1")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/tools/SRB2Updater/Properties/Resources.Designer.cs b/tools/SRB2Updater/Properties/Resources.Designer.cs deleted file mode 100644 index 246c91e52..000000000 --- a/tools/SRB2Updater/Properties/Resources.Designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.4927 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SRB2Updater.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SRB2Updater.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - internal static System.Drawing.Bitmap Banner { - get { - object obj = ResourceManager.GetObject("Banner", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap Banner2 { - get { - object obj = ResourceManager.GetObject("Banner2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap Banner3 { - get { - object obj = ResourceManager.GetObject("Banner3", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap Banner4 { - get { - object obj = ResourceManager.GetObject("Banner4", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap CONSBACK { - get { - object obj = ResourceManager.GetObject("CONSBACK", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.IO.UnmanagedMemoryStream Kotaku { - get { - return ResourceManager.GetStream("Kotaku", resourceCulture); - } - } - - internal static System.Drawing.Bitmap Sonic { - get { - object obj = ResourceManager.GetObject("Sonic", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap sonic_bottom { - get { - object obj = ResourceManager.GetObject("sonic_bottom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap sonic_top { - get { - object obj = ResourceManager.GetObject("sonic_top", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap updaterbanner { - get { - object obj = ResourceManager.GetObject("updaterbanner", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/tools/SRB2Updater/Properties/Resources.resx b/tools/SRB2Updater/Properties/Resources.resx deleted file mode 100644 index b5c93d021..000000000 --- a/tools/SRB2Updater/Properties/Resources.resx +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\CONSBACK.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Sonic.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\sonic_bottom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\sonic_top.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\updaterbanner.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Kotaku.wav;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/tools/SRB2Updater/Properties/Settings.Designer.cs b/tools/SRB2Updater/Properties/Settings.Designer.cs deleted file mode 100644 index 4e8aea28c..000000000 --- a/tools/SRB2Updater/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3506 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SRB2Updater.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/tools/SRB2Updater/Properties/Settings.settings b/tools/SRB2Updater/Properties/Settings.settings deleted file mode 100644 index abf36c5d3..000000000 --- a/tools/SRB2Updater/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tools/SRB2Updater/Resources/Banner.png b/tools/SRB2Updater/Resources/Banner.png deleted file mode 100644 index 7d8d55602..000000000 Binary files a/tools/SRB2Updater/Resources/Banner.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner.psd b/tools/SRB2Updater/Resources/Banner.psd deleted file mode 100644 index eb29b8b6f..000000000 Binary files a/tools/SRB2Updater/Resources/Banner.psd and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner2.png b/tools/SRB2Updater/Resources/Banner2.png deleted file mode 100644 index f3d3d3e6d..000000000 Binary files a/tools/SRB2Updater/Resources/Banner2.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner3.png b/tools/SRB2Updater/Resources/Banner3.png deleted file mode 100644 index 04713070a..000000000 Binary files a/tools/SRB2Updater/Resources/Banner3.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner4.png b/tools/SRB2Updater/Resources/Banner4.png deleted file mode 100644 index 8b2627b8d..000000000 Binary files a/tools/SRB2Updater/Resources/Banner4.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/CONSBACK.bmp b/tools/SRB2Updater/Resources/CONSBACK.bmp deleted file mode 100644 index 3c1298f08..000000000 Binary files a/tools/SRB2Updater/Resources/CONSBACK.bmp and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Kotaku.wav b/tools/SRB2Updater/Resources/Kotaku.wav deleted file mode 100644 index 49e7f613a..000000000 Binary files a/tools/SRB2Updater/Resources/Kotaku.wav and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Sonic.png b/tools/SRB2Updater/Resources/Sonic.png deleted file mode 100644 index a19cf225d..000000000 Binary files a/tools/SRB2Updater/Resources/Sonic.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Srb2win.ico b/tools/SRB2Updater/Resources/Srb2win.ico deleted file mode 100644 index 0036a827a..000000000 Binary files a/tools/SRB2Updater/Resources/Srb2win.ico and /dev/null differ diff --git a/tools/SRB2Updater/Resources/sonic_bottom.png b/tools/SRB2Updater/Resources/sonic_bottom.png deleted file mode 100644 index 42c17c785..000000000 Binary files a/tools/SRB2Updater/Resources/sonic_bottom.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/sonic_top.png b/tools/SRB2Updater/Resources/sonic_top.png deleted file mode 100644 index 66d6fccaa..000000000 Binary files a/tools/SRB2Updater/Resources/sonic_top.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/updaterbanner.png b/tools/SRB2Updater/Resources/updaterbanner.png deleted file mode 100644 index 9a2f6fa38..000000000 Binary files a/tools/SRB2Updater/Resources/updaterbanner.png and /dev/null differ diff --git a/tools/SRB2Updater/SRB2Updater.csproj b/tools/SRB2Updater/SRB2Updater.csproj deleted file mode 100644 index 6e8647312..000000000 --- a/tools/SRB2Updater/SRB2Updater.csproj +++ /dev/null @@ -1,173 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {2E2F67C6-8492-4034-A142-50872504D86D} - WinExe - Properties - SRB2Updater - srb2update - - - - - 2.0 - v2.0 - - - false - Srb2win.ico - SRB2Updater.Program - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - Form - - - Debug.cs - - - Form - - - Launcher.cs - - - - Form - - - Options.cs - - - - - Debug.cs - Designer - - - Launcher.cs - Designer - - - Options.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - False - .NET Framework Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/SRB2Updater/SRB2Updater.sln b/tools/SRB2Updater/SRB2Updater.sln deleted file mode 100644 index f4e88dc64..000000000 --- a/tools/SRB2Updater/SRB2Updater.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SRB2Updater", "SRB2Updater.csproj", "{2E2F67C6-8492-4034-A142-50872504D86D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2E2F67C6-8492-4034-A142-50872504D86D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E2F67C6-8492-4034-A142-50872504D86D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E2F67C6-8492-4034-A142-50872504D86D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E2F67C6-8492-4034-A142-50872504D86D}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/SRB2Updater/ServerQuerier.cs b/tools/SRB2Updater/ServerQuerier.cs deleted file mode 100644 index 51b6940f6..000000000 --- a/tools/SRB2Updater/ServerQuerier.cs +++ /dev/null @@ -1,362 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.Net.Sockets; -using System.IO; - -namespace SRB2Updater -{ - class ServerQuerier - { - private UdpClient udpclient; - private IPEndPoint ipepMS; - - private const int MS_HOLEPUNCH_SIZE = 0; - private const int PT_ASKINFO_SIZE = 16; - private const byte PT_ASKINFO = 12; - private const byte PT_SERVERINFO = 13; - private const int MAXSERVERNAME = 32; - private const int MAX_WADPATH = 128; - - /// - /// Constructs a ServerQuerier object. - /// - public ServerQuerier() - { - udpclient = new UdpClient(0, AddressFamily.InterNetwork); - - // Fix for WSAECONNRESET. Only affects Win2k and up. If I send a - // packet to a host which replies with an ICMP Port Unreachable, - // subsequent socket operations go doo-lally. So, we enable the - // older behaviour of ignoring these ICMP messages, since we don't - // care about them anyway. - if (Environment.OSVersion.Platform == PlatformID.Win32NT && - Environment.OSVersion.Version.Major >= 5) - { - const uint IOC_IN = 0x80000000; - const uint IOC_VENDOR = 0x18000000; - const uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12; - - udpclient.Client.IOControl(unchecked((int)SIO_UDP_CONNRESET), new byte[] { Convert.ToByte(false) }, null); - } - } - - public void StartListening(ServerInfoReceiveHandler sirh) - { - // Start listening. - udpclient.BeginReceive(new AsyncCallback(ServerInfoReceiveHandler.Receive), sirh); - } - - - /// - /// Sets the master server address. Necessary before querying via the MS. - /// - /// IP address of hostname of MS. - /// Port of MS. - public void SetMasterServer(string strAddress, ushort unPort) - { - IPAddress address = Dns.GetHostEntry(strAddress).AddressList[0]; - ipepMS = new IPEndPoint(address, unPort); - } - - public void Query(string strAddress, ushort unPort) - { - // Build the packet. - byte[] byPacket = new byte[PT_ASKINFO_SIZE]; - BinaryWriter bw = new BinaryWriter(new MemoryStream(byPacket)); - - bw.Seek(4, SeekOrigin.Begin); // Skip the checksum. - bw.Write((byte)0); // ack - bw.Write((byte)0); // ackreturn - bw.Write((byte)PT_ASKINFO); // Packet type. - bw.Write((byte)0); // Reserved. - bw.Write((byte)0); // Version. This is actually unnecessary -- the client will reply anyway. -MattW_CFI - bw.Write((byte)0); // Reserved. - bw.Write((byte)0); // Reserved. - bw.Write((byte)0); // Reserved. - // Time for ping calculation. - bw.Write(unchecked((uint)(DateTime.Now.Ticks / 10000))); - - // Calculate the checksum. - bw.Seek(0, SeekOrigin.Begin); - bw.Write(SRB2Checksum(byPacket)); - - // Send the packet. - udpclient.Send(byPacket, byPacket.Length, strAddress, unPort); - } - - /// - /// Calculates the checksum of an SRB2 packet. - /// - /// Packet. - /// Checksum. - private static uint SRB2Checksum(byte[] byPacket) - { - uint c = 0x1234567; - int i; - - for (i = 4; i < byPacket.Length; i++) - unchecked - { - c += (uint)byPacket[i] * (uint)(i - 3); - } - - return c; - } - - private static string ReadFixedLengthStr(BinaryReader br, int iLen) - { - String str = Encoding.ASCII.GetString(br.ReadBytes(iLen)); - int iPos = str.IndexOf("\0"); - if (iPos >= 0) - str = str.Remove(iPos); - - return str; - } - - public abstract class ServerInfoReceiveHandler - { - UdpClient udpclient; - IPEndPoint ipepRemote; - - /// - /// Called after a server info packet is received. - /// - /// Server info. - public abstract void ProcessServerInfo(SRB2ServerInfo srb2si); - public abstract void HandleException(Exception e); - - public ServerInfoReceiveHandler(ServerQuerier sq) - { - ipepRemote = new IPEndPoint(IPAddress.Any, 0); - - udpclient = sq.udpclient; - } - - public static void Receive(IAsyncResult ar) - { - ServerInfoReceiveHandler sirh = (ServerInfoReceiveHandler)ar.AsyncState; - - byte[] byPacket = sirh.udpclient.EndReceive(ar, ref sirh.ipepRemote); - - // Analyse the packet. - BinaryReader br = new BinaryReader(new MemoryStream(byPacket)); - - // Get the checksum. - uint uiChecksum = br.ReadUInt32(); - - // Skip ack and ackreturn and get packet type. - br.ReadBytes(2); - byte byPacketType = br.ReadByte(); - - // Only interested in valid PT_SERVERINFO packets. - if (byPacketType == PT_SERVERINFO && uiChecksum == SRB2Checksum(byPacket)) - { - bool bMalformed = true; - - // Skip padding. - br.ReadByte(); - - // Remember where we are. - long iPacketStart = br.BaseStream.Position; - - // Try to interpret the packet in each recognised format. - foreach (ServerInfoVer siv in Enum.GetValues(typeof(ServerInfoVer))) - { - SRB2ServerInfo srb2si; - byte byNumWads = 0; - - srb2si.siv = siv; - - br.BaseStream.Position = iPacketStart; - - // Get address from socket. - srb2si.strAddress = sirh.ipepRemote.Address.ToString(); - srb2si.unPort = unchecked((ushort)sirh.ipepRemote.Port); - - // Get version. - byte byVersion = br.ReadByte(); - - if (siv == ServerInfoVer.SIV_PREME) - { - br.ReadBytes(3); - - uint uiSubVersion = br.ReadUInt32(); - - // Format version. - // MattW_CFI: I hope you don't mind this exception, Oogaland, but 0.01.6 looks odd >_> - if (byVersion == 1 && uiSubVersion == 6) - srb2si.strVersion = "X.01.6"; - else - srb2si.strVersion = byVersion.ToString(); - //srb2si.strVersion = String.Format("{0}.{1:00}.{2}", byVersion / 100, byVersion % 100, uiSubVersion); - } - else - { - byte bySubVersion = br.ReadByte(); - - // Format version. - //srb2si.strVersion = String.Format("{0}.{1:00}.{2}", byVersion / 100, byVersion % 100, bySubVersion); - srb2si.strVersion = byVersion.ToString(); - } - - srb2si.byPlayers = br.ReadByte(); - srb2si.byMaxplayers = br.ReadByte(); - srb2si.byGametype = br.ReadByte(); - srb2si.bModified = (br.ReadByte() != 0); - - if (siv == ServerInfoVer.SIV_ME) - byNumWads = br.ReadByte(); - - srb2si.sbyAdminplayer = br.ReadSByte(); - - if (siv == ServerInfoVer.SIV_PREME) - br.ReadBytes(3); - - // Calculate ping. - srb2si.uiTime = unchecked((uint)((long)(DateTime.Now.Ticks / 10000 - br.ReadUInt32()) % ((long)UInt32.MaxValue + 1))); - - if (siv == ServerInfoVer.SIV_PREME) - br.ReadUInt32(); - - // Get and tidy map name. - if (siv == ServerInfoVer.SIV_PREME) - { - srb2si.strMapName = ReadFixedLengthStr(br, 8); - srb2si.strName = ReadFixedLengthStr(br, MAXSERVERNAME); - } - else - { - srb2si.strName = ReadFixedLengthStr(br, MAXSERVERNAME); - srb2si.strMapName = ReadFixedLengthStr(br, 8); - } - - if (siv == ServerInfoVer.SIV_PREME) - byNumWads = br.ReadByte(); - - // Create new list of strings of initial size equal to number of wads. - srb2si.listFiles = new List(byNumWads); - - // Get the files info. - byte[] byFiles = br.ReadBytes(siv == ServerInfoVer.SIV_PREME ? 4096 : 936); - BinaryReader brFiles = new BinaryReader(new MemoryStream(byFiles)); - - // Extract the filenames. - try - { - for (int i = 0; i < byNumWads; i++) - { - bool bFullString = false; - AddedWad aw = new AddedWad(); - - if (siv == ServerInfoVer.SIV_PREME) - { - aw.bImportant = brFiles.ReadByte() != 0; - aw.downloadtype = (DownloadTypes)brFiles.ReadByte(); - } - else - { - byte byFileStatus = brFiles.ReadByte(); - aw.bImportant = (byFileStatus & 0xF) != 0; - aw.downloadtype = (DownloadTypes)(byFileStatus >> 4); - } - - aw.uiSize = brFiles.ReadUInt32(); - - // Work out how long the string is. - int iStringPos = (int)brFiles.BaseStream.Position; - while (iStringPos < byFiles.Length && byFiles[iStringPos] != 0) iStringPos++; - - // Make sure it's not longer than the max name length. - if (iStringPos - (int)brFiles.BaseStream.Position > MAX_WADPATH) - { - bFullString = true; - iStringPos = MAX_WADPATH + (int)brFiles.BaseStream.Position; - } - - // Get the info and add it, if possible. - if (iStringPos > (int)brFiles.BaseStream.Position) - { - aw.strFilename = Encoding.ASCII.GetString(brFiles.ReadBytes(iStringPos - (int)brFiles.BaseStream.Position)); - srb2si.listFiles.Add(aw); - } - - // Skip nul. - if (!bFullString) brFiles.ReadByte(); - - // Skip the md5sum. - brFiles.ReadBytes(16); - } - - // Okay, done! Do something useful with the server info. - sirh.ProcessServerInfo(srb2si); - - // If we got this far without an exception, leave the foreach loop. - bMalformed = false; - break; - } - catch (EndOfStreamException) - { - // Packet doesn't match supposed type, so we swallow the exception - // and try remaining types. - } - catch (Exception e) - { - sirh.HandleException(e); - break; - } - } - - if (bMalformed) - sirh.HandleException(new Exception("Received invalid PT_SERVERINFO packet from " + sirh.ipepRemote.Address + ":" + sirh.ipepRemote.Port + ".")); - } - - // Resume listening. - sirh.ipepRemote = new IPEndPoint(IPAddress.Any, 0); - sirh.udpclient.BeginReceive(new AsyncCallback(Receive), sirh); - } - } - - public enum DownloadTypes - { - DT_TOOBIG = 0, - DT_OK = 1, - DT_DISABLED = 2 - } - - public struct AddedWad - { - public string strFilename; - public bool bImportant; - public uint uiSize; - public DownloadTypes downloadtype; - } - - public enum ServerInfoVer - { - SIV_PREME, - SIV_ME - }; - - public struct SRB2ServerInfo - { - public string strAddress; - public ushort unPort; - - public ServerInfoVer siv; - - public string strVersion; - public byte byPlayers; - public byte byMaxplayers; - public byte byGametype; - public bool bModified; - public sbyte sbyAdminplayer; - public uint uiTime; - public string strMapName; - public string strName; - - public List listFiles; - } - } -} diff --git a/tools/SRB2Updater/Settings.cs b/tools/SRB2Updater/Settings.cs deleted file mode 100644 index d72aeee51..000000000 --- a/tools/SRB2Updater/Settings.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections; -using System.Text; -using System.Data; -using Microsoft.Win32; -using System.Windows.Forms; -using System.IO; - -namespace SRB2Updater -{ - public class Settings - { - // Global Settings - public bool boolDisplayWindowed; - public bool boolDisplayCustomResolution; - public bool boolCloseOnStart; - public int intDisplayWidth; - public int intDisplayHeight; - public string strMSAddress; - public int intMSPort; - public Array arrWadList; - public string strParams; - - public string Params - { - get { return strParams; } - set { strParams = value; } - } - - public Array wadList - { - get { return arrWadList; } - set { arrWadList = value; } - } - - public bool CloseOnStart - { - get { return boolCloseOnStart; } - set { boolCloseOnStart = value; } - } - - public string msAddress - { - get { return strMSAddress; } - set { strMSAddress = value; } - } - - public int msPort - { - get { return intMSPort; } - set { intMSPort = value; } - } - - public bool displayWindowed - { - get { return boolDisplayWindowed; } - set { boolDisplayWindowed = value; } - } - - public bool displayCustom - { - get { return boolDisplayCustomResolution; } - set { boolDisplayCustomResolution = value; } - } - - public int displayWidth - { - get { return intDisplayWidth; } - set { intDisplayWidth = value; } - } - - public int displayHeight - { - get { return intDisplayHeight; } - set { intDisplayHeight = value; } - } - - bool boolShowDefaultWads; - public bool ShowDefaultWads - { - get { return boolShowDefaultWads; } - set { boolShowDefaultWads = value; } - } - - public void GetSettings() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher"); - RegistryKey rkDisplay = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher\Display"); - RegistryKey rkMS = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher\MasterServer"); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - rkBinaries.SetValue("2.0.4", Directory.GetCurrentDirectory() + "\\srb2win.exe"); - - try { boolDisplayCustomResolution = Convert.ToInt32(rkDisplay.GetValue("CustomResolution", 0)) != 0; } - catch { boolDisplayCustomResolution = false; } - try { boolDisplayWindowed = Convert.ToInt32(rkDisplay.GetValue("Windowed", 0)) != 0; } - catch { boolDisplayWindowed = false; } - try { boolShowDefaultWads = Convert.ToInt32(rkDisplay.GetValue("ShowDefaultWads", 0)) != 0; } - catch { boolShowDefaultWads = false; } - try { boolCloseOnStart = Convert.ToInt32(rkDisplay.GetValue("CloseOnStart", 0)) != 0; } - catch { boolCloseOnStart = false; } - intDisplayHeight = Convert.ToInt32(rkDisplay.GetValue("Height", "480")); - intDisplayWidth = Convert.ToInt32(rkDisplay.GetValue("Width", "640")); - intMSPort = Convert.ToInt32(rkMS.GetValue("Port", "28900")); - strMSAddress = Convert.ToString(rkMS.GetValue("Address", "ms.srb2.org")); - strParams = Convert.ToString(rk.GetValue("Params")); - - dicBinaries.Clear(); - foreach (string strName in rkBinaries.GetValueNames()) - dicBinaries[strName] = (string)rkBinaries.GetValue(strName); - - - rk.Close(); - rkDisplay.Close(); - rkMS.Close(); - rkBinaries.Close(); - } - - public void SaveSettings() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher"); - RegistryKey rkDisplay = rk.CreateSubKey("Display"); - RegistryKey rkMS = rk.CreateSubKey("MasterServer"); - rkDisplay.SetValue("CustomResolution", boolDisplayCustomResolution); - rkDisplay.SetValue("Windowed", boolDisplayWindowed); - rkDisplay.SetValue("Height", intDisplayHeight); - rkDisplay.SetValue("Width", intDisplayWidth); - rkMS.SetValue("Port", intMSPort); - rkMS.SetValue("Address", strMSAddress); - rkMS.SetValue("ShowDefaultWads", boolShowDefaultWads); - rk.SetValue("Params", strParams); - rk.SetValue("CloseOnStart", boolCloseOnStart); - - rk.DeleteSubKey("Binaries", false); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - rkBinaries.SetValue("2.0.4", Directory.GetCurrentDirectory() + "\\srb2win.exe"); - foreach (string strName in dicBinaries.Keys) - rkBinaries.SetValue(strName, dicBinaries[strName]); - - rk.Close(); - } - -/* public void WriteToRegistry() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SRB2MSLauncher"); - - rk.SetValue("Params", strParams); - rk.SetValue("Masterserver", strMSAddress); - rk.SetValue("MSPort", unMSPort, RegistryValueKind.DWord); - rk.SetValue("ShowDefaultWads", Convert.ToInt32(bShowDefaultWads), RegistryValueKind.DWord); - - rk.DeleteSubKey("Binaries", false); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - foreach (string strName in dicBinaries.Keys) - rkBinaries.SetValue(strName, dicBinaries[strName]); - - rkBinaries.Close(); - rk.Close(); - } - - public void LoadFromRegistry() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SRB2MSLauncher"); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - - strParams = (string)rk.GetValue("Params", ""); - strMSAddress = (string)rk.GetValue("Masterserver", "ms.srb2.org"); - - try { unMSPort = Convert.ToUInt16(rk.GetValue("MSPort", MS_DEFAULT_PORT)); } - catch { unMSPort = MS_DEFAULT_PORT; } - - try { bShowDefaultWads = Convert.ToInt32(rk.GetValue("ShowDefaultWads", 0)) != 0; } - catch { bShowDefaultWads = true; } - - dicBinaries.Clear(); - foreach (string strName in rkBinaries.GetValueNames()) - dicBinaries[strName] = (string)rkBinaries.GetValue(strName); - - rkBinaries.Close(); - rk.Close(); - }*/ - - - public List VersionStrings - { - get { return new List(dicBinaries.Keys); } - } - - public bool HasBinaryForVersion(string strVersion) - { - return dicBinaries.ContainsKey(strVersion) && dicBinaries[strVersion] != ""; - } - - public void AddBinariesToListView(ListView lv) - { - foreach (string strName in dicBinaries.Keys) - lv.Items.Add(new ListViewItem(new string[] { strName, dicBinaries[strName] })); - } - - public void SetBinariesFromListView(ListView lv) - { - dicBinaries.Clear(); - foreach (ListViewItem lvi in lv.Items) - dicBinaries[lvi.Text] = lvi.SubItems[1].Text; - } - - Dictionary dicBinaries = new Dictionary(); - - public void SetBinary(string strVersion, string strBinary) - { - dicBinaries[strVersion] = strBinary; - } - - public string GetBinary(string strVersion) - { - return dicBinaries[strVersion]; - } - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/app.config b/tools/SRB2Updater/app.config deleted file mode 100644 index b7db28170..000000000 --- a/tools/SRB2Updater/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/tools/djgpp/all313.dif b/tools/djgpp/all313.dif deleted file mode 100644 index cdecf7d84..000000000 --- a/tools/djgpp/all313.dif +++ /dev/null @@ -1,812 +0,0 @@ -diff -ruN allegro.312/demo/alld/tmp.txt allegro.313/demo/alld/tmp.txt ---- allegro.312/demo/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/demo/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/demo/alleg/tmp.txt allegro.313/demo/alleg/tmp.txt ---- allegro.312/demo/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/demo/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/demo/allp/tmp.txt allegro.313/demo/allp/tmp.txt ---- allegro.312/demo/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/demo/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/examples/alld/tmp.txt allegro.313/examples/alld/tmp.txt ---- allegro.312/examples/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/examples/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/examples/alleg/tmp.txt allegro.313/examples/alleg/tmp.txt ---- allegro.312/examples/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/examples/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/examples/allp/tmp.txt allegro.313/examples/allp/tmp.txt ---- allegro.312/examples/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/examples/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/makefile allegro.313/makefile ---- allegro.312/makefile Sun Feb 21 00:31:48 1999 -+++ allegro.313/makefile Mon Jun 20 23:45:18 2005 -@@ -7,8 +7,10 @@ - # # - ################################################# - --# replace this definition if you are using PGCC --# PGCC=1 -+# remline this definition if need Allegro for 486 -+PGCC=1 -+ -+GCC=gcc-2 - - .PHONY: baddjgpp baddjdev badgcc badbnu badmake badtxi badpath badalleg - -@@ -22,23 +24,25 @@ - # check that the djdev package is installed - ifeq ($(wildcard $(DJDIR)/bin/djasm.exe),) - baddjdev: -- @echo Missing djgpp package! You need to install djdev201.zip (or whatever the -+ @echo Missing djgpp package! You need to install djdev203.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. - endif - - # check that the gcc package is installed --ifeq ($(wildcard $(DJDIR)/bin/gcc.exe),) -+ifeq ($(wildcard $(DJDIR)/bin/$(GCC).exe),) - badgcc: -- @echo Missing djgpp package! You need to install gcc2721b.zip (or whatever the -- @echo latest version is). Download this from wherever you got djgpp, and unzip -- @echo it into the root of your djgpp directory. -+ @echo Missing djgpp package! You need to install gcc2953b.zip. Download this -+ @echo from wherever you got djgpp, and unzip bin\gcc.exe , rename it as -+ @echo $(GCC).exe into the of your bin directory. - endif - -+GCC := @$(GCC) -+ - # check that the binutils package is installed - ifeq ($(wildcard $(DJDIR)/bin/ld.exe),) - badbnu: -- @echo Missing djgpp package! You need to install bnu27b.zip (or whatever the -+ @echo Missing djgpp package! You need to install bnu216b.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. - endif -@@ -46,7 +50,7 @@ - # check that the make package is installed - ifeq ($(wildcard $(DJDIR)/bin/make.exe),) - badmake: -- @echo Missing djgpp package! You need to install mak3761b.zip (or whatever the -+ @echo Missing djgpp package! You need to install mak3791b.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. - endif -@@ -54,7 +58,7 @@ - # check that the texinfo package is installed - ifeq ($(wildcard $(DJDIR)/bin/makeinfo.exe),) - badtxi: -- @echo Missing djgpp package! You need to install txi390b.zip (or whatever the -+ @echo Missing djgpp package! You need to install txi48b.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. If you do not need the Info - @echo documentation, run make all to ignore this error. -@@ -83,11 +87,32 @@ - endif - endif - -+# -------- check environment to see what type of library to build -------- -+ -+ifdef DEBUGMODE -+ -+# -------- build a debugging library -------- -+VERSION = alld -+ -+else -+ifdef PROFILEMODE -+ -+# -------- build a profiling library -------- -+VERSION = allp -+ -+else -+ -+# -------- build a release library -------- -+VERSION = alleg -+ -+endif -+endif -+ -+ - # set some useful paths --OBJ = obj/djgpp --DOBJ = obj\djgpp --LIB = lib/djgpp/liballeg.a --LIBDEST = $(DJDIR)/lib/liballeg.a -+LIB = lib$(VERSION).a -+OBJ = obj/djgpp/$(VERSION) -+LIBDEST = $(DJDIR)/lib/$(LIB) - INCDEST = $(DJDIR)/include/allegro.h - DOCDEST = $(DJDIR)/info/allegro.inf - INTERNAL_H = src/internal.h src/djgpp/interndj.h -@@ -113,19 +138,22 @@ - else - ifdef PROFILEMODE - # build with profiling information -+OFLAGS = -pg -O3 -ffast-math - ifdef PGCC --OFLAGS = -pg -mpentium -O6 -ffast-math -+OFLAGS := $(OFLAGS) -mcpu=pentium - else --OFLAGS = -pg -m486 -O3 -ffast-math -+OFLAGS := $(OFLAGS) -mcpu=i486 - endif - LFLAGS = -pg - -+ - else - # build a normal optimised version -+OFLAGS = -O3 -ffast-math -fomit-frame-pointer - ifdef PGCC --OFLAGS = -mpentium -O6 -ffast-math -fomit-frame-pointer -+OFLAGS := $(OFLAGS) -mcpu=pentium - else --OFLAGS = -m486 -O3 -ffast-math -fomit-frame-pointer -+OFLAGS := $(OFLAGS) -mcpu=i486 - endif - - ifdef SYMBOLMODE -@@ -179,9 +207,18 @@ - - .PHONY: all msg lib install uninstall docs clean veryclean mmxtest $(PROGRAMS) - --all: msg $(LIB) $(PROGRAMS) docs install -+all: msg lib/djgpp/$(LIB) $(PROGRAMS) docs - @echo All done. -- @echo To use Allegro, #include allegro.h and link with liballeg.a -+ifdef DEBUGMODE -+ @echo To install this version of Allegro, run make install DEBUGMODE=1 -+else -+ifdef PROFILEMODE -+ @echo To install this version of Allegro, run make install PROFILEMODE=1 -+else -+ @echo To install this version of Allegro, run make install -+endif -+endif -+ @echo To use Allegro, #include allegro.h and link with $(LIB) - @echo Example command line: gcc foobar.c -o foobar.exe -lalleg - @echo Run make compress to run DJP or UPX on the executable files - @echo Enjoy! -@@ -189,36 +226,36 @@ - msg: - @echo Compiling Allegro. Please wait... - --lib: $(LIB) -+lib: lib/djgpp/$(LIB) - - install: $(LIBDEST) $(INCDEST) $(DOCDEST) - - docs: $(DOCS) - --$(LIBDEST): $(LIB) -- copy lib\djgpp\liballeg.a $(subst /,\,$(LIBDEST)) -+$(LIBDEST): lib/djgpp/$(LIB) -+ cp lib/djgpp/$(LIB) $(LIBDEST) - - $(INCDEST): allegro.h -- copy allegro.h $(subst /,\,$(INCDEST)) -+ cp allegro.h $(INCDEST) - - $(DOCDEST): docs/allegro.inf - ifneq ($(wildcard $(DJDIR)/bin/makeinfo.exe),) -- copy docs\allegro.inf $(subst /,\,$(DOCDEST)) -+ cp docs\allegro.inf $(DOCDEST) - else - @echo makeinfo not installed: skipping copy of allegro.inf - endif - - $(OBJ)/%.o: %.c allegro.h -- gcc $(CFLAGS) -o $@ -c $< -+ $(GCC) $(CFLAGS) -o $@ -c $< - - $(OBJ)/%.o: %.S asmdefs.inc $(OBJ)/asmdef.inc -- gcc $(SFLAGS) -o $@ -c $< -+ $(GCC) $(SFLAGS) -o $@ -c $< - - $(OBJ)/%.o: %.s asmdefs.inc $(OBJ)/asmdef.inc -- gcc -x assembler-with-cpp $(SFLAGS) -o $@ -c $< -+ $(GCC) -x assembler-with-cpp $(SFLAGS) -o $@ -c $< - --*/%.exe: $(OBJ)/%.o $(LIB) -- gcc $(LFLAGS) -o $@ $< $(LIB) -+*/$(VERSION)/%.exe: $(OBJ)/%.o lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o $@ $< lib/djgpp/$(LIB) - - docs/%.inf: docs/%.txi - ifneq ($(wildcard $(DJDIR)/bin/makeinfo.exe),) -@@ -252,38 +289,38 @@ - $(OBJ)/makedoc.exe -part -ascii THANKS docs/thanks._tx - - $(OBJ)/makedoc.exe: docs/makedoc.c -- gcc $(CFLAGS) $(LFLAGS) -o $@ docs/makedoc.c -+ $(GCC) $(CFLAGS) $(LFLAGS) -o $@ docs/makedoc.c - - $(OBJ)/asmdef.inc: $(OBJ)/asmdef.exe - $(OBJ)/asmdef.exe $(OBJ)/asmdef.inc - - $(OBJ)/asmdef.exe: src/asmdef.c allegro.h $(INTERNAL_H) -- gcc $(CFLAGS) $(LFLAGS) -o $@ src/asmdef.c -+ $(GCC) $(CFLAGS) $(LFLAGS) -o $@ src/asmdef.c - - mmxtest: -- @echo // no MMX > $(DOBJ)\mmx.h -- @echo .text > $(DOBJ)\mmxtest.s -- @echo emms >> $(DOBJ)\mmxtest.s -- @gcc -c $(OBJ)/mmxtest.s -o $(OBJ)/mmxtest.o -- @echo #define ALLEGRO_MMX > $(DOBJ)\mmx.h -+ @echo // no MMX > $(subst /,\,$(OBJ))\mmx.h -+ @echo .text > $(subst /,\,$(OBJ))\mmxtest.s -+ @echo emms >> $(subst /,\,$(OBJ))\mmxtest.s -+ @$(GCC) -c $(OBJ)/mmxtest.s -o $(OBJ)/mmxtest.o -+ @echo #define ALLEGRO_MMX > $(subst /,\,$(OBJ))\mmx.h - @echo Your assembler supports MMX instructions! - - $(OBJ)/mmx.h: - @echo Testing for MMX assembler support... - -$(MAKE) mmxtest - --$(OBJ)/setupdat.s $(OBJ)/setupdat.h: setup/setup.dat tools/dat2s.exe -- tools/dat2s.exe setup/setup.dat -o $(OBJ)/setupdat.s -h $(OBJ)/setupdat.h -+$(OBJ)/setupdat.s $(OBJ)/setupdat.h: setup/setup.dat tools/$(VERSION)/dat2s.exe -+ tools/$(VERSION)/dat2s.exe setup/setup.dat -o $(OBJ)/setupdat.s -h $(OBJ)/setupdat.h - - $(OBJ)/setupdat.o: $(OBJ)/setupdat.s -- gcc $(SFLAGS) -o $(OBJ)/setupdat.o -c $(OBJ)/setupdat.s -+ $(GCC) $(SFLAGS) -o $(OBJ)/setupdat.o -c $(OBJ)/setupdat.s - --setup/setup.exe: $(OBJ)/setup.o $(OBJ)/setupdat.o $(LIB) -- gcc $(LFLAGS) -o setup/setup.exe $(OBJ)/setup.o $(OBJ)/setupdat.o $(LIB) -+setup/$(VERSION)/setup.exe: $(OBJ)/setup.o $(OBJ)/setupdat.o lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o setup/$(VERSION)/setup.exe $(OBJ)/setup.o $(OBJ)/setupdat.o lib/djgpp/$(LIB) - ifndef DEBUGMODE - ifndef SYMBOLMODE - ifneq ($(DJP),) -- $(DJP) setup/setup.exe -+ $(DJP) setup/$(VERSION)/setup.exe - endif - endif - endif -@@ -301,79 +338,79 @@ - endif - - $(OBJ)/plugins.h: $(wildcard tools/plugins/*.inc) -- copy tools\plugins\*.inc $(DOBJ)\plugins.h -+ cat tools/plugins/*.inc > $(OBJ)/plugins.h - --tools/dat.exe: $(OBJ)/dat.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/dat.exe $(OBJ)/dat.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/dat.exe: $(OBJ)/dat.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/dat.exe $(OBJ)/dat.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --tools/dat2s.exe: $(OBJ)/dat2s.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/dat2s.exe $(OBJ)/dat2s.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/dat2s.exe: $(OBJ)/dat2s.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/dat2s.exe $(OBJ)/dat2s.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --tools/grabber.exe: $(OBJ)/grabber.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/grabber.exe $(OBJ)/grabber.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/grabber.exe: $(OBJ)/grabber.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/grabber.exe $(OBJ)/grabber.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --tools/pat2dat.exe: $(OBJ)/pat2dat.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/pat2dat.exe $(OBJ)/pat2dat.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/pat2dat.exe: $(OBJ)/pat2dat.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/pat2dat.exe $(OBJ)/pat2dat.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --$(LIB): $(LIB_OBJS) -- ar rs $(LIB) $(LIB_OBJS) -+lib/djgpp/$(LIB): $(LIB_OBJS) -+ ar rs lib/djgpp/$(LIB) $(LIB_OBJS) - - compress: $(PROGRAMS) - ifneq ($(DJP),) -- $(DJP) demo/*.exe examples/*.exe tests/*.exe tools/*.exe setup/keyconf.exe obj/djgpp/*.exe -+ $(DJP) demo/$(VERSION)/*.exe examples/$(VERSION)/*.exe tests/$(VERSION)/*.exe tools/$(VERSION)/*.exe setup/$(VERSION)/keyconf.exe $(OBJ)*.exe - else - @echo No executable compressor found! This target requires either the - @echo DJP or UPX utilities to be installed in your djgpp bin directory. - endif - - clean: -- -rm -v obj/djgpp/*.* lib/djgpp/*.* docs/*.$(HTML) docs/*.txi docs/*.inf docs/*.rtf -+ -rm -f -v $(OBJ)/*.* lib/djgpp/*.* docs/*.$(HTML) docs/*.txi docs/*.inf docs/*.rtf - - veryclean: clean -- -rm -v allegro.txt AUTHORS CHANGES faq.txt help.txt NEWS THANKS \ -- demo/*.exe examples/*.exe setup/*.exe tests/*.exe tools/*.exe -+ -rm -f -v allegro.txt AUTHORS CHANGES faq.txt help.txt NEWS THANKS \ -+ demo/$(VERSION)/*.exe examples/$(VERSION)/*.exe setup/$(VERSION)/*.exe tests/$(VERSION)/*.exe tools/$(VERSION)/*.exe - - uninstall: -- -rm $(LIBDEST) -- -rm $(INCDEST) -- -rm $(DOCDEST) -+ -rm -f $(LIBDEST) -+ -rm -f $(INCDEST) -+ -rm -f $(DOCDEST) - @echo All gone! (sulk) - --demo: demo/demo.exe --keyconf: setup/keyconf.exe --setup: setup/setup.exe --afinfo: tests/afinfo.exe --akaitest: tests/akaitest.exe --digitest: tests/digitest.exe --mathtest: tests/mathtest.exe --miditest: tests/miditest.exe --play: tests/play.exe --playfli: tests/playfli.exe --test: tests/test.exe --vesainfo: tests/vesainfo.exe --colormap: tools/colormap.exe --dat: tools/dat.exe --dat2s: tools/dat2s.exe --exedat: tools/exedat.exe --grabber: tools/grabber.exe --pack: tools/pack.exe --pat2dat: tools/pat2dat.exe --rgbmap: tools/rgbmap.exe -- --examples: examples/ex1.exe examples/ex2.exe examples/ex3.exe \ -- examples/ex4.exe examples/ex5.exe examples/ex6.exe \ -- examples/ex7.exe examples/ex8.exe examples/ex9.exe \ -- examples/ex10.exe examples/ex11.exe examples/ex12.exe \ -- examples/ex13.exe examples/ex14.exe examples/ex15.exe \ -- examples/ex16.exe examples/ex17.exe examples/ex18.exe \ -- examples/ex19.exe examples/ex20.exe examples/ex21.exe \ -- examples/ex22.exe examples/ex23.exe examples/ex24.exe \ -- examples/ex25.exe examples/ex26.exe examples/ex27.exe \ -- examples/ex28.exe examples/ex29.exe examples/ex30.exe \ -- examples/ex31.exe examples/ex32.exe examples/ex33.exe \ -- examples/ex34.exe examples/ex35.exe examples/ex36.exe \ -- examples/ex37.exe examples/ex38.exe examples/ex39.exe \ -- examples/ex40.exe -+demo: demo/$(VERSION)/demo.exe -+keyconf: setup/$(VERSION)/keyconf.exe -+setup: setup/$(VERSION)/setup.exe -+afinfo: tests/$(VERSION)/afinfo.exe -+akaitest: tests/$(VERSION)/akaitest.exe -+digitest: tests/$(VERSION)/digitest.exe -+mathtest: tests/$(VERSION)/mathtest.exe -+miditest: tests/$(VERSION)/miditest.exe -+play: tests/$(VERSION)/play.exe -+playfli: tests/$(VERSION)/playfli.exe -+test: tests/$(VERSION)/test.exe -+vesainfo: tests/$(VERSION)/vesainfo.exe -+colormap: tools/$(VERSION)/colormap.exe -+dat: tools/$(VERSION)/dat.exe -+dat2s: tools/$(VERSION)/dat2s.exe -+exedat: tools/$(VERSION)/exedat.exe -+grabber: tools/$(VERSION)/grabber.exe -+pack: tools/$(VERSION)/pack.exe -+pat2dat: tools/$(VERSION)/pat2dat.exe -+rgbmap: tools/$(VERSION)/rgbmap.exe -+ -+examples: examples/$(VERSION)/ex1.exe examples/$(VERSION)/ex2.exe examples/$(VERSION)/ex3.exe \ -+ examples/$(VERSION)/ex4.exe examples/$(VERSION)/ex5.exe examples/$(VERSION)/ex6.exe \ -+ examples/$(VERSION)/ex7.exe examples/$(VERSION)/ex8.exe examples/$(VERSION)/ex9.exe \ -+ examples/$(VERSION)/ex10.exe examples/$(VERSION)/ex11.exe examples/$(VERSION)/ex12.exe \ -+ examples/$(VERSION)/ex13.exe examples/$(VERSION)/ex14.exe examples/$(VERSION)/ex15.exe \ -+ examples/$(VERSION)/ex16.exe examples/$(VERSION)/ex17.exe examples/$(VERSION)/ex18.exe \ -+ examples/$(VERSION)/ex19.exe examples/$(VERSION)/ex20.exe examples/$(VERSION)/ex21.exe \ -+ examples/$(VERSION)/ex22.exe examples/$(VERSION)/ex23.exe examples/$(VERSION)/ex24.exe \ -+ examples/$(VERSION)/ex25.exe examples/$(VERSION)/ex26.exe examples/$(VERSION)/ex27.exe \ -+ examples/$(VERSION)/ex28.exe examples/$(VERSION)/ex29.exe examples/$(VERSION)/ex30.exe \ -+ examples/$(VERSION)/ex31.exe examples/$(VERSION)/ex32.exe examples/$(VERSION)/ex33.exe \ -+ examples/$(VERSION)/ex34.exe examples/$(VERSION)/ex35.exe examples/$(VERSION)/ex36.exe \ -+ examples/$(VERSION)/ex37.exe examples/$(VERSION)/ex38.exe examples/$(VERSION)/ex39.exe \ -+ examples/$(VERSION)/ex40.exe - - $(OBJ)/demo.o: demo.h - $(OBJ)/adlib.o: fm_instr.h -diff -ruN allegro.312/obj/djgpp/alld/tmp.txt allegro.313/obj/djgpp/alld/tmp.txt ---- allegro.312/obj/djgpp/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/obj/djgpp/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/obj/djgpp/alleg/tmp.txt allegro.313/obj/djgpp/alleg/tmp.txt ---- allegro.312/obj/djgpp/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/obj/djgpp/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/obj/djgpp/allp/tmp.txt allegro.313/obj/djgpp/allp/tmp.txt ---- allegro.312/obj/djgpp/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/obj/djgpp/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/obj/djgpp/tmp.txt allegro.313/obj/djgpp/tmp.txt ---- allegro.312/obj/djgpp/tmp.txt Sat Feb 27 21:25:34 1999 -+++ allegro.313/obj/djgpp/tmp.txt Thu Jan 1 00:00:00 1970 -@@ -1 +0,0 @@ --This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/setup/alld/tmp.txt allegro.313/setup/alld/tmp.txt ---- allegro.312/setup/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/setup/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/setup/alleg/tmp.txt allegro.313/setup/alleg/tmp.txt ---- allegro.312/setup/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/setup/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/setup/allp/tmp.txt allegro.313/setup/allp/tmp.txt ---- allegro.312/setup/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/setup/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/src/asmdefs.inc allegro.313/src/asmdefs.inc ---- allegro.312/src/asmdefs.inc Sat Feb 20 20:51:22 1999 -+++ allegro.313/src/asmdefs.inc Sun Jun 19 04:18:44 2005 -@@ -41,8 +41,8 @@ - * %eax. Registers will be unchanged, except %eax will return a pointer - * to the start of the selected scanline. - */ --#define WRITE_BANK() call BMP_WBANK(%edx) --#define READ_BANK() call BMP_RBANK(%edx) -+#define WRITE_BANK() call *BMP_WBANK(%edx) -+#define READ_BANK() call *BMP_RBANK(%edx) - - - /* Helper macro for looking up a position in the pattern bitmap. Passed -diff -ruN allegro.312/src/djgpp/gpro.c allegro.313/src/djgpp/gpro.c ---- allegro.312/src/djgpp/gpro.c Sat Feb 20 22:01:28 1999 -+++ allegro.313/src/djgpp/gpro.c Mon Jun 20 21:23:42 2005 -@@ -53,135 +53,79 @@ - */ - static int read_gpp(int pad_num) - { -- char samples[60]; -- char clock_mask, data_mask; -- int ret; -- -- asm ( -- " cmpb $0, %0 ; " -- " jne 14f ; " -- " movb $0x10, %b2 ; " -- " movb $0x20, %b3 ; " -- " jmp 15f ; " -- " 14: " -- " movb $0x40, %b2 ; " -- " movb $0x80, %b3 ; " -- -- " 15: " -- " xorl %%ebx, %%ebx ; " -- " xorl %%edi, %%edi ; " -- " movw $0x201, %%dx ; " -- -- " cli ; " -- " inb %%dx, %%al ; " -- " movb %%al, %%ah ; " -- -- " 4: " -- " xorl %%ecx, %%ecx ; " -- " 0: " -- " inb %%dx, %%al ; " -- " cmpb %%ah, %%al ; " -- " jne 1f ; " -- " incl %%ecx ; " -- " cmpl $255, %%ecx ; " -- " jl 0b ; " -- -- " 1: " -- " cmpl $255, %%ecx ; " -- " je 16f ; " -- -- " testb %%ah, %b2 ; " -- " jz 2f ; " -- " testb %%al, %b2 ; " -- " jnz 2f ; " -- -- " addl %4, %%edi ; " -- " testb %%al, %b3 ; " -- " jz 3f ; " -- " movb $1, (%%edi) ; " -- " jmp 12f ; " -- " 3: " -- " movb $0, (%%edi) ; " -- " 12: " -- " subl %4, %%edi ; " -- " incl %%edi ; " -- -- " 2: " -- " movb %%al, %%ah ; " -- " cmpl $200, %%ebx ; " -- " je 13f ; " -- " incl %%ebx ; " -- " cmpl $50, %%edi ; " -- " jl 4b ; " -- -- " 13: " -- " sti ; " -- " xorl %%ecx, %%ecx ; " -- " movl $1, %%esi ; " -- " 7: " -- " addl %4, %%esi ; " -- " movb (%%esi), %%dl ; " -- " subl %4, %%esi ; " -- " cmpb $1, %%dl ; " -- " jg 16f ; " -- " jne 6f ; " -- " incl %%ecx ; " -- " jmp 5f ; " -- " 6: " -- " xorl %%ecx, %%ecx ; " -- -- " 5: " -- " cmpl $5, %%ecx ; " -- " je 8f ; " -- " cmpl %%edi, %%esi ; " -- " je 8f ; " -- " incl %%esi ; " -- " jmp 7b ; " -- -- " 8: " -- " cmpl $5, %%ecx ; " -- " jne 16f ; " -- " addl $2, %%esi ; " -- " xorl %%eax, %%eax ; " -- " xorl %%ebx, %%ebx ; " -- " xorl %%ecx, %%ecx ; " -- " xorl %%edx, %%edx ; " -- -- " 10: " -- " incl %%ecx ; " -- " cmpl $5, %%ecx ; " -- " jne 11f ; " -- " movl $1, %%ecx ; " -- " incl %%esi ; " -- " 11: " -- " addl %4, %%esi ; " -- " movb (%%esi), %%dl ; " -- " subl %4, %%esi ; " -- " orl %%edx, %%eax ; " -- " shll $1, %%eax ; " -- " cmpl $13, %%ebx ; " -- " je 9f ; " -- " incl %%ebx ; " -- " incl %%esi ; " -- " jmp 10b ; " -- -- " 16: " -- " movl $1, %%eax ; " -- -- " 9: " -- " sti ; " -- -- : "=a" (ret) -- -- : "0" (pad_num), -- "m" (clock_mask), -- "m" (data_mask), -- "m" (samples) -+ int samples[50]; -+ int clock_mask, data_mask, data, old_data; -+ int num_samples, timeout1, timeout2, sample_pos, c; -+ -+ if (pad_num == 0) { -+ clock_mask = 0x10; -+ data_mask = 0x20; -+ } -+ else { -+ clock_mask = 0x40; -+ data_mask = 0x80; -+ } -+ -+ num_samples = 0; -+ timeout1 = 0; -+ -+ asm volatile ("cli"); -+ -+ old_data = inportb(0x201); -+ data = 0; -+ -+ while (num_samples<50) { -+ for (timeout2=0; timeout2<255; timeout2++) { -+ data = inportb(0x201); -+ if (data != old_data) -+ break; -+ } -+ -+ if (timeout2 == 255) { -+ asm volatile ("sti"); -+ return 1; -+ } -+ -+ if ((old_data & clock_mask) && (!(data & clock_mask))) { -+ samples[num_samples] = (data & data_mask) ? 1 : 0; -+ num_samples++; -+ } -+ -+ old_data = data; -+ -+ if (timeout1++ == 200) -+ break; -+ } -+ -+ asm volatile ("sti"); -+ -+ c = 0; -+ -+ for (sample_pos=1; sample_posgs), - "=m" (sregs->ss) - -- : /* no inputs */ -- -- : "%eax" /* clobbers %eax */ - ); - } - -diff -ruN allegro.312/src/gfx15.s allegro.313/src/gfx15.s ---- allegro.312/src/gfx15.s Sat Feb 20 20:50:30 1999 -+++ allegro.313/src/gfx15.s Mon Jun 20 22:46:02 2005 -@@ -367,9 +367,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx16.s allegro.313/src/gfx16.s ---- allegro.312/src/gfx16.s Sat Feb 20 20:50:42 1999 -+++ allegro.313/src/gfx16.s Mon Jun 20 22:47:28 2005 -@@ -417,9 +417,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx24.s allegro.313/src/gfx24.s ---- allegro.312/src/gfx24.s Sat Feb 20 20:46:30 1999 -+++ allegro.313/src/gfx24.s Mon Jun 20 22:48:22 2005 -@@ -265,7 +265,7 @@ - movl %eax, ARG2 /* ARG2 == 12(%ebp) */ - movl %eax, 15(%ebp) /* overwrite ARG2, ARG3, ARG4 */ - movl %eax, 18(%ebp) -- movw %eax, 21(%ebp) -+ movw %ax, 21(%ebp) - shrl $16, %eax - movb %al, 23(%ebp) - cmpl $4, %ecx -@@ -503,9 +503,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx32.s allegro.313/src/gfx32.s ---- allegro.312/src/gfx32.s Sat Feb 20 20:50:40 1999 -+++ allegro.313/src/gfx32.s Mon Jun 20 22:48:44 2005 -@@ -398,9 +398,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx8.s allegro.313/src/gfx8.s ---- allegro.312/src/gfx8.s Sat Feb 20 20:50:54 1999 -+++ allegro.313/src/gfx8.s Mon Jun 20 22:49:02 2005 -@@ -455,9 +455,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/tests/alld/tmp.txt allegro.313/tests/alld/tmp.txt ---- allegro.312/tests/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tests/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tests/alleg/tmp.txt allegro.313/tests/alleg/tmp.txt ---- allegro.312/tests/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tests/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tests/allp/tmp.txt allegro.313/tests/allp/tmp.txt ---- allegro.312/tests/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tests/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tools/alld/tmp.txt allegro.313/tools/alld/tmp.txt ---- allegro.312/tools/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tools/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tools/alleg/tmp.txt allegro.313/tools/alleg/tmp.txt ---- allegro.312/tools/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tools/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tools/allp/tmp.txt allegro.313/tools/allp/tmp.txt ---- allegro.312/tools/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tools/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. diff --git a/tools/fmoddyn.h b/tools/fmoddyn.h deleted file mode 100644 index d1e7c43f8..000000000 --- a/tools/fmoddyn.h +++ /dev/null @@ -1,582 +0,0 @@ -/* =========================================================================================== */ -/* FMOD Dynamic DLL loading header. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ -/* =========================================================================================== */ - -#ifndef _FMODDYN_H_ -#define _FMODDYN_H_ - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - #include -#else - #include - #include -#endif -#include - -typedef struct -{ - void *module; - - signed char (F_API *FSOUND_SetOutput)(int outputtype); - signed char (F_API *FSOUND_SetDriver)(int driver); - signed char (F_API *FSOUND_SetMixer)(int mixer); - signed char (F_API *FSOUND_SetBufferSize)(int len_ms); - signed char (F_API *FSOUND_SetHWND)(void *hwnd); - signed char (F_API *FSOUND_SetMinHardwareChannels)(int min); - signed char (F_API *FSOUND_SetMaxHardwareChannels)(int max); - signed char (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree); - signed char (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags); - void (F_API *FSOUND_Close)(); - void (F_API *FSOUND_Update)(); /* you must call this once a frame */ - void (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode); - void (F_API *FSOUND_SetSFXMasterVolume)(int volume); - void (F_API *FSOUND_SetPanSeperation)(float pansep); - void (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK userseek, FSOUND_TELLCALLBACK usertell); - int (F_API *FSOUND_GetError)(); - float (F_API *FSOUND_GetVersion)(); - int (F_API *FSOUND_GetOutput)(); - void * (F_API *FSOUND_GetOutputHandle)(); - int (F_API *FSOUND_GetDriver)(); - int (F_API *FSOUND_GetMixer)(); - int (F_API *FSOUND_GetNumDrivers)(); - const char * (F_API *FSOUND_GetDriverName)(int id); - signed char (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps); - int (F_API *FSOUND_GetOutputRate)(); - int (F_API *FSOUND_GetMaxChannels)(); - int (F_API *FSOUND_GetMaxSamples)(); - unsigned int (F_API *FSOUND_GetSpeakerMode)(); - int (F_API *FSOUND_GetSFXMasterVolume)(); - signed char (F_API *FSOUND_GetNumHWChannels)(int *num2d, int *num3d, int *total); - int (F_API *FSOUND_GetChannelsPlaying)(); - float (F_API *FSOUND_GetCPUUsage)(); - void (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); - void (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); - signed char (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); - signed char (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); - signed char (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode); - signed char (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend); - signed char (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); - signed char (F_API *FSOUND_Sample_SetDefaultsEx)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); - signed char (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max); - signed char (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Get)(int sampno); - const char * (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr); - unsigned int (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); - signed char (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); - signed char (F_API *FSOUND_Sample_GetDefaultsEx)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); - unsigned int (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_GetMinMaxDistance)(FSOUND_SAMPLE *sptr, float *min, float *max); - int (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr); - int (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); - signed char (F_API *FSOUND_StopSound)(int channel); - signed char (F_API *FSOUND_SetFrequency)(int channel, int freq); - signed char (F_API *FSOUND_SetVolume)(int channel, int vol); - signed char (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol); - signed char (F_API *FSOUND_SetPan)(int channel, int pan); - signed char (F_API *FSOUND_SetSurround)(int channel, signed char surround); - signed char (F_API *FSOUND_SetMute)(int channel, signed char mute); - signed char (F_API *FSOUND_SetPriority)(int channel, int priority); - signed char (F_API *FSOUND_SetReserved)(int channel, signed char reserved); - signed char (F_API *FSOUND_SetPaused)(int channel, signed char paused); - signed char (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode); - signed char (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset); - signed char (F_API *FSOUND_3D_SetAttributes)(int channel, const float *pos, const float *vel); - signed char (F_API *FSOUND_3D_SetMinMaxDistance)(int channel, float min, float max); - signed char (F_API *FSOUND_IsPlaying)(int channel); - int (F_API *FSOUND_GetFrequency)(int channel); - int (F_API *FSOUND_GetVolume)(int channel); - int (F_API *FSOUND_GetAmplitude)(int channel); - int (F_API *FSOUND_GetPan)(int channel); - signed char (F_API *FSOUND_GetSurround)(int channel); - signed char (F_API *FSOUND_GetMute)(int channel); - int (F_API *FSOUND_GetPriority)(int channel); - signed char (F_API *FSOUND_GetReserved)(int channel); - signed char (F_API *FSOUND_GetPaused)(int channel); - unsigned int (F_API *FSOUND_GetLoopMode)(int channel); - unsigned int (F_API *FSOUND_GetCurrentPosition)(int channel); - FSOUND_SAMPLE * (F_API *FSOUND_GetCurrentSample)(int channel); - signed char (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r); - int (F_API *FSOUND_GetNumSubChannels)(int channel); - int (F_API *FSOUND_GetSubChannel)(int channel, int subchannel); - signed char (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel); - signed char (F_API *FSOUND_3D_GetMinMaxDistance)(int channel, float *min, float *max); - void (F_API *FSOUND_3D_SetDopplerFactor)(float scale); - void (F_API *FSOUND_3D_SetDistanceFactor)(float scale); - void (F_API *FSOUND_3D_SetRolloffFactor)(float scale); - void (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ - void (F_API *FSOUND_3D_Listener_SetAttributes)(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); - void (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); - int (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx); /* See FSOUND_FX_MODES */ - signed char (F_API *FSOUND_FX_Disable)(int channel); - signed char (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - signed char (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); - signed char (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); - signed char (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); - signed char (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - signed char (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape); - signed char (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); - signed char (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain); - signed char (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); - signed char (F_API *FSOUND_Stream_SetBufferSize)(int ms); /* call this before opening streams, not after */ - FSOUND_STREAM * (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length); - FSOUND_STREAM * (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); - signed char (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); - signed char (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position); - unsigned int (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms); - int (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode); - unsigned int (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); - signed char (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count); - int (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream); - FSOUND_SAMPLE * (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream); /* every stream contains a sample to playback on */ - FSOUND_DSPUNIT * (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); - signed char (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - signed char (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name); - signed char (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point); - int (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream); - FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index); - char * (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); - signed char (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index); - int (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, const int *sentencelist, int numitems); - signed char (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num); - signed char (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length); - signed char (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length); - signed char (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy); - signed char (F_API *FSOUND_Stream_Net_SetTimeout)(int timeout); - char * (F_API *FSOUND_Stream_Net_GetLastServerStatus)(); - signed char (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent); - signed char (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); - signed char (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); - signed char (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); - signed char (F_API *FSOUND_CD_Play)(char drive, int track); - void (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode); - signed char (F_API *FSOUND_CD_Stop)(char drive); - signed char (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused); - signed char (F_API *FSOUND_CD_SetVolume)(char drive, int volume); - signed char (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms); - signed char (F_API *FSOUND_CD_OpenTray)(char drive, signed char open); - signed char (F_API *FSOUND_CD_GetPaused)(char drive); - int (F_API *FSOUND_CD_GetTrack)(char drive); - int (F_API *FSOUND_CD_GetNumTracks)(char drive); - int (F_API *FSOUND_CD_GetVolume)(char drive); - int (F_API *FSOUND_CD_GetTrackLength)(char drive, int track); - int (F_API *FSOUND_CD_GetTrackTime)(char drive); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, void *userdata); - void (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit); - void (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority); - int (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit); - void (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active); - signed char (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClearUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetSFXUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetMusicUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetFFTUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClipAndCopyUnit)(); - signed char (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); - void (F_API *FSOUND_DSP_ClearMixBuffer)(); - int (F_API *FSOUND_DSP_GetBufferLength)(); /* Length of each DSP update */ - int (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */ - float * (F_API *FSOUND_DSP_GetSpectrum)(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ - signed char (F_API *FSOUND_Reverb_SetProperties)(const FSOUND_REVERB_PROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); - signed char (F_API *FSOUND_Record_SetDriver)(int outputtype); - int (F_API *FSOUND_Record_GetNumDrivers)(); - const char * (F_API *FSOUND_Record_GetDriverName)(int id); - int (F_API *FSOUND_Record_GetDriver)(); - signed char (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop); - signed char (F_API *FSOUND_Record_Stop)(); - int (F_API *FSOUND_Record_GetPosition)(); - FMUSIC_MODULE * (F_API *FMUSIC_LoadSong)(const char *name); - FMUSIC_MODULE * (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); - int (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod); - void (F_API *FMUSIC_StopAllSongs)(); - signed char (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); - signed char (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); - signed char (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); - signed char (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); - signed char (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); - signed char (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, void *userdata); - signed char (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume); - signed char (F_API *FMUSIC_SetReverb)(signed char reverb); /* MIDI only */ - signed char (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping); - signed char (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order); - signed char (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause); - signed char (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume); - signed char (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed); - signed char (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep); - const char * (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod); - FSOUND_SAMPLE * (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno); - int (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno); - signed char (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel); - unsigned int (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod); -} FMOD_INSTANCE; - - -static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName) -{ - FMOD_INSTANCE *instance; - - instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1); - if (!instance) - { - return NULL; - } - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - instance->module = LoadLibrary(dllName); -#else - instance->module = dlopen(dllName, RTLD_LAZY); -#endif - if (!instance->module) - { - free(instance); - return NULL; - } - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) -#ifdef __MINGW64__ - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - instance->_x = (LPVOID)GetProcAddress((HMODULE)instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#elif defined(__MINGW32__) - #define F_GETPROC(_x, _y) \ - { \ - instance->_x = (LPVOID)GetProcAddress((HMODULE)instance->module, _y); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#elif defined (_X86_) - #define F_GETPROC(_x, _y) \ - { \ - instance->_x = (LPVOID)(size_t)GetProcAddress((HMODULE)instance->module, _y); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#else - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - instance->_x = (LPVOID)(size_t)GetProcAddress((HMODULE)instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#endif -#else - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - instance->_x = (void *)dlsym(instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - dlclose(instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#endif - - F_GETPROC(FSOUND_SetOutput, "_FSOUND_SetOutput@4"); - F_GETPROC(FSOUND_SetDriver, "_FSOUND_SetDriver@4"); - F_GETPROC(FSOUND_SetMixer, "_FSOUND_SetMixer@4"); - F_GETPROC(FSOUND_SetBufferSize, "_FSOUND_SetBufferSize@4"); - F_GETPROC(FSOUND_SetHWND, "_FSOUND_SetHWND@4"); - F_GETPROC(FSOUND_SetMinHardwareChannels, "_FSOUND_SetMinHardwareChannels@4"); - F_GETPROC(FSOUND_SetMaxHardwareChannels, "_FSOUND_SetMaxHardwareChannels@4"); - F_GETPROC(FSOUND_SetMemorySystem, "_FSOUND_SetMemorySystem@20"); - F_GETPROC(FSOUND_Init, "_FSOUND_Init@12"); - F_GETPROC(FSOUND_Close, "_FSOUND_Close@0"); - F_GETPROC(FSOUND_Update, "_FSOUND_Update@0"); - F_GETPROC(FSOUND_SetSFXMasterVolume, "_FSOUND_SetSFXMasterVolume@4"); - F_GETPROC(FSOUND_SetPanSeperation, "_FSOUND_SetPanSeperation@4"); - F_GETPROC(FSOUND_SetSpeakerMode, "_FSOUND_SetSpeakerMode@4"); - F_GETPROC(FSOUND_GetError, "_FSOUND_GetError@0"); - F_GETPROC(FSOUND_GetVersion, "_FSOUND_GetVersion@0"); - F_GETPROC(FSOUND_GetOutput, "_FSOUND_GetOutput@0"); - F_GETPROC(FSOUND_GetOutputHandle, "_FSOUND_GetOutputHandle@0"); - F_GETPROC(FSOUND_GetDriver, "_FSOUND_GetDriver@0"); - F_GETPROC(FSOUND_GetMixer, "_FSOUND_GetMixer@0"); - F_GETPROC(FSOUND_GetNumDrivers, "_FSOUND_GetNumDrivers@0"); - F_GETPROC(FSOUND_GetDriverName, "_FSOUND_GetDriverName@4"); - F_GETPROC(FSOUND_GetDriverCaps, "_FSOUND_GetDriverCaps@8"); - F_GETPROC(FSOUND_GetOutputRate, "_FSOUND_GetOutputRate@0"); - F_GETPROC(FSOUND_GetMaxChannels, "_FSOUND_GetMaxChannels@0"); - F_GETPROC(FSOUND_GetMaxSamples, "_FSOUND_GetMaxSamples@0"); - F_GETPROC(FSOUND_GetSpeakerMode, "_FSOUND_GetSpeakerMode@0"); - F_GETPROC(FSOUND_GetSFXMasterVolume, "_FSOUND_GetSFXMasterVolume@0"); - F_GETPROC(FSOUND_GetNumHWChannels, "_FSOUND_GetNumHWChannels@12"); - F_GETPROC(FSOUND_GetChannelsPlaying, "_FSOUND_GetChannelsPlaying@0"); - F_GETPROC(FSOUND_GetCPUUsage, "_FSOUND_GetCPUUsage@0"); - F_GETPROC(FSOUND_GetMemoryStats, "_FSOUND_GetMemoryStats@8"); - F_GETPROC(FSOUND_Sample_Load, "_FSOUND_Sample_Load@20"); - F_GETPROC(FSOUND_Sample_Alloc, "_FSOUND_Sample_Alloc@28"); - F_GETPROC(FSOUND_Sample_Free, "_FSOUND_Sample_Free@4"); - F_GETPROC(FSOUND_Sample_Upload, "_FSOUND_Sample_Upload@12"); - F_GETPROC(FSOUND_Sample_Lock, "_FSOUND_Sample_Lock@28"); - F_GETPROC(FSOUND_Sample_Unlock, "_FSOUND_Sample_Unlock@20"); - F_GETPROC(FSOUND_Sample_SetMode, "_FSOUND_Sample_SetMode@8"); - F_GETPROC(FSOUND_Sample_SetLoopPoints, "_FSOUND_Sample_SetLoopPoints@12"); - F_GETPROC(FSOUND_Sample_SetDefaults, "_FSOUND_Sample_SetDefaults@20"); - F_GETPROC(FSOUND_Sample_SetDefaultsEx, "_FSOUND_Sample_SetDefaultsEx@32"); - F_GETPROC(FSOUND_Sample_SetMinMaxDistance, "_FSOUND_Sample_SetMinMaxDistance@12"); - F_GETPROC(FSOUND_Sample_SetMaxPlaybacks, "_FSOUND_Sample_SetMaxPlaybacks@8"); - F_GETPROC(FSOUND_Sample_Get, "_FSOUND_Sample_Get@4"); - F_GETPROC(FSOUND_Sample_GetName, "_FSOUND_Sample_GetName@4"); - F_GETPROC(FSOUND_Sample_GetLength, "_FSOUND_Sample_GetLength@4"); - F_GETPROC(FSOUND_Sample_GetLoopPoints, "_FSOUND_Sample_GetLoopPoints@12"); - F_GETPROC(FSOUND_Sample_GetDefaults, "_FSOUND_Sample_GetDefaults@20"); - F_GETPROC(FSOUND_Sample_GetDefaultsEx, "_FSOUND_Sample_GetDefaultsEx@32"); - F_GETPROC(FSOUND_Sample_GetMode, "_FSOUND_Sample_GetMode@4"); - F_GETPROC(FSOUND_Sample_GetMinMaxDistance, "_FSOUND_Sample_GetMinMaxDistance@12"); - F_GETPROC(FSOUND_PlaySound, "_FSOUND_PlaySound@8"); - F_GETPROC(FSOUND_PlaySoundEx, "_FSOUND_PlaySoundEx@16"); - F_GETPROC(FSOUND_StopSound, "_FSOUND_StopSound@4"); - F_GETPROC(FSOUND_SetFrequency, "_FSOUND_SetFrequency@8"); - F_GETPROC(FSOUND_SetVolume, "_FSOUND_SetVolume@8"); - F_GETPROC(FSOUND_SetVolumeAbsolute, "_FSOUND_SetVolumeAbsolute@8"); - F_GETPROC(FSOUND_SetPan, "_FSOUND_SetPan@8"); - F_GETPROC(FSOUND_SetSurround, "_FSOUND_SetSurround@8"); - F_GETPROC(FSOUND_SetMute, "_FSOUND_SetMute@8"); - F_GETPROC(FSOUND_SetPriority, "_FSOUND_SetPriority@8"); - F_GETPROC(FSOUND_SetReserved, "_FSOUND_SetReserved@8"); - F_GETPROC(FSOUND_SetPaused, "_FSOUND_SetPaused@8"); - F_GETPROC(FSOUND_SetLoopMode, "_FSOUND_SetLoopMode@8"); - F_GETPROC(FSOUND_SetCurrentPosition, "_FSOUND_SetCurrentPosition@8"); - F_GETPROC(FSOUND_3D_SetAttributes, "_FSOUND_3D_SetAttributes@12"); - F_GETPROC(FSOUND_3D_SetMinMaxDistance, "_FSOUND_3D_SetMinMaxDistance@12"); - F_GETPROC(FSOUND_IsPlaying, "_FSOUND_IsPlaying@4"); - F_GETPROC(FSOUND_GetFrequency, "_FSOUND_GetFrequency@4"); - F_GETPROC(FSOUND_GetVolume, "_FSOUND_GetVolume@4"); - F_GETPROC(FSOUND_GetAmplitude, "_FSOUND_GetAmplitude@4"); - F_GETPROC(FSOUND_GetPan, "_FSOUND_GetPan@4"); - F_GETPROC(FSOUND_GetSurround, "_FSOUND_GetSurround@4"); - F_GETPROC(FSOUND_GetMute, "_FSOUND_GetMute@4"); - F_GETPROC(FSOUND_GetPriority, "_FSOUND_GetPriority@4"); - F_GETPROC(FSOUND_GetReserved, "_FSOUND_GetReserved@4"); - F_GETPROC(FSOUND_GetPaused, "_FSOUND_GetPaused@4"); - F_GETPROC(FSOUND_GetLoopMode, "_FSOUND_GetLoopMode@4"); - F_GETPROC(FSOUND_GetCurrentPosition, "_FSOUND_GetCurrentPosition@4"); - F_GETPROC(FSOUND_GetCurrentSample, "_FSOUND_GetCurrentSample@4"); - F_GETPROC(FSOUND_GetCurrentLevels, "_FSOUND_GetCurrentLevels@12"); - F_GETPROC(FSOUND_GetNumSubChannels, "_FSOUND_GetNumSubChannels@4"); - F_GETPROC(FSOUND_GetSubChannel, "_FSOUND_GetSubChannel@8"); - F_GETPROC(FSOUND_3D_GetAttributes, "_FSOUND_3D_GetAttributes@12"); - F_GETPROC(FSOUND_3D_GetMinMaxDistance, "_FSOUND_3D_GetMinMaxDistance@12"); - F_GETPROC(FSOUND_3D_Listener_SetCurrent, "_FSOUND_3D_Listener_SetCurrent@8"); - F_GETPROC(FSOUND_3D_Listener_SetAttributes, "_FSOUND_3D_Listener_SetAttributes@32"); - F_GETPROC(FSOUND_3D_Listener_GetAttributes, "_FSOUND_3D_Listener_GetAttributes@32"); - F_GETPROC(FSOUND_3D_SetDopplerFactor, "_FSOUND_3D_SetDopplerFactor@4"); - F_GETPROC(FSOUND_3D_SetDistanceFactor, "_FSOUND_3D_SetDistanceFactor@4"); - F_GETPROC(FSOUND_3D_SetRolloffFactor, "_FSOUND_3D_SetRolloffFactor@4"); - F_GETPROC(FSOUND_FX_Enable, "_FSOUND_FX_Enable@8"); - F_GETPROC(FSOUND_FX_Disable, "_FSOUND_FX_Disable@4"); - F_GETPROC(FSOUND_FX_SetChorus, "_FSOUND_FX_SetChorus@32"); - F_GETPROC(FSOUND_FX_SetCompressor, "_FSOUND_FX_SetCompressor@28"); - F_GETPROC(FSOUND_FX_SetDistortion, "_FSOUND_FX_SetDistortion@24"); - F_GETPROC(FSOUND_FX_SetEcho, "_FSOUND_FX_SetEcho@24"); - F_GETPROC(FSOUND_FX_SetFlanger, "_FSOUND_FX_SetFlanger@32"); - F_GETPROC(FSOUND_FX_SetGargle, "_FSOUND_FX_SetGargle@12"); - F_GETPROC(FSOUND_FX_SetI3DL2Reverb, "_FSOUND_FX_SetI3DL2Reverb@52"); - F_GETPROC(FSOUND_FX_SetParamEQ, "_FSOUND_FX_SetParamEQ@16"); - F_GETPROC(FSOUND_FX_SetWavesReverb, "_FSOUND_FX_SetWavesReverb@20"); - F_GETPROC(FSOUND_Stream_Open, "_FSOUND_Stream_Open@16"); - F_GETPROC(FSOUND_Stream_Create, "_FSOUND_Stream_Create@20"); - F_GETPROC(FSOUND_Stream_Play, "_FSOUND_Stream_Play@8"); - F_GETPROC(FSOUND_Stream_PlayEx, "_FSOUND_Stream_PlayEx@16"); - F_GETPROC(FSOUND_Stream_Stop, "_FSOUND_Stream_Stop@4"); - F_GETPROC(FSOUND_Stream_Close, "_FSOUND_Stream_Close@4"); - F_GETPROC(FSOUND_Stream_SetEndCallback, "_FSOUND_Stream_SetEndCallback@12"); - F_GETPROC(FSOUND_Stream_SetSyncCallback, "_FSOUND_Stream_SetSyncCallback@12"); - F_GETPROC(FSOUND_Stream_GetSample, "_FSOUND_Stream_GetSample@4"); - F_GETPROC(FSOUND_Stream_CreateDSP, "_FSOUND_Stream_CreateDSP@16"); - F_GETPROC(FSOUND_Stream_SetBufferSize, "_FSOUND_Stream_SetBufferSize@4"); - F_GETPROC(FSOUND_Stream_SetPosition, "_FSOUND_Stream_SetPosition@8"); - F_GETPROC(FSOUND_Stream_GetPosition, "_FSOUND_Stream_GetPosition@4"); - F_GETPROC(FSOUND_Stream_SetTime, "_FSOUND_Stream_SetTime@8"); - F_GETPROC(FSOUND_Stream_GetTime, "_FSOUND_Stream_GetTime@4"); - F_GETPROC(FSOUND_Stream_GetLength, "_FSOUND_Stream_GetLength@4"); - F_GETPROC(FSOUND_Stream_GetLengthMs, "_FSOUND_Stream_GetLengthMs@4"); - F_GETPROC(FSOUND_Stream_SetMode, "_FSOUND_Stream_SetMode@8"); - F_GETPROC(FSOUND_Stream_GetMode, "_FSOUND_Stream_GetMode@4"); - F_GETPROC(FSOUND_Stream_SetSubStream, "_FSOUND_Stream_SetSubStream@8"); - F_GETPROC(FSOUND_Stream_GetNumSubStreams, "_FSOUND_Stream_GetNumSubStreams@4"); - F_GETPROC(FSOUND_Stream_SetSubStreamSentence, "_FSOUND_Stream_SetSubStreamSentence@12"); - F_GETPROC(FSOUND_Stream_SetLoopPoints, "_FSOUND_Stream_SetLoopPoints@12"); - F_GETPROC(FSOUND_Stream_SetLoopCount, "_FSOUND_Stream_SetLoopCount@8"); - F_GETPROC(FSOUND_Stream_AddSyncPoint, "_FSOUND_Stream_AddSyncPoint@12"); - F_GETPROC(FSOUND_Stream_DeleteSyncPoint, "_FSOUND_Stream_DeleteSyncPoint@4"); - F_GETPROC(FSOUND_Stream_GetNumSyncPoints, "_FSOUND_Stream_GetNumSyncPoints@4"); - F_GETPROC(FSOUND_Stream_GetSyncPoint, "_FSOUND_Stream_GetSyncPoint@8"); - F_GETPROC(FSOUND_Stream_GetSyncPointInfo, "_FSOUND_Stream_GetSyncPointInfo@8"); - F_GETPROC(FSOUND_Stream_GetOpenState, "_FSOUND_Stream_GetOpenState@4"); - F_GETPROC(FSOUND_Stream_GetNumTagFields, "_FSOUND_Stream_GetNumTagFields@8"); - F_GETPROC(FSOUND_Stream_GetTagField, "_FSOUND_Stream_GetTagField@24"); - F_GETPROC(FSOUND_Stream_FindTagField, "_FSOUND_Stream_FindTagField@20"); - F_GETPROC(FSOUND_Stream_Net_SetProxy, "_FSOUND_Stream_Net_SetProxy@4"); - F_GETPROC(FSOUND_Stream_Net_GetLastServerStatus, "_FSOUND_Stream_Net_GetLastServerStatus@0"); - F_GETPROC(FSOUND_Stream_Net_SetBufferProperties, "_FSOUND_Stream_Net_SetBufferProperties@12"); - F_GETPROC(FSOUND_Stream_Net_GetBufferProperties, "_FSOUND_Stream_Net_GetBufferProperties@12"); - F_GETPROC(FSOUND_Stream_Net_SetMetadataCallback, "_FSOUND_Stream_Net_SetMetadataCallback@12"); - F_GETPROC(FSOUND_Stream_Net_GetStatus, "_FSOUND_Stream_Net_GetStatus@20"); - F_GETPROC(FSOUND_CD_Play, "_FSOUND_CD_Play@8"); - F_GETPROC(FSOUND_CD_SetPlayMode, "_FSOUND_CD_SetPlayMode@8"); - F_GETPROC(FSOUND_CD_Stop, "_FSOUND_CD_Stop@4"); - F_GETPROC(FSOUND_CD_SetPaused, "_FSOUND_CD_SetPaused@8"); - F_GETPROC(FSOUND_CD_SetVolume, "_FSOUND_CD_SetVolume@8"); - F_GETPROC(FSOUND_CD_SetTrackTime, "_FSOUND_CD_SetTrackTime@8"); - F_GETPROC(FSOUND_CD_OpenTray, "_FSOUND_CD_OpenTray@8"); - F_GETPROC(FSOUND_CD_GetPaused, "_FSOUND_CD_GetPaused@4"); - F_GETPROC(FSOUND_CD_GetTrack, "_FSOUND_CD_GetTrack@4"); - F_GETPROC(FSOUND_CD_GetNumTracks, "_FSOUND_CD_GetNumTracks@4"); - F_GETPROC(FSOUND_CD_GetVolume, "_FSOUND_CD_GetVolume@4"); - F_GETPROC(FSOUND_CD_GetTrackLength, "_FSOUND_CD_GetTrackLength@8"); - F_GETPROC(FSOUND_CD_GetTrackTime, "_FSOUND_CD_GetTrackTime@4"); - F_GETPROC(FSOUND_DSP_Create, "_FSOUND_DSP_Create@12"); - F_GETPROC(FSOUND_DSP_Free, "_FSOUND_DSP_Free@4"); - F_GETPROC(FSOUND_DSP_SetPriority, "_FSOUND_DSP_SetPriority@8"); - F_GETPROC(FSOUND_DSP_GetPriority, "_FSOUND_DSP_GetPriority@4"); - F_GETPROC(FSOUND_DSP_SetActive, "_FSOUND_DSP_SetActive@8"); - F_GETPROC(FSOUND_DSP_GetActive, "_FSOUND_DSP_GetActive@4"); - F_GETPROC(FSOUND_DSP_GetClearUnit, "_FSOUND_DSP_GetClearUnit@0"); - F_GETPROC(FSOUND_DSP_GetSFXUnit, "_FSOUND_DSP_GetSFXUnit@0"); - F_GETPROC(FSOUND_DSP_GetMusicUnit, "_FSOUND_DSP_GetMusicUnit@0"); - F_GETPROC(FSOUND_DSP_GetClipAndCopyUnit, "_FSOUND_DSP_GetClipAndCopyUnit@0"); - F_GETPROC(FSOUND_DSP_GetFFTUnit, "_FSOUND_DSP_GetFFTUnit@0"); - F_GETPROC(FSOUND_DSP_MixBuffers, "_FSOUND_DSP_MixBuffers@28"); - F_GETPROC(FSOUND_DSP_ClearMixBuffer, "_FSOUND_DSP_ClearMixBuffer@0"); - F_GETPROC(FSOUND_DSP_GetBufferLength, "_FSOUND_DSP_GetBufferLength@0"); - F_GETPROC(FSOUND_DSP_GetBufferLengthTotal, "_FSOUND_DSP_GetBufferLengthTotal@0"); - F_GETPROC(FSOUND_DSP_GetSpectrum, "_FSOUND_DSP_GetSpectrum@0"); - F_GETPROC(FSOUND_Reverb_SetProperties, "_FSOUND_Reverb_SetProperties@4"); - F_GETPROC(FSOUND_Reverb_GetProperties, "_FSOUND_Reverb_GetProperties@4"); - F_GETPROC(FSOUND_Reverb_SetChannelProperties, "_FSOUND_Reverb_SetChannelProperties@8"); - F_GETPROC(FSOUND_Reverb_GetChannelProperties, "_FSOUND_Reverb_GetChannelProperties@8"); - F_GETPROC(FSOUND_Record_SetDriver, "_FSOUND_Record_SetDriver@4"); - F_GETPROC(FSOUND_Record_GetNumDrivers, "_FSOUND_Record_GetNumDrivers@0"); - F_GETPROC(FSOUND_Record_GetDriverName, "_FSOUND_Record_GetDriverName@4"); - F_GETPROC(FSOUND_Record_GetDriver, "_FSOUND_Record_GetDriver@0"); - F_GETPROC(FSOUND_Record_StartSample, "_FSOUND_Record_StartSample@8"); - F_GETPROC(FSOUND_Record_Stop, "_FSOUND_Record_Stop@0"); - F_GETPROC(FSOUND_Record_GetPosition, "_FSOUND_Record_GetPosition@0"); - F_GETPROC(FSOUND_File_SetCallbacks, "_FSOUND_File_SetCallbacks@20"); - F_GETPROC(FMUSIC_LoadSong, "_FMUSIC_LoadSong@4"); - F_GETPROC(FMUSIC_LoadSongEx, "_FMUSIC_LoadSongEx@24"); - F_GETPROC(FMUSIC_GetOpenState, "_FMUSIC_GetOpenState@4"); - F_GETPROC(FMUSIC_FreeSong, "_FMUSIC_FreeSong@4"); - F_GETPROC(FMUSIC_PlaySong, "_FMUSIC_PlaySong@4"); - F_GETPROC(FMUSIC_StopSong, "_FMUSIC_StopSong@4"); - F_GETPROC(FMUSIC_StopAllSongs, "_FMUSIC_StopAllSongs@0"); - F_GETPROC(FMUSIC_SetZxxCallback, "_FMUSIC_SetZxxCallback@8"); - F_GETPROC(FMUSIC_SetRowCallback, "_FMUSIC_SetRowCallback@12"); - F_GETPROC(FMUSIC_SetOrderCallback, "_FMUSIC_SetOrderCallback@12"); - F_GETPROC(FMUSIC_SetInstCallback, "_FMUSIC_SetInstCallback@12"); - F_GETPROC(FMUSIC_SetSample, "_FMUSIC_SetSample@12"); - F_GETPROC(FMUSIC_SetUserData, "_FMUSIC_SetUserData@8"); - F_GETPROC(FMUSIC_OptimizeChannels, "_FMUSIC_OptimizeChannels@12"); - F_GETPROC(FMUSIC_SetReverb, "_FMUSIC_SetReverb@4"); - F_GETPROC(FMUSIC_SetLooping, "_FMUSIC_SetLooping@8"); - F_GETPROC(FMUSIC_SetOrder, "_FMUSIC_SetOrder@8"); - F_GETPROC(FMUSIC_SetPaused, "_FMUSIC_SetPaused@8"); - F_GETPROC(FMUSIC_SetMasterVolume, "_FMUSIC_SetMasterVolume@8"); - F_GETPROC(FMUSIC_SetMasterSpeed, "_FMUSIC_SetMasterSpeed@8"); - F_GETPROC(FMUSIC_SetPanSeperation, "_FMUSIC_SetPanSeperation@8"); - F_GETPROC(FMUSIC_GetName, "_FMUSIC_GetName@4"); - F_GETPROC(FMUSIC_GetType, "_FMUSIC_GetType@4"); - F_GETPROC(FMUSIC_GetNumOrders, "_FMUSIC_GetNumOrders@4"); - F_GETPROC(FMUSIC_GetNumPatterns, "_FMUSIC_GetNumPatterns@4"); - F_GETPROC(FMUSIC_GetNumInstruments, "_FMUSIC_GetNumInstruments@4"); - F_GETPROC(FMUSIC_GetNumSamples, "_FMUSIC_GetNumSamples@4"); - F_GETPROC(FMUSIC_GetNumChannels, "_FMUSIC_GetNumChannels@4"); - F_GETPROC(FMUSIC_GetSample, "_FMUSIC_GetSample@8"); - F_GETPROC(FMUSIC_GetPatternLength, "_FMUSIC_GetPatternLength@8"); - F_GETPROC(FMUSIC_IsFinished, "_FMUSIC_IsFinished@4"); - F_GETPROC(FMUSIC_IsPlaying, "_FMUSIC_IsPlaying@4"); - F_GETPROC(FMUSIC_GetMasterVolume, "_FMUSIC_GetMasterVolume@4"); - F_GETPROC(FMUSIC_GetGlobalVolume, "_FMUSIC_GetGlobalVolume@4"); - F_GETPROC(FMUSIC_GetOrder, "_FMUSIC_GetOrder@4"); - F_GETPROC(FMUSIC_GetPattern, "_FMUSIC_GetPattern@4"); - F_GETPROC(FMUSIC_GetSpeed, "_FMUSIC_GetSpeed@4"); - F_GETPROC(FMUSIC_GetBPM, "_FMUSIC_GetBPM@4"); - F_GETPROC(FMUSIC_GetRow, "_FMUSIC_GetRow@4"); - F_GETPROC(FMUSIC_GetPaused, "_FMUSIC_GetPaused@4"); - F_GETPROC(FMUSIC_GetTime, "_FMUSIC_GetTime@4"); - F_GETPROC(FMUSIC_GetRealChannel, "_FMUSIC_GetRealChannel@8"); - F_GETPROC(FMUSIC_GetUserData, "_FMUSIC_GetUserData@4"); - - return instance; -} - -static void FMOD_FreeInstance(FMOD_INSTANCE *instance) -{ - if (instance) - { - if (instance->module) - { -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - FreeLibrary((HMODULE)instance->module); -#else - dlclose(instance->module); -#endif - } - free(instance); - } -} - -#endif diff --git a/tools/gdbst03/Makefile b/tools/gdbst03/Makefile deleted file mode 100644 index 5279e5b55..000000000 --- a/tools/gdbst03/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# Makefile for GDB Stub for DJGPP/Mingw 0.3 source distribution -# -# Copyright 2000 by Jonathan Brogdon -# - -include Makefile.cfg - -default: - @$(ECHO) Welcome to GDB Stub for DJGPP & Mingw 0.3 source distribution! - @$(ECHO) To make the GDB stub type: - @$(ECHO) make all - Make library and demo programs - @$(ECHO) make library - Make only library - @$(ECHO) make demo - Make demo program - @$(ECHO) make install - Install library and header files - @$(ECHO) make uninstall - Uninstall library and header files - @$(ECHO) make clean - Remove .o files - @$(ECHO) make distclean - Remove ready binaries and .o files - @$(ECHO) make dep - Make dependences - -# Inform make of phony targets -.PHONY: library demo clean blankdep dep distclean install - -all: dep library demo - @$(ECHO) Library and demo program created - -./lib/libgdbst.a: - @mkdir -p lib - @make -s -C ./src/library all - -library: ./lib/libgdbst.a - @$(ECHO) Library created - -demo: ./lib/libgdbst.a - @mkdir -p demo - @make -s -C ./src/demo all - @$(ECHO) Demo program created - -clean: - @make -s -C ./src/library clean - @make -s -C ./src/demo clean - @$(ECHO) Clean complete - -blankdep: -# Create blank depend.dep files to avoid errors - @$(ECHOBLANK) > ./src/library/depend.dep - @$(ECHOBLANK) > ./src/demo/depend.dep - -# Now carry on as usual -dep: blankdep - @make -s -C ./src/library dep - @make -s -C ./src/demo dep - @$(ECHO) Created dependency files - -# Blank all the dependencies too -distclean: blankdep - @make -s -C ./src/library distclean - @make -s -C ./src/demo distclean - @$(RM) -r ./demo/ - @$(RM) -r ./lib/ - @$(ECHO) Cleaned up files - -install: library -ifdef DJGPP - @cp lib/*.a $(DJDIR)/lib - @ginstall -d $(DJDIR)/include - @cp include/*.h $(DJDIR)/include - @$(ECHO) GDB Stub Library for DJGPP installed -endif - -uninstall: -ifdef DJGPP - @$(RM) $(DJDIR)/lib/libgdb.a - @$(RM) $(DJDIR)/include/i386-stub.h - @$(ECHO) GDB Stub Library for DJGPP uninstalled -ifdef DJGPP - - - - - - - diff --git a/tools/gdbst03/announce b/tools/gdbst03/announce deleted file mode 100644 index ac976b644..000000000 --- a/tools/gdbst03/announce +++ /dev/null @@ -1,27 +0,0 @@ -GDB Stub for DJGPP 0.1 Announcement -=================================== - -GDB Stub for DJGPP Copyright 2000 by Jonathan Brogdon - -Hello. - - I'd like to announce the GDB Stub for DJGPP for DJGPP, the latest version of -a GDB stub for DJGPP targets. The GDB Stub for DJGPP conforms to the GNU GDB stub -interface as specified in the GDB User's Manual. It allows for debugging of a -DJGPP target remotely over a serial link with GDB. - - It comes with an example program for demonstrating remote debugging of -DJGPP targets, and documentation (man and HTML pages). - - The GDB Stub for DJGPP is distributed under the GNU Library General Public License -(LGPL). - - If you have any questions relating to libsocket, please mail me and I'll -be happy to help. - - Thanks, - - Jonathan Brogdon - - - June 29th 2000 diff --git a/tools/gdbst03/include/i386-stub.h b/tools/gdbst03/include/i386-stub.h deleted file mode 100644 index 092a3dfc6..000000000 --- a/tools/gdbst03/include/i386-stub.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - * - * i386-stub.h - * - * Description: Data definitions and constants for low level - * GDB server support. - * - * Terms of use: This software is provided for use under the terms - * and conditions of the GNU General Public License. - * You should have received a copy of the GNU General - * Public License along with this program; if not, write - * to the Free Software Foundation, Inc., 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. - * - * Credits: Created by Jonathan Brogdon - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 20000617 Genesis - * Gordon Schumacher 20020212 Updated for modularity - * - ****************************************************************************/ -#ifndef _GDBSTUB_H_ -#define _GDBSTUB_H_ - - -#ifdef __cplusplus -extern "C" { -#endif -extern int gdb_serial_init(unsigned int port, unsigned int speed); -extern void gdb_target_init(void); -extern void gdb_target_close(void); - -extern void set_debug_traps(void); -extern void restore_traps(void); -extern void breakpoint(void); -#ifdef __cplusplus -} -#endif - - -#endif /* _GDBSTUB_H_ */ diff --git a/tools/gdbst03/install b/tools/gdbst03/install deleted file mode 100644 index b92c39c04..000000000 --- a/tools/gdbst03/install +++ /dev/null @@ -1,20 +0,0 @@ -The makefile contains the information about the target products -available. - -Note: Makefile.cfg contains macros for various tools used during -the build process. Of particular note: some folks use the echo.exe -that is available from the DJGPP (or other) site(s). Others may not -have installed this, and therefore calls to echo during the build -will use the built-in DOS echo command. When attempting to echo a -blank line, the arguments to these two echo commands are different. -Therefore, makefile.cfg contains the macro ECHOBLANK. Please set -this macro according to the needs of your environment. If you change -this in makefile.cfg, it will be picked up by all other project -makefiles. - -Type 'make' to see a list of targets. When the 'install' -target is made, the libgdb.a will be copied into your $(DJDIR)/lib -directory. In addition, the i386-stub.h file will be copied into -your $(DJDIR)/include directory. The uninstall target will remove -these files. - diff --git a/tools/gdbst03/license b/tools/gdbst03/license deleted file mode 100644 index 4356f26ed..000000000 --- a/tools/gdbst03/license +++ /dev/null @@ -1,454 +0,0 @@ - -GNU LIBRARY GENERAL PUBLIC LICENSE -********************************** - - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - [This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - -Preamble -======== - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it in -new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License, which was designed for utility -programs. This license, the GNU Library General Public License, -applies to certain designated libraries. This license is quite -different from the ordinary one; be sure to read it in full, and don't -assume that anything in it is the same as in the ordinary license. - - The reason we have a separate public license for some libraries is -that they blur the distinction we usually make between modifying or -adding to a program and simply using it. Linking a program with a -library, without changing the library, is in some sense simply using -the library, and is analogous to running a utility program or -application program. However, in a textual and legal sense, the linked -executable is a combined work, a derivative of the original library, -and the ordinary General Public License treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended -to permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to -achieve this as regards changes in header files, but we have achieved -it as regards changes in the actual functions of the Library.) The -hope is that this will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which - contains a notice placed by the copyright holder or other - authorized party saying it may be distributed under the terms of - this Library General Public License (also called "this License"). - Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data - prepared so as to be conveniently linked with application programs - (which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work - which has been distributed under these terms. A "work based on the - Library" means either the Library or any derivative work under - copyright law: that is to say, a work containing the Library or a - portion of it, either verbatim or with modifications and/or - translated straightforwardly into another language. (Hereinafter, - translation is included without limitation in the term - "modification".) - - "Source code" for a work means the preferred form of the work for - making modifications to it. For a library, complete source code - means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to - control compilation and installation of the library. - - Activities other than copying, distribution and modification are - not covered by this License; they are outside its scope. The act - of running a program using the Library is not restricted, and - output from such a program is covered only if its contents - constitute a work based on the Library (independent of the use of - the Library in a tool for writing it). Whether that is true - depends on what the Library does and what the program that uses - the Library does. - - 1. You may copy and distribute verbatim copies of the Library's - complete source code as you receive it, in any medium, provided - that you conspicuously and appropriately publish on each copy an - appropriate copyright notice and disclaimer of warranty; keep - intact all the notices that refer to this License and to the - absence of any warranty; and distribute a copy of this License - along with the Library. - - You may charge a fee for the physical act of transferring a copy, - and you may at your option offer warranty protection in exchange - for a fee. - - 2. You may modify your copy or copies of the Library or any portion - of it, thus forming a work based on the Library, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a. The modified work must itself be a software library. - - b. You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c. You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d. If a facility in the modified Library refers to a function or - a table of data to be supplied by an application program that - uses the facility, other than as an argument passed when the - facility is invoked, then you must make a good faith effort - to ensure that, in the event an application does not supply - such function or table, the facility still operates, and - performs whatever part of its purpose remains meaningful. - - (For example, a function in a library to compute square roots - has a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function - must be optional: if the application does not supply it, the - square root function must still compute square roots.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the - Library, and can be reasonably considered independent and separate - works in themselves, then this License, and its terms, do not - apply to those sections when you distribute them as separate - works. But when you distribute the same sections as part of a - whole which is a work based on the Library, the distribution of - the whole must be on the terms of this License, whose permissions - for other licensees extend to the entire whole, and thus to each - and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or - contest your rights to work written entirely by you; rather, the - intent is to exercise the right to control the distribution of - derivative or collective works based on the Library. - - In addition, mere aggregation of another work not based on the - Library with the Library (or with a work based on the Library) on - a volume of a storage or distribution medium does not bring the - other work under the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public - License instead of this License to a given copy of the Library. - To do this, you must alter all the notices that refer to this - License, so that they refer to the ordinary GNU General Public - License, version 2, instead of to this License. (If a newer - version than version 2 of the ordinary GNU General Public License - has appeared, then you can specify that version instead if you - wish.) Do not make any other change in these notices. - - Once this change is made in a given copy, it is irreversible for - that copy, so the ordinary GNU General Public License applies to - all subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of - the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or - derivative of it, under Section 2) in object code or executable - form under the terms of Sections 1 and 2 above provided that you - accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software - interchange. - - If distribution of object code is made by offering access to copy - from a designated place, then offering equivalent access to copy - the source code from the same place satisfies the requirement to - distribute the source code, even though third parties are not - compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the - Library, but is designed to work with the Library by being - compiled or linked with it, is called a "work that uses the - Library". Such a work, in isolation, is not a derivative work of - the Library, and therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library - creates an executable that is a derivative of the Library (because - it contains portions of the Library), rather than a "work that - uses the library". The executable is therefore covered by this - License. Section 6 states terms for distribution of such - executables. - - When a "work that uses the Library" uses material from a header - file that is part of the Library, the object code for the work may - be a derivative work of the Library even though the source code is - not. Whether this is true is especially significant if the work - can be linked without the Library, or if the work is itself a - library. The threshold for this to be true is not precisely - defined by law. - - If such an object file uses only numerical parameters, data - structure layouts and accessors, and small macros and small inline - functions (ten lines or less in length), then the use of the object - file is unrestricted, regardless of whether it is legally a - derivative work. (Executables containing this object code plus - portions of the Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may - distribute the object code for the work under the terms of Section - 6. Any executables containing that work also fall under Section 6, - whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or - link a "work that uses the Library" with the Library to produce a - work containing portions of the Library, and distribute that work - under terms of your choice, provided that the terms permit - modification of the work for the customer's own use and reverse - engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the - Library is used in it and that the Library and its use are covered - by this License. You must supply a copy of this License. If the - work during execution displays copyright notices, you must include - the copyright notice for the Library among them, as well as a - reference directing the user to the copy of this License. Also, - you must do one of these things: - - a. Accompany the work with the complete corresponding - machine-readable source code for the Library including - whatever changes were used in the work (which must be - distributed under Sections 1 and 2 above); and, if the work - is an executable linked with the Library, with the complete - machine-readable "work that uses the Library", as object code - and/or source code, so that the user can modify the Library - and then relink to produce a modified executable containing - the modified Library. (It is understood that the user who - changes the contents of definitions files in the Library will - not necessarily be able to recompile the application to use - the modified definitions.) - - b. Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. - - c. If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the - above specified materials from the same place. - - d. Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the - Library" must include any data and utility programs needed for - reproducing the executable from it. However, as a special - exception, the source code distributed need not include anything - that is normally distributed (in either source or binary form) - with the major components (compiler, kernel, and so on) of the - operating system on which the executable runs, unless that - component itself accompanies the executable. - - It may happen that this requirement contradicts the license - restrictions of other proprietary libraries that do not normally - accompany the operating system. Such a contradiction means you - cannot use both them and the Library together in an executable - that you distribute. - - 7. You may place library facilities that are a work based on the - Library side-by-side in a single library together with other - library facilities not covered by this License, and distribute - such a combined library, provided that the separate distribution - of the work based on the Library and of the other library - facilities is otherwise permitted, and provided that you do these - two things: - - a. Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b. Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same - work. - - 8. You may not copy, modify, sublicense, link with, or distribute the - Library except as expressly provided under this License. Any - attempt otherwise to copy, modify, sublicense, link with, or - distribute the Library is void, and will automatically terminate - your rights under this License. However, parties who have - received copies, or rights, from you under this License will not - have their licenses terminated so long as such parties remain in - full compliance. - - 9. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify - or distribute the Library or its derivative works. These actions - are prohibited by law if you do not accept this License. - Therefore, by modifying or distributing the Library (or any work - based on the Library), you indicate your acceptance of this - License to do so, and all its terms and conditions for copying, - distributing or modifying the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the - Library), the recipient automatically receives a license from the - original licensor to copy, distribute, link with or modify the - Library subject to these terms and conditions. You may not impose - any further restrictions on the recipients' exercise of the rights - granted herein. You are not responsible for enforcing compliance - by third parties to this License. - - 11. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent - issues), conditions are imposed on you (whether by court order, - agreement or otherwise) that contradict the conditions of this - License, they do not excuse you from the conditions of this - License. If you cannot distribute so as to satisfy simultaneously - your obligations under this License and any other pertinent - obligations, then as a consequence you may not distribute the - Library at all. For example, if a patent license would not permit - royalty-free redistribution of the Library by all those who - receive copies directly or indirectly through you, then the only - way you could satisfy both it and this License would be to refrain - entirely from distribution of the Library. - - If any portion of this section is held invalid or unenforceable - under any particular circumstance, the balance of the section is - intended to apply, and the section as a whole is intended to apply - in other circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of - any such claims; this section has the sole purpose of protecting - the integrity of the free software distribution system which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is - willing to distribute software through any other system and a - licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed - to be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in - certain countries either by patents or by copyrighted interfaces, - the original copyright holder who places the Library under this - License may add an explicit geographical distribution limitation - excluding those countries, so that distribution is permitted only - in or among countries not thus excluded. In such case, this - License incorporates the limitation as if written in the body of - this License. - - 13. The Free Software Foundation may publish revised and/or new - versions of the Library General Public License from time to time. - Such new versions will be similar in spirit to the present version, - but may differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the - Library specifies a version number of this License which applies - to it and "any later version", you have the option of following - the terms and conditions either of that version or of any later - version published by the Free Software Foundation. If the Library - does not specify a license version number, you may choose any - version ever published by the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free - programs whose distribution conditions are incompatible with these, - write to the author to ask for permission. For software which is - copyrighted by the Free Software Foundation, write to the Free - Software Foundation; we sometimes make exceptions for this. Our - decision will be guided by the two goals of preserving the free - status of all derivatives of our free software and of promoting - the sharing and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE - LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT - HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT - WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE - QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE - LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY - SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY - MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE - LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, - INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR - INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF - DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU - OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY - OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - diff --git a/tools/gdbst03/makefile.cfg b/tools/gdbst03/makefile.cfg deleted file mode 100644 index 4265258a7..000000000 --- a/tools/gdbst03/makefile.cfg +++ /dev/null @@ -1,67 +0,0 @@ -# -# Makefile.cfg for GDB stub for DJGPP and Mingw -# -# libgdbst Copyright 2000 by Jonathan Brogodn -# - -# -# GNU compiler & tools' flags -# -CC = gcc -CFLAGS = -Wall -Werror -march=i486 -O2 -g - -# Archiver -AR = ar -ARFLAGS = -r - -# Stripper -STRIP = strip - -# Assembler -AS = as -ASFLAGS = - -# Linker -LD = ld -LDFLAGS = - -# Remove -RM = rm -f - -# Echo -ECHO = echo - -# Echo Blank -#ECHOBLANK = echo "" -ECHOBLANK = echo. - -# -# check for OS... badly -# - -ifndef DJDIR -ifndef DJGPP - WINDOWS=1 -endif -endif - -ifndef windir -ifndef WINDOWS - DJGPP=1 -endif -endif - -# -# Rules -# -.SUFFIXES: .c .asm .o - -.asm.o: - @$(CC) $(CFLAGS) -I$(INC_PATH) -c -o ./$@ ./$< - -.s.o: - @$(AS) $(ASFLAGS) ./$< - -.c.o : - @$(CC) $(CFLAGS) -c -I$(INC_PATH) -c -o ./$@ ./$< - diff --git a/tools/gdbst03/readme b/tools/gdbst03/readme deleted file mode 100644 index 316e61cae..000000000 --- a/tools/gdbst03/readme +++ /dev/null @@ -1,171 +0,0 @@ -GDB Stub for DJGPP 0.2 Readme File -================================== - -Copyright ---------- -GDB Stub for DJGPP is distributed under the terms of the GNU Library -General Public License (GNU LGPL) - please see the document LICENSE, -which should be found in the same directory as this file. - -Copyright (c) 2000 by Jonathan Brogdon, 2002 by Gordon Schumacher - -What It Does ------------- -The GDB stub is used to debug a DJGPP target remotely over a one of -the PC COM ports. GDB, running on a host machine, communicates with -the target using the GDB serial protocol over the serial link. For -more information on the GDB stub, see "Debugging with GDB, The GNU -Source-Level Debugger", by Richard M. Stallman and Roland H. Pesch -(http://sources.redhat.com/gdb/download/onlinedocs/gdb.html) - -How It Works ------------- - -Exceptions: - -The GDB stub needs to handle all processor exceptions. Since these -exceptions already handled by DJGPP, we cannot handle them directly. -DJGPP maps all processor exceptions to signals. Therefore, we can -install the GDB stub handler as the signal handler for those signals -that represent processor exceptions. The following table shows the -processor exception to signal mapping: - - Exception/Interrupt: Exception #: Signal: - ------------------- ----------- ------ - Divide Error 0 SIGFPE - Debug Exception 1 SIGTRAP - NMI Interrupt 2 No signal defined - Breakpoint 3 SIGTRAP - INTO-detected overflow 4 SIGFPE - BOUND Range Exceeded 5 SIGSEGV - Invalid Opcode 6 No signal defined - Coprocessor not available 7 SIGNOFP - Double Fault 8 SIGSEGV - Coprocessor Seg overrun 9 SIGSEGV - Invalid Task State Seg 10 No signal defined - Segment not present 11 SIGSEGV - Stack Fault 12 SIGSEGV - General Protection Fault 13 SIGSEGV - Page Fault 14 SIGSEGV - Intel Reserved 15 No signal defined - Coprocessor Error 16 SIGFPE - -The GDB stub handler services requests from the GDB host. These -requests are seen by the GDB stub handler as command messages from -the GDB host. These commands and command formats are defined in -"Debugging with GDB, The GNU Source-Level Debugger", by Richard M. -Stallman and Roland H. Pesch (http://sources.redhat.com/gdb/ -download/onlinedocs/gdb.html -- one of many sources). - -Serial Interface: - -Interface functions for sending and receiving characters from the -serial interface must be provided by the engineer porting the GDB -stub. The following funtions must be provided to support the -implementation. - - int getDebugChar(void); - void putDebugChar(int c); - -There are a variety of serial libraries for DJGPP. The user may -already be using one of these libraries in their application, and -installing more than one serial library often causes conflicts. -To this end, a modular function layer was written that allows any -serial library to be used with the GDB stub. Layers have been -written to support SVAsync, DZComm, and the _bios_serialcom() -function. At the time of this writing, DZComm appears to work the -best for serial debugging. - -Hard Coded Breakpoint: - -A breakpoint() function is provided to manually invoke the stub. -This function, inserts a breakpoint instruction directly in the code -to invoke the GDB stub handler. - -How You Use It --------------- -First, you need to select a serial library. In the i386-supp.c file, -there are lines of the form - - // #include "some_layer.h" - -Uncomment the line for the serial library you intend to use - or add -a new include line for a file written for some other library. -In the main() function of your target program, you should initilize -the GDB serial handlers and the GDB stub. The following functions -are provided in the GDB stub library for this purpose. - - gdb_serial_init(unsigned int port, unsigned int speed); - gdb_target_init(void); - -Where, port is the COM port number, and speed is the baud rate for -the serial link. - -After initialing the GDB serial interface and target, you should -invoke the breakpoint() function somewhere. You may choose to do -this immediately after initialization, or at a specific location in -your code where you wish to set a breakpoint. By putting the -breakpoint() function in the beginning of main(), you can use the -GDB host to set a breakpoint at any place in your code. - -Make sure that you use the '-g' option when compiling your files with -gcc. - -After the target executable is running, start up gdb on the host, -passing the target executable as an argument. - - Example: gdb demo.exe - -Now, tell gdb which serial interface to use for communicating to -the target. - - Example: (gdb) target remote COM1 - -This example uses COM1 on the host to communicate with the target. -GDB is now 'listening' on COM for a valid GDB serial packet. - -Once your GDB host finds your target, you may need to tell GDB where -to find any source files which were used to generate your program. -Use the directory command to do this. - - Example: (gdb) directory ../src/demo - -That's it. You should now be able to single step through code, set -breakpoints, set variables, examine variables, any anthing else that -you would normally use GDB to accomplish. - -What You Build --------------- -Read the INSTALL file for more information on installing the GDB stub -library. After installing the library, your code should include -i386-stub.h for function prototypes. In addition, your code should -link against the libgdb.a library. The source for a demonstration -program has been included with this distributias an example. -As an alternative, you can simply include the i386-stub and i386-supp -files and the layer header for the serial library you plan to use into -your project and link them in directly. - -For More Info -------------- -See "Debugging with GDB, The GNU Source-Level Debugger", by Richard -M. Stallman and Roland H. Pesch (http://sources.redhat.com/gdb/ -download/onlinedocs/gdb.html -- one of many sources). - -TODO ----- -Port for network operation. - -Contact Info ------------- -My contact info is below. If you have any comments, suggestions, bug -reports or problems, please mail me, and I'll see what I can do. - - Regards, - Jonathan Brogdon - - 6th June 2000 - - Modular update: - Gordon Schumacher - - 12th February 2002 \ No newline at end of file diff --git a/tools/gdbst03/src/demo/crc_16.c b/tools/gdbst03/src/demo/crc_16.c deleted file mode 100644 index ad1f53cd1..000000000 --- a/tools/gdbst03/src/demo/crc_16.c +++ /dev/null @@ -1,46 +0,0 @@ -#define POLY 0x8408 -/* -// 16 12 5 -// this is the CCITT CRC 16 polynomial X + X + X + 1. -// This works out to be 0x1021, but the way the algorithm works -// lets us use 0x8408 (the reverse of the bit pattern). The high -// bit is always assumed to be set, thus we only use 16 bits to -// represent the 17 bit value. -*/ - -#include "crc.h" - -WORD crc16(char *data_p, WORD length) -{ - unsigned char i; - unsigned int data; - unsigned int crc = 0xffff; - - if (length == 0) - return (~crc); - - do - { - for (i=0, data=(unsigned int)0xff & *data_p++; - i < 8; - i++, data >>= 1) - { - if ((crc & 0x0001) ^ (data & 0x0001)) - crc = (crc >> 1) ^ POLY; - else crc >>= 1; - } - } while (--length); - - crc = ~crc; - data = crc; - crc = (crc << 8) | ((data >> 8) & 0xff); - - return (crc); -} - - - - - - - diff --git a/tools/gdbst03/src/demo/makefile b/tools/gdbst03/src/demo/makefile deleted file mode 100644 index ab48954b2..000000000 --- a/tools/gdbst03/src/demo/makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# Makefile for GDB Stub demo -# Written by Jonathan Brogodn -# -# GDB Stub for DJGPP Copyright 2000 by Jonathan Brogdon -# - -include ../../Makefile.cfg - -CFLAGS += -g -CFLAGS += -I../../include -I../include -I. -CFLAGS += -DDEBUG_COM_PORT=1 -CFLAGS += -DDEBUG_COM_PORT_SPEED=9600 -CFLAGS += -DREMOTE_DEBUGGING - -# Objects to build -OBJS = serdbg.o crc_16.o - -all: demo - -demo: $(OBJS) -ifdef DJGPP - @$(LD) $(LDFLAGS) -Map ./$@.map -o../../demo/$@.exe $(DJDIR)/lib/crt0.o $(OBJS) -L$(DJDIR)/lib -L../../lib -lgdbst -ldzcom -lc -lgcc -endif -ifdef WINDOWS - @$(LD) $(LDFLAGS) -Map ./$@.map -o../../demo/$@.exe $(DJDIR)/lib/crt0.o $(OBJS) -L../../lib -lgdbst -lwsock32 -lc -lgcc -endif - -clean: - @$(RM) $(OBJS) - @$(RM) *.map - -distclean: clean - @$(RM) $(OBJS) - @$(RM) depend.dep - @$(RM) ../../demo/*.exe - -dep: - @$(CC) $(CFLAGS) -M *.c > depend.dep - -$(OBJS): -include depend.dep diff --git a/tools/gdbst03/src/demo/serdbg.c b/tools/gdbst03/src/demo/serdbg.c deleted file mode 100644 index 01778789c..000000000 --- a/tools/gdbst03/src/demo/serdbg.c +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************************** - * serdbg.c - * - * Description: Pretty simple demonstration program. It accomplishes - * the following. - * - * 1. Allocate a block of memory Feel free to change - * size (memBlockSize) with debugger. - * - * 2. Writes a word pattern to the entire block. Feel - * free to change the pattern (memPatternWord) with - * debugger. - * - * 3. Computes the CRC-16 on the block. Feel free to - * check the size with the debuger. - * - * 4. Free the memory block allocated in step 1. Repeat - * step 1. If you wish to exit, set doneFlag to 0 with - * the debugger. - * - * Credits: Created by Jonathan Brogdon - * - * Terms of use: Use as you will. - * - * Global Data: None. - * Global Functions: main - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 070500 Genesis - * - ***********************************************************************/ -#include -#include -#include -#include - -#define MEM_BLOCK_SIZE 100 /* Words */ -#define MEM_PATTERN_WORD 0x55AA - -void write_mem_pattern(unsigned short*, unsigned short, unsigned short); - -/************************************************************************ - * - * main() - * - ************************************************************************/ -int main(int argc, char *argv[]) -{ - volatile int doneFlag = 0; - unsigned short crcValue = 0; - unsigned short * memBlockPtr = NULL; - short memBlockSize = MEM_BLOCK_SIZE; - short memPatternWord = MEM_PATTERN_WORD; - -#ifdef REMOTE_DEBUGGING - /* Only setup if demonstrating remote debugging */ - gdb_serial_init(DEBUG_COM_PORT,DEBUG_COM_PORT_SPEED); - gdb_target_init(); - breakpoint(); -#endif - - while(doneFlag != 1) - { - memBlockSize = MEM_BLOCK_SIZE; - memPatternWord = MEM_PATTERN_WORD; - memBlockPtr = (unsigned short *) malloc((int)memBlockSize); - - write_mem_pattern(memBlockPtr, memBlockSize, memPatternWord); - - crcValue = crc16((char *)memBlockPtr,memBlockSize); - - free(memBlockPtr); - } - - exit(0); -} - -/************************************************************************ - * - * write_mem_pattern() - * - * Description: Writes a word pattern to a block of RAM. - * - ************************************************************************/ -void write_mem_pattern(unsigned short *block, unsigned short blockSize, unsigned short patternWord) -{ - int index = 0; - - for(index = 0; index < blockSize; index++) - { - block[index] = patternWord; - } -} - - - - - - - diff --git a/tools/gdbst03/src/include/crc.h b/tools/gdbst03/src/include/crc.h deleted file mode 100644 index 937d0b794..000000000 --- a/tools/gdbst03/src/include/crc.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * CRC.H - header file for CRC functions - */ - -#ifndef _CRC_H_ -#define _CRC_H_ - -#include /* For size_t */ - -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; - -/* -** File: CRC-16.C -*/ - -WORD crc16(char *data_p, WORD length); - -#endif /* _CRC_H_ */ diff --git a/tools/gdbst03/src/include/i386-supp.h b/tools/gdbst03/src/include/i386-supp.h deleted file mode 100644 index e1923377c..000000000 --- a/tools/gdbst03/src/include/i386-supp.h +++ /dev/null @@ -1,30 +0,0 @@ -/**************************************************************************** - * - * i386-supp.h - * - * Description: Data definitions and constants for low level - * GDB stub support. - * - * Terms of use: This software is provided for use under the terms - * and conditions of the GNU General Public License. - * You should have received a copy of the GNU General - * Public License along with this program; if not, write - * to the Free Software Foundation, Inc., 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. - * - * Credits: Created by Jonathan Brogdon - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 20000629 Genesis - * Gordon Schumacher 20020212 Updated for modularity - * - ****************************************************************************/ -#ifndef _GDBSUPP_H_ -#define _GDBSUPP_H_ - -extern int putDebugChar(char c); -extern int getDebugChar(void); - -#endif /* _GDBSUPP_H_ */ diff --git a/tools/gdbst03/src/library/bios_layer.h b/tools/gdbst03/src/library/bios_layer.h deleted file mode 100644 index 946f40997..000000000 --- a/tools/gdbst03/src/library/bios_layer.h +++ /dev/null @@ -1,137 +0,0 @@ -//======================================================================================================= -// bios_layer.h - Serial command layer for standard BIOS calls -// It's here if you want it, but I wouldn't suggest it... -//======================================================================================================= - -//======================================================================================================= -//======================================================================================================= - -#ifndef _BIOS_LAYER_H -#define _BIOS_LAYER_H - - -//=============================================================================== -// Include files -//=============================================================================== - -#include - -//=============================================================================== -// Static variable definitions -//=============================================================================== - -unsigned comport; - -//=============================================================================== -// Inline function definitions -//=============================================================================== - -#define BIOS_SER_TIMEOUT 1000000 - -// Initialize the serial library -// Should return 0 if no error occurred -__inline int GDBStub_SerInit(int port) -{ - comport = (unsigned) port; - return 0; -} - - -// Set the serial port speed (and other configurables) -// Should return 0 if the speed is set properly -__inline int GDBStub_SerSpeed(int speed) -{ - unsigned bps; - - switch (speed) - { - case 110: - bps = _COM_110; - break; - - case 150: - bps = _COM_150; - break; - - case 300: - bps = _COM_300; - break; - - case 600: - bps = _COM_600; - break; - - case 1200: - bps = _COM_1200; - break; - - case 2400: - bps = _COM_2400; - break; - - case 4800: - bps = _COM_4800; - break; - - case 9600: - default: - bps = _COM_9600; - break; - } - - _bios_serialcom(_COM_INIT, comport, - bps | _COM_NOPARITY | _COM_CHR8 | _COM_STOP1); - return 0; -} - - -// Check to see if there's room in the buffer to send data -// Should return 0 if it is okay to send -__inline int GDBStub_SerSendOk(void) -{ - return 0; -} - - -// Send a character to the serial port -// Should return 0 if the send succeeds -__inline int GDBStub_SerSend(int c) -{ - register int ret; - register int timeout = 0; - - do - { - ret = _bios_serialcom(_COM_SEND, comport, (unsigned) c); - } while((ret != 0) && (timeout++ < BIOS_SER_TIMEOUT)); - return (timeout >= BIOS_SER_TIMEOUT); -} - - -// Check to see if there are characters waiting in the buffer -// Should return 0 if there's data waiting -__inline int GDBStub_SerRecvOk(void) -{ - return 0; -} - - -// Read a character from the serial port -// Should return the character read -__inline int GDBStub_SerRecv(void) -{ - register int data; - register int timeout = 0; - - do - { - data = _bios_serialcom(_COM_RECEIVE, comport, 0) & 0xff; - } while((data > 0xff) && (timeout++ < BIOS_SER_TIMEOUT)); - - return data; -} - - - - -#endif diff --git a/tools/gdbst03/src/library/dzc_layer.h b/tools/gdbst03/src/library/dzc_layer.h deleted file mode 100644 index cc083077f..000000000 --- a/tools/gdbst03/src/library/dzc_layer.h +++ /dev/null @@ -1,169 +0,0 @@ -//======================================================================================================= -// dzc_layer.h - Serial command layer for DZcomm -// -//======================================================================================================= - -//======================================================================================================= -//======================================================================================================= - -#ifndef _DZC_LAYER_H -#define _DZC_LAYER_H - - -//=============================================================================== -// Include files -//=============================================================================== - -#include - -//=============================================================================== -// Static variable definitions -//=============================================================================== - -comm_port *comport; - -//=============================================================================== -// Inline function definitions -//=============================================================================== - -// Initialize the serial library -// Should return 0 if no error occurred -__inline int GDBStub_SerInit(int port) -{ - int ret; - comm com; - - ret = dzcomm_init(); - if (ret != 0) - { - switch (port) - { - case 4: - com = _com4; - break; - - case 3: - com = _com3; - break; - - case 2: - com = _com2; - break; - - case 1: - default: - com = _com1; - break; - } - comport = comm_port_init(com); - } - return (ret == 0); -} - -// Set the serial port speed (and other configurables) -// Should return 0 if the speed is set properly -__inline int GDBStub_SerSpeed(int speed) -{ - baud_bits bps; - - switch (speed) - { - case 110: - bps = _110; - break; - - case 150: - bps = _150; - break; - - case 300: - bps = _300; - break; - - case 600: - bps = _600; - break; - - case 1200: - bps = _1200; - break; - - case 2400: - bps = _2400; - break; - - case 4800: - bps = _4800; - break; - - case 9600: - bps = _9600; - break; - - case 19200: - bps = _19200; - break; - - case 38400: - bps = _38400; - break; - - case 57600: - bps = _57600; - break; - - case 115200: - default: - bps = _115200; - break; - } - - comm_port_set_baud_rate(comport, bps); - comm_port_set_parity(comport, NO_PARITY); - comm_port_set_data_bits(comport, BITS_8); - comm_port_set_stop_bits(comport, STOP_1); - comm_port_set_flow_control(comport, RTS_CTS); - comm_port_install_handler(comport); - - return 0; -} - -// Check to see if there's room in the buffer to send data -// Should return 0 if it is okay to send -__inline int GDBStub_SerSendOk(void) -{ - return (comm_port_out_full(comport) == 0); -} - -// Send a character to the serial port -// Should return 0 if the send succeeds -__inline int GDBStub_SerSend(int c) -{ - return comm_port_out(comport, (unsigned char) c); -} - -// Check to see if there are characters waiting in the buffer -// Should return 0 if there's data waiting -__inline int GDBStub_SerRecvOk(void) -{ - return (comm_port_in_empty(comport) == 0); -} - -// Read a character from the serial port -// Should return the character read -__inline int GDBStub_SerRecv(void) -{ - return comm_port_test(comport); -} - - - - -#endif - -/*================================================================== - - $Log: $ - - -===============================================================*/ diff --git a/tools/gdbst03/src/library/i386-stub.c b/tools/gdbst03/src/library/i386-stub.c deleted file mode 100644 index 1ab2ceeeb..000000000 --- a/tools/gdbst03/src/library/i386-stub.c +++ /dev/null @@ -1,1555 +0,0 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for 386 by Jim Kingdon, Cygnus Support. - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - * The external function exceptionHandler() is - * used to attach a specific handler to a specific 386 vector number. - * It should use the same privilege level it runs at. It should - * install it as an interrupt gate so that interrupts are masked - * while the handler runs. - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include -#ifdef DJGPP -#include -#include -#include -#include -#endif //#ifdef DJGPP - - -/* - * - * external low-level support routines - */ - -extern void putDebugChar(); /* write a single character */ -extern int getDebugChar(); /* read and return a single char */ -#ifndef DJGPP -extern void exceptionHandler(); /* assign an exception handler */ -#endif - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound buffers - * at least NUMREGBYTES*2 are needed for register packets - */ -#define BUFMAX 400 - -/* - * boolean flag. != 0 means we've been initialized - */ -static char gdb_initialized; - -/* - * debug > 0 prints ill-formed commands in valid packets & checksum errors - */ -int remote_debug; - -/* - * Hexadecimal character string. - */ -#ifndef DJGPP -static const char hexchars[]="0123456789abcdef"; -#else -static char hexchars[]="0123456789abcdef"; -#endif - -/* - * Number of registers. -*/ -#define NUMREGS 16 - -/* - * Number of bytes of registers. -*/ -#define NUMREGBYTES (NUMREGS * 4) - -/* - * i386 Registers - */ -enum regnames {EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, - PC /* also known as eip */, - PS /* also known as eflags */, - CS, SS, DS, ES, FS, GS -}; - -/* - * Register storage buffer. - */ -static int registers[NUMREGS]; - -/* - * Address of a routine to RTE to if we get a memory fault. -*/ -#ifndef DJGPP -static void (*volatile mem_fault_routine) () = NULL; -#else -static void (*mem_fault_routine)() = NULL; -#endif - -/* I/O buffers */ -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; - -#if !(defined(DJGPP) || defined(_WIN32)) //MF -#define STACKSIZE 10000 -int remcomStack[STACKSIZE/sizeof(int)]; -static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; -#endif - -#ifdef DJGPP -static void lock_handler_data(void); -#endif //#ifdef DJGPP - -void _returnFromException (); - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void -return_to_prog (); - -/* Restore the program's registers (including the stack pointer, which - means we get the right stack and don't have to worry about popping our - return address and any stack frames and so on) and return. */ -asm(".text"); -asm(".globl _return_to_prog"); -asm("_return_to_prog:"); -asm(" movw _registers+44, %ss"); -asm(" movl _registers+16, %esp"); -asm(" movl _registers+4, %ecx"); -asm(" movl _registers+8, %edx"); -asm(" movl _registers+12, %ebx"); -asm(" movl _registers+20, %ebp"); -asm(" movl _registers+24, %esi"); -asm(" movl _registers+28, %edi"); -asm(" movw _registers+48, %ds"); -asm(" movw _registers+52, %es"); -asm(" movw _registers+56, %fs"); -asm(" movw _registers+60, %gs"); -asm(" movl _registers+36, %eax"); -asm(" pushl %eax"); /* saved eflags */ -asm(" movl _registers+40, %eax"); -asm(" pushl %eax"); /* saved cs */ -asm(" movl _registers+32, %eax"); -asm(" pushl %eax"); /* saved eip */ -asm(" movl _registers, %eax"); -/* use iret to restore pc and flags together so - that trace flag works right. */ -asm(" iret"); - -/* - * BREAKPOINT macro - */ -#ifdef _MSC_VER //MF -#define BREAKPOINT() __asm int 3; -#else -#define BREAKPOINT() asm(" int $3"); -#endif - -/* - * Store the error code here just in case the user cares. -*/ -int gdb_i386errcode; - -/* - * Store the vector number here (since GDB only gets the signal - * number through the usual means, and that's not very specific). - */ -#ifndef _WIN32 //MF -int gdb_i386vector = -1; -#endif // !_WIN32 - -#if defined(DJGPP) || defined(_WIN32) -static void handle_exception(int); -#endif - -#ifdef DJGPP - -/*********************************************************************** - * save_regs - * - * Description: Retreives the i386 registers as they were when the - * exception occurred. Registers are stored in the - * local static buffer. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void save_regs(void) -{ - registers[EAX] = (int) __djgpp_exception_state->__eax; - registers[ECX] = (int) __djgpp_exception_state->__ecx; - registers[EDX] = (int) __djgpp_exception_state->__edx; - registers[EBX] = (int) __djgpp_exception_state->__ebx; - registers[ESP] = (int) __djgpp_exception_state->__esp; - registers[EBP] = (int) __djgpp_exception_state->__ebp; - registers[ESI] = (int) __djgpp_exception_state->__esi; - registers[EDI] = (int) __djgpp_exception_state->__edi; - registers[PC] = (int) __djgpp_exception_state->__eip; - registers[PS] = (int) __djgpp_exception_state->__eflags; - registers[CS] = (int) __djgpp_exception_state->__cs; - registers[SS] = (int) __djgpp_exception_state->__ss; - registers[DS] = (int) __djgpp_exception_state->__ds; - registers[ES] = (int) __djgpp_exception_state->__es; - registers[FS] = (int) __djgpp_exception_state->__fs; - registers[GS] = (int) __djgpp_exception_state->__gs; -} -static void end_save_regs(void){} - -/*********************************************************************** - * set_regs - * - * Description: Restores i386 registers to the DJGPP register buffer. - * DJGPP exception handler will restore registers from - * it's buffer on exit from the handler. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void set_regs(void) -{ - __djgpp_exception_state->__eax = (unsigned long) registers[EAX]; - __djgpp_exception_state->__ecx = (unsigned long) registers[ECX]; - __djgpp_exception_state->__edx = (unsigned long) registers[EDX]; - __djgpp_exception_state->__ebx = (unsigned long) registers[EBX]; - __djgpp_exception_state->__esp = (unsigned long) registers[ESP]; - __djgpp_exception_state->__ebp = (unsigned long) registers[EBP]; - __djgpp_exception_state->__esi = (unsigned long) registers[ESI]; - __djgpp_exception_state->__edi = (unsigned long) registers[EDI]; - __djgpp_exception_state->__eip = (unsigned long) registers[PC]; - __djgpp_exception_state->__eflags = (unsigned long) registers[PS]; - __djgpp_exception_state->__cs = (unsigned long) registers[CS]; - __djgpp_exception_state->__ss = (unsigned long) registers[SS]; - __djgpp_exception_state->__ds = (unsigned long) registers[DS]; - __djgpp_exception_state->__es = (unsigned long) registers[ES]; - __djgpp_exception_state->__fs = (unsigned long) registers[FS]; - __djgpp_exception_state->__gs = (unsigned long) registers[GS]; -} -static void end_set_regs(void){} - -/*********************************************************************** - * sigsegv_handler - * - * Description: Handles SIGSEGV signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigsegv_handler(int except_num){ - - /* Save general purpose registers */ - save_regs(); - - /* Dispatch memory fault handling routine if one is registered. */ - if(mem_fault_routine != 0) - { - (*mem_fault_routine)(); - mem_fault_routine = NULL; - } - else - { - /* Save error code */ - gdb_i386errcode = __djgpp_exception_state->__sigmask & 0xffff; - - /* Call the general exception handler */ - handle_exception(except_num); - } - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigsegv_handler(void){} - -/*********************************************************************** - * sigfpe_handler - * - * Description: Handles SIGFPE signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigfpe_handler(int except_num){ - - /* Save general purpose registers */ - save_regs(); - - /* Call the general purpose exception handler */ - handle_exception(except_num); - - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigfpe_handler(void){} - -/*********************************************************************** - * sigtrap_handler - * - * Description: Handles SIGTRAP signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigtrap_handler(int except_num) { - - /* Save general purpose registers */ - save_regs(); - - /* Call the general purpose exception handler */ - handle_exception(except_num); - - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigtrap_handler(int except_num){} - -/*********************************************************************** - * sigill_handler - * - * Description: Handles SIGILL signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigill_handler(int except_num) { - - /* Save general purpose registers */ - save_regs(); - - /* Call the general purpose exception handler */ - handle_exception(except_num); - - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigill_handler(int except_num){} -#endif - -#ifdef _WIN32 //MF - -void win32_exception_handler(EXCEPTION_POINTERS* exc_info) -{ - PCONTEXT ctx = exc_info->ContextRecord; - - registers[EAX] = ctx->Eax; - registers[ECX] = ctx->Ecx; - registers[EDX] = ctx->Edx; - registers[EBX] = ctx->Ebx; - registers[ESP] = ctx->Esp; - registers[EBP] = ctx->Ebp; - registers[ESI] = ctx->Esi; - registers[EDI] = ctx->Edi; - registers[PC] = ctx->Eip; - registers[PS] = ctx->EFlags; - registers[CS] = ctx->SegCs; - registers[SS] = ctx->SegSs; - registers[DS] = ctx->SegDs; - registers[ES] = ctx->SegEs; - registers[FS] = ctx->SegFs; - registers[GS] = ctx->SegGs; - - handle_exception((int)(exc_info->ExceptionRecord->ExceptionCode & 0xFFFF)); - - ctx->Eax = registers[EAX]; - ctx->Ecx = registers[ECX]; - ctx->Edx = registers[EDX]; - ctx->Ebx = registers[EBX]; - ctx->Esp = registers[ESP]; - ctx->Ebp = registers[EBP]; - ctx->Esi = registers[ESI]; - ctx->Edi = registers[EDI]; - ctx->Eip = registers[PC]; - ctx->EFlags = registers[PS]; - ctx->SegCs = registers[CS]; - ctx->SegSs = registers[SS]; - ctx->SegDs = registers[DS]; - ctx->SegEs = registers[ES]; - ctx->SegFs = registers[FS]; - ctx->SegGs = registers[GS]; -} - -#endif // _WIN32 - -/*********************************************************************** - * hex - * - * Description: Convert ASCII character values, representing hex - * digits, to the integer value. - * - * Inputs: - * ch - data character - * Outputs: None. - * Returns: integer value represented by the input character. - * - ***********************************************************************/ -static int hex (char ch) -{ - if ((ch >= 'a') && (ch <= 'f')) - return (ch - 'a' + 10); - if ((ch >= '0') && (ch <= '9')) - return (ch - '0'); - if ((ch >= 'A') && (ch <= 'F')) - return (ch - 'A' + 10); - return (-1); -} -#ifdef DJGPP -static void end_hex(void) {} -#endif - -/*********************************************************************** - * getpacket - * - * Description: Retrieve GDB data packet. - * Scan for the sequence $# - * Inputs: None. - * Outputs: None. - * Returns: Beginning of packet buffer. - * - ***********************************************************************/ -static unsigned char *getpacket (void) -{ - unsigned char *buffer = &remcomInBuffer[0]; - unsigned char checksum; - unsigned char xmitcsum; - int count; - char ch; - - while (1) - { - /* wait around for the start character, ignore all other characters */ - while ((ch = getDebugChar ()) != '$') - ; - - retry: - checksum = 0; - xmitcsum = -1; - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) - { - ch = getDebugChar (); - if (ch == '$') - goto retry; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') - { - ch = getDebugChar (); - xmitcsum = hex (ch) << 4; - ch = getDebugChar (); - xmitcsum += hex (ch); - - if (checksum != xmitcsum) - { - if (remote_debug) - { - fprintf (stderr, - "bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum, xmitcsum, buffer); - } - putDebugChar ('-'); /* failed checksum */ - } - else - { - putDebugChar ('+'); /* successful transfer */ - - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') - { - putDebugChar (buffer[0]); - putDebugChar (buffer[1]); - - return &buffer[3]; - } - - return &buffer[0]; - } - } - } -} -#ifdef DJGPP -static void end_getpacket(void) {} -#endif - -/*********************************************************************** - * putpacket - * - * Description: Send GDB data packet. - * - * Inputs: Buffer of data to send. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void putpacket (unsigned char *buffer) -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do - { - putDebugChar ('$'); - checksum = 0; - count = 0; - - while ((ch = buffer[count])) - { - putDebugChar (ch); - checksum += ch; - count += 1; - } - - putDebugChar ('#'); - putDebugChar (hexchars[checksum >> 4]); - putDebugChar (hexchars[checksum % 16]); - - } - while (getDebugChar () != '+'); -} -#ifdef DJGPP -static void end_putpacket(void) {} -#endif - - -/*********************************************************************** - * debug_error - * - * Description: Log errors - * - * Inputs: - * format - Format string. - * parm - parameter string - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void debug_error (const char *format, char *parm) -{ - if (remote_debug) - fprintf (stderr, format, parm); -} -#ifdef DJGPP -static void end_debug_error(void) {} -#endif - -/* - * Indicate to caller of mem2hex or hex2mem that there has been an error. - */ -#ifndef DJGPP -static volatile int mem_err = 0; -#else -static int mem_err = 0; -#endif - -/*********************************************************************** - * set_mem_err - * - * Description: set memory error flag - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void set_mem_err (void) -{ - mem_err = 1; -} -#ifdef DJGPP -static void end_set_mem_err(void) {} -#endif - -/*********************************************************************** - * get_char - * - * Description: Retreive a character from the specified address. - * These are separate functions so that they are so - * short and sweet that the compiler won't save any - * registers (if there is a fault to mem_fault, they - * won't get restored, so there better not be any saved). - * - * Inputs: addr - The address to read from. - * Outputs: None. - * Returns: data read from address. - * - ***********************************************************************/ -static int get_char (char *addr) -{ - return *addr; -} -#ifdef DJGPP -static void end_get_char(void) {} -#endif - -/*********************************************************************** - * set_char - * - * Description: Write a value to the specified address. - * These are separate functions so that they are so - * short and sweet that the compiler won't save any - * registers (if there is a fault to mem_fault, they - * won't get restored, so there better not be any saved). - * - * Inputs: - * addr - The address to read from. - * val - value to write. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void set_char (char *addr, int val) -{ - *addr = val; -} -#ifdef DJGPP -static void end_set_char(void) {} -#endif - - -/*********************************************************************** - * mem2hex - * - * Description: Convert the memory pointed to by mem into hex, placing - * result in buf. Return a pointer to the last char put - * in buf (null). If MAY_FAULT is non-zero, then we should - * set mem_err in response to a fault; if zero treat a - * fault like any other fault in the stub. - * - * Inputs: - * mem - Memory address - * buf - data buffer - * count - number of bytes - * may_fault - flag indicating that the operation may cause a mem fault. - * Outputs: None. - * Returns: Pointer to last character. - * - ***********************************************************************/ -static char *mem2hex (char *mem,char *buf,int count,int may_fault) -{ - int i; - unsigned char ch; - -#ifdef _WIN32 //MF - if (IsBadReadPtr(mem, (DWORD)count)) - return mem; -#else - if (may_fault) - mem_fault_routine = set_mem_err; -#endif - for (i = 0; i < count; i++) - { - ch = get_char (mem++); - if (may_fault && mem_err) - return (buf); - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; -#ifndef _WIN32 //MF - if (may_fault) - mem_fault_routine = NULL; -#endif - return (buf); -} -#ifdef DJGPP -static void end_mem2hex(void) {} -#endif - -/*********************************************************************** - * hex2mem - * - * Description: Convert the hex array pointed to by buf into binary to - * be placed in mem. Return a pointer to the character - * AFTER the last byte written - * Inputs: - * buf - * mem - * count - * may_fault - * Outputs: None. - * Returns: Pointer to buffer after last byte. - * - ***********************************************************************/ -static char *hex2mem (char *buf,char *mem,int count,int may_fault) -{ - int i; - unsigned char ch; - -#ifdef _WIN32 //MF - // MinGW does not support structured exception handling, so let's - // go safe and make memory writable by default - DWORD old_protect; - - VirtualProtect(mem, (DWORD)count, PAGE_EXECUTE_READWRITE, &old_protect); -#else - if (may_fault) - mem_fault_routine = set_mem_err; -#endif - for (i = 0; i < count; i++) - { - ch = hex (*buf++) << 4; - ch = ch + hex (*buf++); - set_char (mem++, ch); - if (may_fault && mem_err) - return (mem); - } -#ifndef _WIN32 //MF - if (may_fault) - mem_fault_routine = NULL; -#endif - return (mem); -} -#ifdef DJGPP -static void end_hex2mem(void) {} -#endif - -/*********************************************************************** - * computeSignal - * - * Description: This function takes the 386 exception vector and - * attempts to translate this number into a unix - * compatible signal value. - * Inputs: - * exceptionVector - * Outputs: None. - * Returns: - * - ***********************************************************************/ -static int computeSignal (int exceptionVector) -{ - int sigval; - switch (exceptionVector) - { - case 0: - sigval = 8; - break; /* divide by zero */ - case 1: - sigval = 5; - break; /* debug exception */ - case 3: - sigval = 5; - break; /* breakpoint */ - case 4: - sigval = 16; - break; /* into instruction (overflow) */ - case 5: - sigval = 16; - break; /* bound instruction */ - case 6: - sigval = 4; - break; /* Invalid opcode */ - case 7: - sigval = 8; - break; /* coprocessor not available */ - case 8: - sigval = 7; - break; /* double fault */ - case 9: - sigval = 11; - break; /* coprocessor segment overrun */ - case 10: - sigval = 11; - break; /* Invalid TSS */ - case 11: - sigval = 11; - break; /* Segment not present */ - case 12: - sigval = 11; - break; /* stack exception */ - case 13: - sigval = 11; - break; /* general protection */ - case 14: - sigval = 11; - break; /* page fault */ - case 16: - sigval = 7; - break; /* coprocessor error */ - default: - sigval = 7; /* "software generated" */ - } - return (sigval); -} -#ifdef DJGPP -static void end_computeSignal(void) {} -#endif - -/*********************************************************************** - * hexToInt - * - * Description: Convert an ASCII string to an integer. - * - * Inputs: - * Outputs: None. - * Returns: Number of chars processed - * - ***********************************************************************/ -int hexToInt (char **ptr, int *intValue) -{ - int numChars = 0; - int hexValue; - - *intValue = 0; - - while (**ptr) - { - hexValue = hex (**ptr); - if (hexValue >= 0) - { - *intValue = (*intValue << 4) | hexValue; - numChars++; - } - else - break; - - (*ptr)++; - } - - return (numChars); -} -#ifdef DJGPP -static void end_hexToInt(void) {} -#endif - - -/*********************************************************************** - * handle_exception - * - * Description: This function does all command procesing for interfacing - * to GDB. - * Inputs: - * exceptionVector - number of the vector. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void handle_exception (int exceptionVector) -{ - int sigval, stepping; - int addr, length; - char *ptr; - int newPC; - -#ifndef _WIN32 //MF - gdb_i386vector = exceptionVector; -#endif - - if (remote_debug) - { - printf ("vector=%d, sr=0x%x, pc=0x%x\n", - exceptionVector, registers[PS], registers[PC]); - } - - /* reply to host that an exception has occurred */ - sigval = computeSignal (exceptionVector); - - ptr = remcomOutBuffer; - - *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */ - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[ESP]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[ESP], ptr, 4, 0); /* SP */ - *ptr++ = ';'; - - *ptr++ = hexchars[EBP]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[EBP], ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[PC]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); /* PC */ - *ptr++ = ';'; - - *ptr = '\0'; - - putpacket (remcomOutBuffer); - - stepping = 0; - - while (1 == 1) - { - remcomOutBuffer[0] = 0; - ptr = getpacket (); - - switch (*ptr++) - { - case '?': - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - break; - case 'd': - remote_debug = !(remote_debug); /* toggle debug flag */ - break; - case 'g': /* return the value of the CPU registers */ - mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES, 0); - break; - case 'G': /* set the value of the CPU registers - return OK */ - hex2mem (ptr, (char *) registers, NUMREGBYTES, 0); - strcpy (remcomOutBuffer, "OK"); - break; - case 'P': /* set the value of a single CPU register - return OK */ - { - int regno; - - if (hexToInt (&ptr, ®no) && *ptr++ == '=') - if (regno >= 0 && regno < NUMREGS) - { - hex2mem (ptr, (char *) ®isters[regno], 4, 0); - strcpy (remcomOutBuffer, "OK"); - break; - } - - strcpy (remcomOutBuffer, "E01"); - break; - } - - /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - case 'm': - /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ - if (hexToInt (&ptr, &addr)) - if (*(ptr++) == ',') - if (hexToInt (&ptr, &length)) - { - ptr = 0; - mem_err = 0; - mem2hex ((char *) addr, remcomOutBuffer, length, 1); - if (mem_err) - { - strcpy (remcomOutBuffer, "E03"); - debug_error ("%s","memory fault"); - } - } - - if (ptr) - { - strcpy (remcomOutBuffer, "E01"); - } - break; - - /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - case 'M': - /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ - if (hexToInt (&ptr, &addr)) - if (*(ptr++) == ',') - if (hexToInt (&ptr, &length)) - if (*(ptr++) == ':') - { - mem_err = 0; - hex2mem (ptr, (char *) addr, length, 1); - - if (mem_err) - { - strcpy (remcomOutBuffer, "E03"); - debug_error ("%s","memory fault"); - } - else - { - strcpy (remcomOutBuffer, "OK"); - } - - ptr = 0; - } - if (ptr) - { - strcpy (remcomOutBuffer, "E02"); - } - break; - - /* cAA..AA Continue at address AA..AA(optional) */ - /* sAA..AA Step one instruction from AA..AA(optional) */ - case 's': - stepping = 1; - case 'c': - /* try to read optional parameter, pc unchanged if no parm */ - if (hexToInt (&ptr, &addr)) - registers[PC] = addr; - - newPC = registers[PC]; - - /* clear the trace bit */ - registers[PS] &= 0xfffffeff; - - /* set the trace bit if we're stepping */ - if (stepping) - registers[PS] |= 0x100; - -#ifdef _WIN32 //MF - return; -#else - _returnFromException (); /* this is a jump */ - - break; - - /* kill the program */ - case 'k': /* do nothing */ -#if 0 - /* Huh? This doesn't look like "nothing". - m68k-stub.c and sparc-stub.c don't have it. */ - BREAKPOINT (); -#endif - break; -#endif - } /* switch */ - - /* reply to the request */ - putpacket (remcomOutBuffer); - } -} -#ifdef DJGPP -static void end_handle_exception(void) {} -#endif - -#ifndef DJGPP -/* GDB stores segment registers in 32-bit words (that's just the way - m-i386v.h is written). So zero the appropriate areas in registers. */ -#define SAVE_REGISTERS1() \ - asm ("movl %eax, _registers"); \ - asm ("movl %ecx, _registers+4"); \ - asm ("movl %edx, _registers+8"); \ - asm ("movl %ebx, _registers+12"); \ - asm ("movl %ebp, _registers+20"); \ - asm ("movl %esi, _registers+24"); \ - asm ("movl %edi, _registers+28"); \ - asm ("movw $0, %ax"); \ - asm ("movw %ds, _registers+48"); \ - asm ("movw %ax, _registers+50"); \ - asm ("movw %es, _registers+52"); \ - asm ("movw %ax, _registers+54"); \ - asm ("movw %fs, _registers+56"); \ - asm ("movw %ax, _registers+58"); \ - asm ("movw %gs, _registers+60"); \ - asm ("movw %ax, _registers+62"); -#define SAVE_ERRCODE() \ - asm ("popl %ebx"); \ - asm ("movl %ebx, _gdb_i386errcode"); -#define SAVE_REGISTERS2() \ - asm ("popl %ebx"); /* old eip */ \ - asm ("movl %ebx, _registers+32"); \ - asm ("popl %ebx"); /* old cs */ \ - asm ("movl %ebx, _registers+40"); \ - asm ("movw %ax, _registers+42"); \ - asm ("popl %ebx"); /* old eflags */ \ - asm ("movl %ebx, _registers+36"); \ - /* Now that we've done the pops, we can save the stack pointer."); */ \ - asm ("movw %ss, _registers+44"); \ - asm ("movw %ax, _registers+46"); \ - asm ("movl %esp, _registers+16"); - -/* See if mem_fault_routine is set, if so just IRET to that address. */ -#define CHECK_FAULT() \ - asm ("cmpl $0, _mem_fault_routine"); \ - asm ("jne mem_fault"); - -asm (".text"); -asm ("mem_fault:"); -/* OK to clobber temp registers; we're just going to end up in set_mem_err. */ -/* Pop error code from the stack and save it. */ -asm (" popl %eax"); -asm (" movl %eax, _gdb_i386errcode"); - -asm (" popl %eax"); /* eip */ -/* We don't want to return there, we want to return to the function - pointed to by mem_fault_routine instead. */ -asm (" movl _mem_fault_routine, %eax"); -asm (" popl %ecx"); /* cs (low 16 bits; junk in hi 16 bits). */ -asm (" popl %edx"); /* eflags */ - -/* Remove this stack frame; when we do the iret, we will be going to - the start of a function, so we want the stack to look just like it - would after a "call" instruction. */ -asm (" leave"); - -/* Push the stuff that iret wants. */ -asm (" pushl %edx"); /* eflags */ -asm (" pushl %ecx"); /* cs */ -asm (" pushl %eax"); /* eip */ - -/* Zero mem_fault_routine. */ -asm (" movl $0, %eax"); -asm (" movl %eax, _mem_fault_routine"); - -asm ("iret"); - - -#define CALL_HOOK() asm("call _remcomHandler"); - -/* This function is called when a i386 exception occurs. It saves - * all the cpu regs in the _registers array, munges the stack a bit, - * and invokes an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * old eflags vector number - * old cs (zero-filled to 32 bits) - * old eip - * - */ -extern void _catchException3(); -asm(".text"); -asm(".globl __catchException3"); -asm("__catchException3:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $3"); -CALL_HOOK(); - -/* Same thing for exception 1. */ -extern void _catchException1(); -asm(".text"); -asm(".globl __catchException1"); -asm("__catchException1:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $1"); -CALL_HOOK(); - -/* Same thing for exception 0. */ -extern void _catchException0(); -asm(".text"); -asm(".globl __catchException0"); -asm("__catchException0:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $0"); -CALL_HOOK(); - -/* Same thing for exception 4. */ -extern void _catchException4(); -asm(".text"); -asm(".globl __catchException4"); -asm("__catchException4:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $4"); -CALL_HOOK(); - -/* Same thing for exception 5. */ -extern void _catchException5(); -asm(".text"); -asm(".globl __catchException5"); -asm("__catchException5:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $5"); -CALL_HOOK(); - -/* Same thing for exception 6. */ -extern void _catchException6(); -asm(".text"); -asm(".globl __catchException6"); -asm("__catchException6:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $6"); -CALL_HOOK(); - -/* Same thing for exception 7. */ -extern void _catchException7(); -asm(".text"); -asm(".globl __catchException7"); -asm("__catchException7:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $7"); -CALL_HOOK(); - -/* Same thing for exception 8. */ -extern void _catchException8(); -asm(".text"); -asm(".globl __catchException8"); -asm("__catchException8:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $8"); -CALL_HOOK(); - -/* Same thing for exception 9. */ -extern void _catchException9(); -asm(".text"); -asm(".globl __catchException9"); -asm("__catchException9:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $9"); -CALL_HOOK(); - -/* Same thing for exception 10. */ -extern void _catchException10(); -asm(".text"); -asm(".globl __catchException10"); -asm("__catchException10:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $10"); -CALL_HOOK(); - -/* Same thing for exception 12. */ -extern void _catchException12(); -asm(".text"); -asm(".globl __catchException12"); -asm("__catchException12:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $12"); -CALL_HOOK(); - -/* Same thing for exception 16. */ -extern void _catchException16(); -asm(".text"); -asm(".globl __catchException16"); -asm("__catchException16:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $16"); -CALL_HOOK(); - -/* For 13, 11, and 14 we have to deal with the CHECK_FAULT stuff. */ - -/* Same thing for exception 13. */ -extern void _catchException13 (); -asm (".text"); -asm (".globl __catchException13"); -asm ("__catchException13:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $13"); -CALL_HOOK(); - -/* Same thing for exception 11. */ -extern void _catchException11 (); -asm (".text"); -asm (".globl __catchException11"); -asm ("__catchException11:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $11"); -CALL_HOOK(); - -/* Same thing for exception 14. */ -extern void _catchException14 (); -asm (".text"); -asm (".globl __catchException14"); -asm ("__catchException14:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $14"); -CALL_HOOK(); - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use. - */ -asm("_remcomHandler:"); -asm(" popl %eax"); /* pop off return address */ -asm(" popl %eax"); /* get the exception number */ -asm(" movl _stackPtr, %esp"); /* move to remcom stack area */ -asm(" pushl %eax"); /* push exception onto stack */ -asm(" call _handle_exception"); /* this never returns */ -#endif - -void _returnFromException () -{ -#ifndef DJGPP - return_to_prog (); -#else -/* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -#endif -} - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -#ifndef DJGPP -void -set_debug_traps (void) -{ -#ifndef _WIN32 //MF - stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1]; - - exceptionHandler (0, _catchException0); - exceptionHandler (1, _catchException1); - exceptionHandler (3, _catchException3); - exceptionHandler (4, _catchException4); - exceptionHandler (5, _catchException5); - exceptionHandler (6, _catchException6); - exceptionHandler (7, _catchException7); - exceptionHandler (8, _catchException8); - exceptionHandler (9, _catchException9); - exceptionHandler (10, _catchException10); - exceptionHandler (11, _catchException11); - exceptionHandler (12, _catchException12); - exceptionHandler (13, _catchException13); - exceptionHandler (14, _catchException14); - exceptionHandler (16, _catchException16); -#endif // _WIN32 - - gdb_initialized = 1; -} -#endif //#ifndef DJGPP - - -// DJGPP stuff -#ifdef DJGPP -/*********************************************************************** - * restore_traps - * - * Description: This function restores all used signal handlers to - * defaults. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -void restore_traps(void) -{ - /* Restore default signal handlers */ - signal(SIGSEGV,SIG_DFL); - signal(SIGTRAP,SIG_DFL); - signal(SIGFPE,SIG_DFL); - signal(SIGTRAP,SIG_DFL); - signal(SIGILL,SIG_DFL); - - /* Clear init flag */ - gdb_initialized = 0; -} - -/*********************************************************************** - * lock_handler_data - * - * Description: This function locks all data that is used by the signal - * handlers. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void lock_handler_data(void) -{ - _go32_dpmi_lock_data(&gdb_initialized,sizeof(gdb_initialized)); - _go32_dpmi_lock_data(&remote_debug,sizeof(remote_debug)); - _go32_dpmi_lock_data(hexchars,sizeof(hexchars)); - _go32_dpmi_lock_data(registers,sizeof(registers)); - _go32_dpmi_lock_data(&gdb_i386errcode,sizeof(gdb_i386errcode)); - _go32_dpmi_lock_data(&gdb_i386vector,sizeof(gdb_i386vector)); - - _go32_dpmi_lock_data(remcomInBuffer,sizeof(remcomInBuffer)); - _go32_dpmi_lock_data(remcomOutBuffer,sizeof(remcomOutBuffer)); - - _go32_dpmi_lock_code(getpacket,(unsigned long)end_getpacket- - (unsigned long)getpacket); - _go32_dpmi_lock_code(putpacket,(unsigned long)end_putpacket- - (unsigned long)putpacket); - _go32_dpmi_lock_code(debug_error,(unsigned long)end_debug_error- - (unsigned long)debug_error); - - _go32_dpmi_lock_data(&mem_fault_routine,sizeof(mem_fault_routine)); - _go32_dpmi_lock_data(&mem_err,sizeof(mem_err)); - - _go32_dpmi_lock_code(set_mem_err,(unsigned long)end_set_mem_err-(unsigned long)set_mem_err); - _go32_dpmi_lock_code(get_char,(unsigned long)end_get_char-(unsigned long)get_char); - _go32_dpmi_lock_code(set_char,(unsigned long)end_set_char-(unsigned long)set_char); - _go32_dpmi_lock_code(mem2hex,(unsigned long)end_hex-(unsigned long)hex); - _go32_dpmi_lock_code(mem2hex,(unsigned long)end_mem2hex-(unsigned long)mem2hex); - _go32_dpmi_lock_code(hex2mem,(unsigned long)end_hex2mem-(unsigned long)hex2mem); - _go32_dpmi_lock_code(computeSignal,(unsigned long)end_computeSignal- - (unsigned long)computeSignal); - _go32_dpmi_lock_code(hexToInt,(unsigned long)end_hexToInt-(unsigned long)hexToInt); - _go32_dpmi_lock_code(handle_exception,(unsigned long)end_handle_exception- - (unsigned long)handle_exception); - - _go32_dpmi_lock_code(sigsegv_handler, - (unsigned long)end_sigsegv_handler-(unsigned long)sigsegv_handler); - - _go32_dpmi_lock_code(sigfpe_handler, - (unsigned long)end_sigfpe_handler-(unsigned long)sigfpe_handler); - - _go32_dpmi_lock_code(sigtrap_handler, - (unsigned long)end_sigtrap_handler-(unsigned long)sigtrap_handler); - - _go32_dpmi_lock_code(sigill_handler, - (unsigned long)end_sigill_handler-(unsigned long)sigill_handler); - - _go32_dpmi_lock_code(save_regs, - (unsigned long)end_save_regs-(unsigned long)save_regs); - - _go32_dpmi_lock_code(set_regs, - (unsigned long)end_set_regs-(unsigned long)set_regs); - -} - -/*********************************************************************** - * set_debug_traps - * - * Description: This function installs signal handlers. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -void set_debug_traps(void) -{ - /* Lock any data that may be used by the trap handlers */ - lock_handler_data(); - - /* Install signal handlers here */ - signal(SIGSEGV,sigsegv_handler); - signal(SIGFPE,sigfpe_handler); - signal(SIGTRAP,sigtrap_handler); - signal(SIGILL,sigill_handler); - - /* Set init flag */ - gdb_initialized = 1; - -} -#endif //#ifdef DJGPP - -/*********************************************************************** - * breakpoint - * - * Description: This function will generate a breakpoint exception. - * It is used at the beginning of a program to sync up - * with a debugger and can be used otherwise as a quick - * means to stop program execution and "break" into the - * debugger. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -void breakpoint () -{ - if (gdb_initialized) - BREAKPOINT (); -} - diff --git a/tools/gdbst03/src/library/i386-supp.c b/tools/gdbst03/src/library/i386-supp.c deleted file mode 100644 index baf465b4e..000000000 --- a/tools/gdbst03/src/library/i386-supp.c +++ /dev/null @@ -1,424 +0,0 @@ -/*********************************************************************** - * i386-supp.c - * - * Description: Support functions for the i386 GDB target stub. - * - * Credits: Created by Jonathan Brogdon - * - * Terms of use: This software is provided for use under the terms - * and conditions of the GNU General Public License. - * You should have received a copy of the GNU General - * Public License along with this program; if not, write - * to the Free Software Foundation, Inc., 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. - * - * Global Data: None. - * Global Functions: - * gdb_serial_init - * gdb_target_init - * gdb_target_close - * putDebugChar - * getDebugChar - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 20000617 Genesis - * Gordon Schumacher 20020212 Updated for modularity - * - ***********************************************************************/ - - -#ifdef DJGPP -#include -#endif - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#define DEBUGBUFFERSIZE 1024 -HANDLE ser_port = (HANDLE)(-1); - -//#include "utility/utility.h" -#ifdef _MSC_VER -#ifndef DEBUG_SERIAL -#pragma comment(lib, "wsock32") -#endif -#endif -#endif - -#include -#include - -#ifdef DJGPP -//#include "bios_layer.h" // Include this for BIOS calls - NOT RECOMMENDED! -//#include "sva_layer.h" // Include this for SVAsync usage -#include "dzc_layer.h" // Include this for DZComm usage - - -#endif -#define SER_TIMEOUT 1000000 - -#ifdef _WIN32 -static LPTOP_LEVEL_EXCEPTION_FILTER s_prev_exc_handler = 0; - - -#define I386_EXCEPTION_CNT 17 - -LONG WINAPI exc_protection_handler(EXCEPTION_POINTERS* exc_info) -{ - int exc_nr = exc_info->ExceptionRecord->ExceptionCode & 0xFFFF; - - if (exc_nr < I386_EXCEPTION_CNT) { - //LOG(FmtString(TEXT("exc_protection_handler: Exception %x"), exc_nr)); - -#if 0 - if (exc_nr==11 || exc_nr==13 || exc_nr==14) { - if (mem_fault_routine) - mem_fault_routine(); - } -#endif - - ++exc_info->ContextRecord->Eip; - } - - return EXCEPTION_CONTINUE_EXECUTION; -} - -LONG WINAPI exc_handler(EXCEPTION_POINTERS* exc_info) -{ - int exc_nr = exc_info->ExceptionRecord->ExceptionCode & 0xFFFF; - - if (exc_nr < I386_EXCEPTION_CNT) { - //LOG(FmtString("Exception %x", exc_nr)); - //LOG(FmtString("EIP=%08X EFLAGS=%08X", exc_info->ContextRecord->Eip, exc_info->ContextRecord->EFlags)); - - // step over initial breakpoint - if (s_initial_breakpoint) { - s_initial_breakpoint = 0; - ++exc_info->ContextRecord->Eip; - } - - SetUnhandledExceptionFilter(exc_protection_handler); - - win32_exception_handler(exc_info); - //LOG(FmtString("EIP=%08X EFLAGS=%08X", exc_info->ContextRecord->Eip, exc_info->ContextRecord->EFlags)); - - SetUnhandledExceptionFilter(exc_handler); - - return EXCEPTION_CONTINUE_EXECUTION; - } - - return EXCEPTION_CONTINUE_SEARCH; -} - -void disable_debugging() -{ - if (s_prev_exc_handler) { - SetUnhandledExceptionFilter(s_prev_exc_handler); - s_prev_exc_handler = 0; - } -} -#endif - -#if !(defined(DJGPP) || defined(_WIN32)) -void exceptionHandler(int exc_nr, void* exc_addr) -{ - if (exc_nr>=0 && exc_nr SER_TIMEOUT) - { - if(WriteFile( ser_port, buffer, 1, &dwLength, NULL )) - return 1; - else if(timeout > SER_TIMEOUT) - return 0; - } - else timeout++; - goto retrywrite; -#endif -} - -/*********************************************************************** - * getDebugChar - * - * Description: gets a character from the debug COM port. - * - * Inputs: None. - * Outputs: None. - * Returns: character data from the serial support. - * - ***********************************************************************/ -int getDebugChar(void) -{ - register int timeout = 0; -#ifdef DJGPP - register int ret = -1; - - while ((GDBStub_SerRecvOk() == 0) && (timeout < SER_TIMEOUT)) - timeout++; - if (timeout < SER_TIMEOUT) - ret = GDBStub_SerRecv(); - - return ret; -#elif defined(_WIN32) - DWORD buffer[DEBUGBUFFERSIZE]; - COMSTAT ComStat ; - DWORD dwErrorFlags; - DWORD dwLength; - - if(ser_port == (HANDLE)-1) - return -1; - - retryread: - ClearCommError( ser_port, &dwErrorFlags, &ComStat ) ; - dwLength = min( DEBUGBUFFERSIZE, ComStat.cbInQue ) ; - - if (dwLength > 0 || timeout > SER_TIMEOUT) - { - if(ReadFile( ser_port, buffer, 1, &dwLength, NULL )) - return buffer[0]; - else if(timeout > SER_TIMEOUT) - return -1; - } - else timeout++; - goto retryread; -#endif -} - -#if 0 -static SOCKET s_rem_fd = INVALID_SOCKET; - -int init_gdb_connect() -{ -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsa_data; -#endif - SOCKADDR_IN srv_addr; - SOCKADDR_IN rem_addr; - SOCKET srv_socket; - int rem_len; - - memset(&srv_addr,0,sizeof(srv_addr)); - s_prev_exc_handler = SetUnhandledExceptionFilter(exc_handler); - -#ifdef _WIN32 - wVersionRequested= MAKEWORD( 2, 2 ); - if (WSAStartup(wVersionRequested, &wsa_data)) { - fprintf(stderr, "WSAStartup() failed"); - return 0; - } -#endif - - srv_addr.sin_family = AF_INET; - srv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - srv_addr.sin_port = htons(9999); - - srv_socket = socket(PF_INET, SOCK_STREAM, 0); - if (srv_socket == INVALID_SOCKET) { - perror("socket()"); - return 0; - } - - if (bind(srv_socket, (struct sockaddr*) &srv_addr, sizeof(srv_addr)) == -1) { - perror("bind()"); - return 0; - } - - if (listen(srv_socket, 4) == -1) { - perror("listen()"); - return 0; - } - - rem_len = sizeof(rem_addr); - - for(;;) { - s_rem_fd = accept(srv_socket, (struct sockaddr*)&rem_addr, &rem_len); - - if (s_rem_fd == INVALID_SOCKET) { - if (errno == EINTR) - continue; - - perror("accept()"); - return 0; - } - - break; - } - - return 1; -} - - -int getDebugChar() -{ - char buffer[DEBUGBUFFERSIZE]; - int r; - - if (s_rem_fd == INVALID_SOCKET) - return EOF; - - r = recv(s_rem_fd, buffer, 1, 0); - if (r == -1) { - perror("recv()"); - //LOG(TEXT("debugger connection broken")); - s_rem_fd = INVALID_SOCKET; - return EOF; - } - - if (!r) - return EOF; - - return buffer[0]; -} - -void putDebugChar(int c) -{ - if (s_rem_fd == INVALID_SOCKET) { - const char buffer[] = {c}; - - if (!send(s_rem_fd, buffer, 1, 0)) { - perror("send()"); - //LOG(TEXT("debugger connection broken")); - exit(-1); - } - } -} -#endif diff --git a/tools/gdbst03/src/library/makefile b/tools/gdbst03/src/library/makefile deleted file mode 100644 index 05e1e9030..000000000 --- a/tools/gdbst03/src/library/makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# Makefile for GDB Stub for DJGPP -# -# GDB Stub for DJGPP Copyright 2000 by Jonathan Brogdon -# - -include ../../Makefile.cfg - -CFLAGS += -I../../include -I../include - -LOBJS = i386-stub.o i386-supp.o - -all: library - -library: $(LOBJS) - @$(RM) ../../lib/libgdbst.a - @$(AR) rcs ../../lib/libgdbst.a $(LOBJS) - -dep: - @$(CC) $(CFLAGS) -M *.c > depend.dep - -clean: - @$(RM) $(LOBJS) - -distclean: clean - @$(RM) ../../lib/libgdbst.a - @$(RM) depend.dep - -$(OBJS) $(LOBJS): -include depend.dep diff --git a/tools/gdbst03/src/library/sva_layer.h b/tools/gdbst03/src/library/sva_layer.h deleted file mode 100644 index 4cdd1628b..000000000 --- a/tools/gdbst03/src/library/sva_layer.h +++ /dev/null @@ -1,83 +0,0 @@ -//======================================================================================================= -// sva_layer.h - Serial command layer for SVAsync -// -//======================================================================================================= - -//======================================================================================================= -//======================================================================================================= - -#ifndef _SVA_LAYER_H -#define _SVA_LAYER_H - - -//=============================================================================== -// Include files -//=============================================================================== - -#include "svasync.h" - -//=============================================================================== -// Inline function definitions -//=============================================================================== - -// Initialize the serial library -// Should return 0 if no error occurred -__inline int GDBStub_SerInit(int port) -{ - int ret, init; - - ret = init = SVAsyncInit(port - 1); - if (ret == 0) - ret = SVAsyncFifoInit(); - if (init == 0) - atexit(SVAsyncStop); - return ret; -} - - -// Set the serial port speed (and other configurables) -// Should return 0 if the speed is set properly -__inline int GDBStub_SerSpeed(int speed) -{ - SVAsyncSet(speed, BITS_8 | NO_PARITY | STOP_1); - SVAsyncHand(DTR | RTS); - return 0; -} - - -// Check to see if there's room in the buffer to send data -// Should return 0 if it is okay to send -__inline int GDBStub_SerSendOk(void) -{ - return !SVAsyncOutStat(); -} - - -// Send a character to the serial port -// Should return 0 if the send succeeds -__inline int GDBStub_SerSend(int c) -{ - SVAsyncOut((char) c); - return 0; -} - - -// Check to see if there are characters waiting in the buffer -// Should return 0 if there's data waiting -__inline int GDBStub_SerRecvOk(void) -{ - return SVAsyncInStat(); -} - - -// Read a character from the serial port -// Should return the character read -__inline int GDBStub_SerRecv(void) -{ - return SVAsyncIn(); -} - - - - -#endif diff --git a/tools/lumpmod/Makefile b/tools/lumpmod/Makefile deleted file mode 100644 index a01f80278..000000000 --- a/tools/lumpmod/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# Makfile for SRB2 Lumpmod -# by Alam Arias et al. - -SRC=lumpmod.c lump.c -OBJ=$(SRC:.c=.o)# replaces the .c from SRC with .o -EXE=lumpmod - -.PHONY : all # .PHONY ignores files named all -all: $(EXE) # all is dependent on $(BIN) to be complete - -$(EXE): $(OBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist - $(CC) $(OBJ) $(LDFLAGS) -o $@ - -.PHONY : clean # .PHONY ignores files named clean -clean: - -$(RM) $(OBJ) $(EXE) diff --git a/tools/lumpmod/lump.c b/tools/lumpmod/lump.c deleted file mode 100644 index ed2ff2f9d..000000000 --- a/tools/lumpmod/lump.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - LumpMod v0.2.1, a command-line utility for working with lumps in wad - files. - Copyright (C) 2003 Thunder Palace Entertainment. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.c: Provides functions for dealing with lumps -*/ - -#include -#include -#include -#include -#include "lump.h" - -/* Read contents of a wad file and store them in memory. - * fpoint is the file to read, opened with "rb" mode. - * A pointer to a new wadfile struct will be returned, or NULL on error. - */ -struct wadfile *read_wadfile(FILE *fpoint) { - struct wadfile *wfptr; - struct lumplist *curlump; - long diroffset, filelen; - unsigned long count; - - /* Allocate memory for wadfile struct */ - wfptr = malloc(sizeof(struct wadfile)); - if(wfptr == NULL) return NULL; - - /* Read first four characters (PWAD or IWAD) */ - if(fread(wfptr->id, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Read number of lumps */ - if(fread(&(wfptr->numlumps), 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* If number of lumps is zero, nothing more needs to be done */ - if(wfptr->numlumps == 0) { - wfptr->head = NULL; - return wfptr; - } - - /* Read offset of directory */ - if(fread(&diroffset, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Verify that the directory as long as it needs to be */ - fseek(fpoint, 0, SEEK_END); - filelen = ftell(fpoint); - if((filelen - diroffset) / DIRENTRYLEN < wfptr->numlumps) { - free(wfptr); - return NULL; - } - - /* Allocate memory for head lumplist item and set head pointer */ - curlump = malloc(sizeof(struct lumplist)); - if(curlump == NULL) { - free(wfptr); - return NULL; - } - wfptr->head = curlump; - curlump->cl = NULL; - - /* Read directory entries and lumps */ - for(count = 0; count < wfptr->numlumps; count++) { - long lumpdataoffset; - - /* Advance to a new list item */ - curlump->next = malloc(sizeof(struct lumplist)); - if(curlump->next == NULL) { - free_wadfile(wfptr); - return NULL; - } - curlump = curlump->next; - curlump->next = NULL; - - /* Allocate memory for the lump info */ - curlump->cl = malloc(sizeof(struct lump)); - if(curlump->cl == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Seek to the proper position in the file */ - if(fseek(fpoint, diroffset + (count * DIRENTRYLEN), SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Read offset of lump data */ - if(fread(&lumpdataoffset, 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read size of lump in bytes */ - if(fread(&(curlump->cl->len), 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read lump name */ - if(fread(curlump->cl->name, 8, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read actual lump data, unless lump size is 0 */ - if(curlump->cl->len > 0) { - if(fseek(fpoint, lumpdataoffset, SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Allocate memory for data */ - curlump->cl->data = malloc(curlump->cl->len); - if(curlump->cl->data == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Fill the data buffer */ - if(fread(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - } else curlump->cl->data = NULL; - } /* End of directory reading loop */ - - return wfptr; -} - -/* Free a wadfile from memory as well as all related structures. - */ -void free_wadfile(struct wadfile *wfptr) { - struct lumplist *curlump, *nextlump; - - if(wfptr == NULL) return; - curlump = wfptr->head; - - /* Free items in the lump list */ - while(curlump != NULL) { - - /* Free the actual lump and its data, if necessary */ - if(curlump->cl != NULL) { - if(curlump->cl->data != NULL) free(curlump->cl->data); - free(curlump->cl); - } - - /* Advance to next lump and free this one */ - nextlump = curlump->next; - free(curlump); - curlump = nextlump; - } - - free(wfptr); -} - -/* Write complete wadfile to a file stream, opened with "wb" mode. - * fpoint is the stream to write to. - * wfptr is a pointer to the wadfile structure to use. - * Return zero on success, nonzero on failure. - */ -int write_wadfile(FILE *fpoint, struct wadfile *wfptr) { - struct lumplist *curlump; - long lumpdataoffset, diroffset; - - if(wfptr == NULL) return 1; - - /* Write four-character ID ("PWAD" or "IWAD") */ - if(fwrite(wfptr->id, 4, 1, fpoint) < 1) return 2; - - /* Write number of lumps */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 3; - - /* Offset of directory is not known yet. For now, write number of lumps - * again, just to fill the space. - */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 4; - - /* Loop through lump list, writing lump data */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list or for lumps of - zero length */ - if(curlump->cl == NULL || curlump->cl->data == NULL) continue; - - /* Write the data */ - if(fwrite(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) - return 5; - } - - /* Current position is where directory will start */ - diroffset = ftell(fpoint); - - /* Offset for the first lump's data is always 12 */ - lumpdataoffset = 12; - - /* Loop through lump list again, this time writing directory entries */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list */ - if(curlump->cl == NULL) continue; - - /* Write offset for lump data */ - if(fwrite(&lumpdataoffset, 4, 1, fpoint) < 1) return 6; - - /* Write size of lump data */ - if(fwrite(&(curlump->cl->len), 4, 1, fpoint) < 1) return 7; - - /* Write lump name */ - if(fwrite(curlump->cl->name, 8, 1, fpoint) < 1) return 8; - - /* Increment lumpdataoffset variable as appropriate */ - lumpdataoffset += curlump->cl->len; - } - - /* Go back to header and write the proper directory offset */ - fseek(fpoint, 8, SEEK_SET); - if(fwrite(&diroffset, 4, 1, fpoint) < 1) return 9; - - return 0; -} - -/* Get the name of a lump, as a null-terminated string. - * item is a pointer to the lump (not lumplist) whose name will be obtained. - * Return NULL on error. - */ -char *get_lump_name(struct lump *item) { - char convname[9], *retname; - - if(item == NULL) return NULL; - memcpy(convname, item->name, 8); - convname[8] = '\0'; - - retname = malloc(strlen(convname) + 1); - if(retname != NULL) strcpy(retname, convname); - return retname; -} - -/* Find the lump after start and before end having a certain name. - * Return a pointer to the list item for that lump, or return NULL if no lump - * by that name is found or lumpname is too long. - * lumpname is a null-terminated string. - * If end parameter is NULL, search to the end of the entire list. - */ -struct lumplist *find_previous_lump(struct lumplist *start, struct lumplist - *end, char *lumpname) { - struct lumplist *curlump, *lastlump; - char *curname; - int found = 0; - - /* Verify that parameters are valid */ - if(start==NULL || start==end || lumpname==NULL || strlen(lumpname) > 8) - return NULL; - - /* Loop through the list from start parameter */ - lastlump = start; - for(curlump = start->next; curlump != end && curlump != NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Compare names to see if this is the lump we want */ - if(strcmp(curname, lumpname) == 0) { - found = 1; - break; - } - - /* Free memory allocated to curname */ - free(curname); - - lastlump = curlump; - } - - if(found) return lastlump; - return NULL; -} - -/* Remove a lump from the list, free it, and free its data. - * before is the lump immediately preceding the lump to be removed. - * wfptr is a pointer to the wadfile structure to which the removed lump - * belongs, so that numlumps can be decreased. - */ -void remove_next_lump(struct wadfile *wfptr, struct lumplist *before) { - struct lumplist *removed; - - /* Verify that parameters are valid */ - if(before == NULL || before->next == NULL || wfptr == NULL) return; - - /* Update linked list to omit removed lump */ - removed = before->next; - before->next = removed->next; - - /* Free lump info and data if necessary */ - if(removed->cl != NULL) { - if(removed->cl->data != NULL) free(removed->cl->data); - free(removed->cl); - } - - free(removed); - - /* Decrement numlumps */ - wfptr->numlumps--; -} - -/* Add a lump. - * The lump will follow prev in the list and be named name, with a data size - * of len. - * A copy will be made of the data. - * Return zero on success or nonzero on failure. - */ -int add_lump(struct wadfile *wfptr, struct lumplist *prev, char *name, long - len, unsigned char *data) { - struct lump *newlump; - struct lumplist *newlumplist; - unsigned char *copydata; - - /* Verify that parameters are valid */ - if(wfptr == NULL || prev == NULL || name == NULL || strlen(name) > 8) - return 1; - - /* Allocate space for newlump and newlumplist */ - newlump = malloc(sizeof(struct lump)); - newlumplist = malloc(sizeof(struct lumplist)); - if(newlump == NULL || newlumplist == NULL) return 2; - - /* Copy lump data and set up newlump */ - if(len == 0 || data == NULL) { - newlump->len = 0; - newlump->data = NULL; - } else { - newlump->len = len; - copydata = malloc(len); - if(copydata == NULL) return 3; - memcpy(copydata, data, len); - newlump->data = copydata; - } - - /* Set name of newlump */ - memset(newlump->name, '\0', 8); - if(strlen(name) == 8) memcpy(newlump->name, name, 8); - else strcpy(newlump->name, name); - - /* Set up newlumplist and alter prev appropriately */ - newlumplist->cl = newlump; - newlumplist->next = prev->next; - prev->next = newlumplist; - - /* Increment numlumps */ - wfptr->numlumps++; - - return 0; -} - -/* Rename a lump. - * renamed is a pointer to the lump (not lumplist) that needs renaming. - * newname is a null-terminated string with the new name. - * Return zero on success or nonzero on failure. - */ -int rename_lump(struct lump *renamed, char *newname) { - - /* Verify that parameters are valid. */ - if(newname == NULL || renamed == NULL || strlen(newname) > 8) return 1; - - /* Do the renaming. */ - memset(renamed->name, '\0', 8); - if(strlen(newname) == 8) memcpy(renamed->name, newname, 8); - else strcpy(renamed->name, newname); - - return 0; -} - -/* Find the last lump in a wadfile structure. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump(struct wadfile *wfptr) { - struct lumplist *curlump; - - if(wfptr == NULL || wfptr->head == NULL) return NULL; - curlump = wfptr->head; - - while(curlump->next != NULL) curlump = curlump->next; - return curlump; -} - -/* Find the last lump between start and end. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump_between(struct lumplist *start, struct - lumplist *end) { - struct lumplist *curlump; - - if(start == NULL) return NULL; - curlump = start; - - while(curlump->next != end) { - curlump = curlump->next; - if(curlump == NULL) break; - } - - return curlump; -} - -/* Find the next section lump. A section lump is MAPxx (0 <= x <= 9), ExMy - * (0 <= x <= 9, 0 <= y <= 9), or any lump whose name ends in _START or _END. - * Return NULL if there are no section lumps after start. - */ -struct lumplist *find_next_section_lump(struct lumplist *start) { - struct lumplist *curlump, *found = NULL; - char *curname; - - /* Verify that parameter is valid */ - if(start == NULL || start->next == NULL) return NULL; - - /* Loop through the list from start parameter */ - for(curlump = start->next; curlump != NULL && found == NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Check to see if this is a section lump */ - if(strlen(curname) == 5 && strncmp("MAP", curname, 3) == 0 && - isdigit(curname[3]) && isdigit(curname[4])) - found = curlump; - else if(strlen(curname) == 4 && curname[0] == 'E' && curname[2] == - 'M' && isdigit(curname[1]) && isdigit(curname[3])) - found = curlump; - else if(strlen(curname) == 7 && strcmp("_START", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 8 && strcmp("_START", &curname[2]) == 0) - found = curlump; - else if(strlen(curname) == 5 && strcmp("_END", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 6 && strcmp("_END", &curname[2]) == 0) - found = curlump; - - /* Free memory allocated to curname */ - free(curname); - } - - return found; -} diff --git a/tools/lumpmod/lump.h b/tools/lumpmod/lump.h deleted file mode 100644 index 88e478716..000000000 --- a/tools/lumpmod/lump.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - LumpMod v0.2.1, a command-line utility for working with lumps in wad - files. - Copyright (C) 2003 Thunder Palace Entertainment. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.h: Defines constants, structures, and functions used in lump.c -*/ - -#ifndef __LUMP_H -#define __LUMP_H - -/* Entries in the wadfile directory are 16 bytes */ -#define DIRENTRYLEN 16 - -/* Lumps and associated info */ -struct lump { - long len; - unsigned char *data; - char name[8]; -}; - -/* Linked list of lumps */ -struct lumplist { - struct lump *cl; /* actual content of the lump */ - struct lumplist *next; -}; - -/* Structure to contain all wadfile data */ -struct wadfile { - char id[4]; /* IWAD or PWAD */ - long numlumps; /* 32-bit integer */ - struct lumplist *head; /* points to first entry */ -}; - -/* Function declarations */ -struct wadfile *read_wadfile(FILE *); -void free_wadfile(struct wadfile *); -int write_wadfile(FILE *, struct wadfile *); -char *get_lump_name(struct lump *); -struct lumplist *find_previous_lump(struct lumplist *, struct lumplist *, char *); -void remove_next_lump(struct wadfile *, struct lumplist *); -int add_lump(struct wadfile *, struct lumplist *, char *, long, unsigned char *); -int rename_lump(struct lump *, char *); -struct lumplist *find_last_lump(struct wadfile *); -struct lumplist *find_last_lump_between(struct lumplist *, struct lumplist *); -struct lumplist *find_next_section_lump(struct lumplist *); - -#endif diff --git a/tools/lumpmod/lumpmod.c b/tools/lumpmod/lumpmod.c deleted file mode 100644 index e9042615e..000000000 --- a/tools/lumpmod/lumpmod.c +++ /dev/null @@ -1,785 +0,0 @@ -/* - LumpMod v0.2.1, a command-line utility for working with lumps in wad - files. - Copyright (C) 2003 Thunder Palace Entertainment. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lumpmod.c: Provides program functionality; depends on lump.c and lump.h -*/ - -#include -#include -#include -#include "lump.h" - -int main(int argc, char *argv[]) { - enum commands { C_ADD, C_ADDSECT, C_DELETE, C_DELSECT, C_EXTRACT, C_LIST, - C_RENAME, C_UPDATE } cmd; - struct wadfile *wfptr; - struct lumplist *startitem, *enditem = NULL; - FILE *fpoint; - char *progname, **params; - char *startname = NULL, *endname = NULL; - int numargs, numparams, insection = 0; - - progname = argv[0]; - numargs = argc - 1; - - /* Verify that there are enough arguments */ - if(numargs < 2) { - fprintf(stderr, "%s: not enough arguments\n", progname); - return EXIT_FAILURE; - } - - /* Identify the command used */ - if(strcmp(argv[2], "add" ) == 0) cmd = C_ADD; - else if(strcmp(argv[2], "addsect") == 0) cmd = C_ADDSECT; - else if(strcmp(argv[2], "delete" ) == 0) cmd = C_DELETE; - else if(strcmp(argv[2], "delsect") == 0) cmd = C_DELSECT; - else if(strcmp(argv[2], "extract") == 0) cmd = C_EXTRACT; - else if(strcmp(argv[2], "list" ) == 0) cmd = C_LIST; - else if(strcmp(argv[2], "rename" ) == 0) cmd = C_RENAME; - else if(strcmp(argv[2], "update" ) == 0) cmd = C_UPDATE; - else { - fprintf(stderr, "%s: invalid command %s\n", progname, argv[2]); - return EXIT_FAILURE; - } - - /* Check for -s option */ - if(numargs >= 4 && strcmp(argv[3], "-s") == 0) { - if(cmd == C_ADDSECT || cmd == C_DELSECT) { - fprintf(stderr, "%s: no option -s for command %s\n", progname, argv[2]); - return EXIT_FAILURE; - } - insection = 1; - params = &argv[5]; - numparams = numargs - 4; - - /* Assume a map name if length > 2 */ - if(strlen(argv[4]) > 2) startname = argv[4]; - else { - startname = malloc(strlen(argv[4]) + 7); - endname = malloc(strlen(argv[4]) + 5); - if(startname == NULL || endname == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - sprintf(startname, "%s_START", argv[4]); - sprintf(endname, "%s_END", argv[4]); - } - } else { - params = &argv[3]; - numparams = numargs - 2; - } /* end of check for -s option */ - - /* Load the wadfile into memory, since all commands require this */ - fpoint = fopen(argv[1], "rb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s\n", progname, argv[1]); - return EXIT_FAILURE; - } - wfptr = read_wadfile(fpoint); - fclose(fpoint); - if(wfptr == NULL) { - fprintf(stderr, "%s: %s is not a valid wadfile\n", progname, argv[1]); - return EXIT_FAILURE; - } - - /* Find startitem and enditem, using startname and endname */ - if(startname == NULL) startitem = wfptr->head; - else { - startitem = find_previous_lump(wfptr->head, NULL, startname); - if(startitem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - startname, argv[1]); - return EXIT_FAILURE; - } - startitem = startitem->next; - if(endname == NULL) { - if(startitem->next != NULL) { - char *itemname; - - enditem = startitem->next; - itemname = get_lump_name(enditem->cl); - while( strcmp(itemname, "THINGS" ) == 0 || - strcmp(itemname, "LINEDEFS") == 0 || - strcmp(itemname, "SIDEDEFS") == 0 || - strcmp(itemname, "VERTEXES") == 0 || - strcmp(itemname, "SEGS" ) == 0 || - strcmp(itemname, "SSECTORS") == 0 || - strcmp(itemname, "NODES" ) == 0 || - strcmp(itemname, "SECTORS" ) == 0 || - strcmp(itemname, "REJECT" ) == 0 || - strcmp(itemname, "BLOCKMAP") == 0) { - enditem = enditem->next; - if(enditem == NULL) break; - free(itemname); - itemname = get_lump_name(enditem->cl); - } - free(itemname); - if(enditem != NULL) enditem = enditem->next; - } else enditem = NULL; - } else { - enditem = find_previous_lump(startitem, NULL, endname); - if(enditem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - endname, argv[1]); - return EXIT_FAILURE; - } - enditem = enditem->next; - } - } /* end of finding startitem and enditem */ - - /* Do stuff specific to each command */ - switch(cmd) { - case C_ADD: { - struct lumplist *startitem2, *before, *existing; - int overwrite = 1, firstentry = 0, canduplicate = 0; - char *startname2 = NULL; - - /* Parse options: -a, -b, -d, -n */ - while(numparams > 2) { - if(params[0][0] != '-') break; - if(strcmp(params[0], "-n") == 0) overwrite = 0; - else if(strcmp(params[0], "-d") == 0) canduplicate = 1; - else if(strcmp(params[0], "-b") == 0) firstentry = 1; - else if(strcmp(params[0], "-a") == 0) { - params = ¶ms[1]; - numparams--; - startname2 = params[0]; - } else { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - params = ¶ms[1]; - numparams--; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Find the lump after which to add */ - if(firstentry) before = startitem; - else if(startname2 != NULL) { - before = find_previous_lump(startitem, enditem, startname2); - if(before == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - startname2, argv[1]); - return EXIT_FAILURE; - } - before = before->next; - } else { - if(insection) { - before = find_last_lump_between(startitem, enditem); - if(before == NULL) before = startitem; - } else before = find_last_lump(wfptr); - } - startitem2 = before; - - /* Add LUMPNAME FILENAME pairs */ - printf("Adding lumps in %s...\n", argv[1]); - for(;;) { - long newlumpsize; - unsigned char *newlumpdata; - - /* Check whether the lump already exists, unless -d is used */ - if(canduplicate) existing = NULL; - else existing = find_previous_lump(startitem, enditem, params[0]); - if(existing != NULL) existing = existing->next; - if(existing != NULL && overwrite == 0) { - printf("Lump %s already exists. Taking no action.\n", params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - - /* Read the file with new lump data */ - fpoint = fopen(params[1], "rb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: can't open file %s\n", progname, - params[1]); - return EXIT_FAILURE; - } - - /* Find size of lump data */ - fseek(fpoint, 0, SEEK_END); - newlumpsize = ftell(fpoint); - fseek(fpoint, 0, SEEK_SET); - - /* Copy lump data to memory */ - if(newlumpsize == 0) newlumpdata = NULL; - else { - newlumpdata = malloc(newlumpsize); - if(newlumpdata == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - if(fread(newlumpdata, newlumpsize, 1, fpoint) < 1) { - fprintf(stderr, "%s: unable to read file %s\n", - progname, params[1]); - return EXIT_FAILURE; - } - } - - /* Close the file */ - fclose(fpoint); - - /* Add or update lump */ - if(existing == NULL) { - if(add_lump(wfptr, before, params[0], newlumpsize, - newlumpdata) != 0) { - fprintf(stderr, "%s: unable to add lump %s\n", - progname, params[0]); - return EXIT_FAILURE; - } - printf("Lump %s added.\n", params[0]); - - /* Other lumps will be added after the new one */ - before = before->next; - } else { - existing->cl->len = newlumpsize; - free(existing->cl->data); - existing->cl->data = malloc(newlumpsize); - if(existing->cl->data == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - memcpy(existing->cl->data, newlumpdata, newlumpsize); - printf("Lump %s updated.\n", params[0]); - } - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of adding LUMPNAME FILENAME pairs */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_ADD */ - break; - - case C_UPDATE: { - struct lumplist *existing; - - /* Parse options (none) */ - if(numparams > 2 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Update LUMPNAME FILENAME pairs */ - printf("Updating lumps in %s...\n", argv[1]); - for(;;) { - long newlumpsize; - unsigned char *newlumpdata; - - /* Check whether the lump already exists */ - existing = find_previous_lump(startitem, enditem, params[0]); - if(existing == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - existing = existing->next; - - /* Read the file with new lump data */ - fpoint = fopen(params[1], "rb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: can't open file %s\n", progname, - params[1]); - return EXIT_FAILURE; - } - - /* Find size of lump data */ - fseek(fpoint, 0, SEEK_END); - newlumpsize = ftell(fpoint); - fseek(fpoint, 0, SEEK_SET); - - /* Copy lump data to memory */ - if(newlumpsize == 0) newlumpdata = NULL; - else { - newlumpdata = malloc(newlumpsize); - if(newlumpdata == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - if(fread(newlumpdata, newlumpsize, 1, fpoint) < 1) { - fprintf(stderr, "%s: unable to read file %s\n", - progname, params[1]); - return EXIT_FAILURE; - } - } - - /* Close the file */ - fclose(fpoint); - - /* Update lump */ - existing->cl->len = newlumpsize; - free(existing->cl->data); - existing->cl->data = malloc(newlumpsize); - if(existing->cl->data == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - memcpy(existing->cl->data, newlumpdata, newlumpsize); - printf("Lump %s updated.\n", params[0]); - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of updating LUMPNAME FILENAME pairs */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_UPDATE */ - break; - - case C_DELETE: { - struct lumplist *before; - - /* Parse options (none) */ - if(numparams > 1 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 1) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Delete LUMPNAME lumps */ - printf("Deleting lumps in %s...\n", argv[1]); - for(;;) { - - /* Find the lump to delete */ - before = find_previous_lump(startitem, enditem, params[0]); - if(before == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - continue; - } - - /* Delete it */ - remove_next_lump(wfptr, before); - printf("Lump %s deleted.\n", params[0]); - - /* Advance to the next item to delete, if there is one */ - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - } /* end of deleting LUMPNAME lumps */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_DELETE */ - break; - - case C_RENAME: { - struct lumplist *renamed; - - /* Parse options (none) */ - if(numparams > 2 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Rename OLDNAME NEWNAME pairs */ - printf("Renaming lumps in %s...\n", argv[1]); - for(;;) { - - /* Find the lump to rename */ - renamed = find_previous_lump(startitem, enditem, params[0]); - if(renamed == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - renamed = renamed->next; - - /* Rename lump */ - memset(renamed->cl->name, '\0', 8); - if(strlen(params[1]) >= 8) memcpy(renamed->cl->name, - params[1], 8); - else strcpy(renamed->cl->name, params[1]); - - printf("Lump %s renamed to %s.\n", params[0], params[1]); - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of renaming OLDNAME NEWNAME pairs */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_RENAME */ - break; - - case C_EXTRACT: { - struct lumplist *extracted; - - /* Parse options (none) */ - if(numparams > 2 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Extract LUMPNAME FILENAME pairs */ - printf("Extracting lumps from %s...\n", argv[1]); - for(;;) { - - /* Find the lump to extract */ - extracted = find_previous_lump(startitem, enditem, params[0]); - if(extracted == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - extracted = extracted->next; - - /* Open the file to extract to */ - fpoint = fopen(params[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: can't open file %s for writing\n", - progname, params[1]); - return EXIT_FAILURE; - } - - /* Extract lump */ - if(fwrite(extracted->cl->data, extracted->cl->len, 1, fpoint) - < 1) { - fprintf(stderr, "%s: unable to write lump %s to disk\n", - progname, params[0]); - return EXIT_FAILURE; - } - - /* Close the file */ - fclose(fpoint); - printf("Lump %s saved as %s.\n", params[0], params[1]); - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of extracting LUMPNAME FILENAME pairs */ - - printf("Finished extracting lumps from file %s.\n", argv[1]); - } /* end of C_EXTRACT */ - break; - - case C_LIST: { - struct lumplist *curlump; - int verbose = 0, i = 0; - - /* Parse options: -v */ - while(numparams > 0) { - if(params[0][0] != '-') break; - if(strcmp(params[0], "-v") == 0) verbose = 1; - else { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - params = ¶ms[1]; - numparams--; - } - - /* Loop through the lump list, printing lump info */ - for(curlump = startitem->next; curlump != enditem; curlump = - curlump->next) { - i++; - if(verbose) printf("%5i %-8s %7li\n", i, - get_lump_name(curlump->cl), curlump->cl->len); - else printf("%s\n", get_lump_name(curlump->cl)); - } - } /* end of C_LIST */ - break; - - case C_DELSECT: { - - /* Parse options (none) */ - if(numparams > 1 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 1) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Delete sections */ - printf("Deleting sections in %s...\n", argv[1]); - for(;;) { - struct lumplist *curlump; - - /* Assume a map name if length > 2 */ - if(strlen(params[0]) > 2) startname = params[0]; - else { - startname = malloc(strlen(params[0]) + 7); - endname = malloc(strlen(params[0]) + 5); - if(startname == NULL || endname == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - sprintf(startname, "%s_START", params[0]); - sprintf(endname, "%s_END", params[0]); - } - - /* Find startitem and enditem, using startname and endname */ - startitem = find_previous_lump(wfptr->head, NULL, startname); - if(startitem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - startname, argv[1]); - return EXIT_FAILURE; - } - if(endname == NULL && startitem->next != NULL) { - char *itemname; - - enditem = startitem->next; - itemname = get_lump_name(enditem->cl); - do { - enditem = enditem->next; - if(enditem == NULL) break; - free(itemname); - itemname = get_lump_name(enditem->cl); - } while(strcmp(itemname, "THINGS" ) == 0 || - strcmp(itemname, "LINEDEFS") == 0 || - strcmp(itemname, "SIDEDEFS") == 0 || - strcmp(itemname, "VERTEXES") == 0 || - strcmp(itemname, "SEGS" ) == 0 || - strcmp(itemname, "SSECTORS") == 0 || - strcmp(itemname, "NODES" ) == 0 || - strcmp(itemname, "SECTORS" ) == 0 || - strcmp(itemname, "REJECT" ) == 0 || - strcmp(itemname, "BLOCKMAP") == 0); - free(itemname); - } - else { - enditem = find_previous_lump(startitem, NULL, endname); - if(enditem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", - progname, endname, argv[1]); - return EXIT_FAILURE; - } - enditem = enditem->next->next; - } /* end of finding startitem and enditem */ - - /* Loop through the section lumps, deleting them */ - curlump = startitem; - while(curlump->next != enditem) - remove_next_lump(wfptr, curlump); - printf("Deleted section %s.\n", params[0]); - - /* Move to next parameter, if it exists */ - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - } /* end of deleting sections */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_DELSECT */ - break; - - case C_ADDSECT: { - - /* Parse options (none) */ - if(numparams > 1 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 1) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Add sections */ - printf("Adding sections in %s...\n", argv[1]); - for(;;) { - struct lumplist *curlump; - - /* Assume a map name if length > 2 */ - if(strlen(params[0]) > 2) startname = params[0]; - else { - startname = malloc(strlen(params[0]) + 7); - endname = malloc(strlen(params[0]) + 5); - if(startname == NULL || endname == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - sprintf(startname, "%s_START", params[0]); - sprintf(endname, "%s_END", params[0]); - } - - /* Add section, unless it already exists */ - if(find_previous_lump(wfptr->head, NULL, startname) == NULL) { - struct lumplist *last; - - last = find_last_lump(wfptr); - if(add_lump(wfptr, last, startname, 0, NULL) != 0) { - fprintf(stderr, "%s: unable to add lump %s\n", - progname, startname); - return EXIT_FAILURE; - } - - if(endname != NULL) { - last = last->next; - if(add_lump(wfptr, last, endname, 0, NULL) != 0) { - fprintf(stderr, "%s: unable to add lump %s\n", - progname, endname); - return EXIT_FAILURE; - } - } - - printf("Added section %s.\n", params[0]); - } else - printf("Section %s already exists. Taking no action.\n", - params[0]); - - /* Move to next parameter, if it exists */ - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - } /* end of adding sections */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_ADDSECT */ - } /* end of command-specific stuff */ - - return EXIT_SUCCESS; -} diff --git a/tools/lumpmod/lumpmod.html b/tools/lumpmod/lumpmod.html deleted file mode 100644 index 082784178..000000000 --- a/tools/lumpmod/lumpmod.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -LumpMod v0.2.1 Documentation -

LumpMod v0.2.1

-

LumpMod is a small command-line utility for working with lumps in wad -files in the format used by DOOM and DOOM 2. It can add, delete, extract, -rename, list, and update individual lumps. It can also add sections -(XX_START and XX_END, for instance) and delete entire sections.

-

Usage

-

lumpmod [wadfile] [command] [-s section] [parameters]

-

Sections are MAPxx (xx = 01-99, where that map exists in the file), ExMy -(x, y = 1-9, where that map exists in the file), and anything else will be -the section between WHATEVER_START and WHATEVER_END. Sections that do not -exist in the wad file cannot be used. The section part can be left out to -work with the whole file. Any section specified here while using the addsect -or delsect commands will cause an error.

-

Note that the []... parameters in the command listings can be repeated. -For example, you can use lumpmod clowns.wad add CLOWNS clowns.lmp to -add a CLOWNS lump, or lumpmod clowns.wad add CLOWN1 clown1.lmp CLOWN2 -clown2.lmp to add two clown-related lumps.

-

Note also that lump names and commands are case sensitive. There is an -update command, but no UPDATE command.

-

Commands

-

add [-a lumpname] [-b] [-d] [-n] [LUMPNAME FILENAME]...

-

Add a lump to the end of the wad, or after the lump specified with the -a -option. If the lump already exists, it will be overwritten (with its position -unchanged) unless the -n option is specified, in which case no action will be -taken, or the -d option is specified, in which case an additional lump with -the same name will be added. If the lump specified in the -a option does not -exist, an error will occur. The -b option will add the lump at the beginning, -overriding the -a option.

-

addsect [SECTNAME]...

-

Add a section. The name must be one or two characters long. If section -name is HX, zero-length entries HX_START and HX_END will be added to the end -of the wad file. If this section already exists, no action will be taken.

-

delete [LUMPNAME]...

-

Remove LUMPNAME from the wad.

-

delsect [SECTNAME]...

-

Delete a section and anything inside it. If the section doesn't exist, no -action will be taken.

-

extract [LUMPNAME FILENAME]...

-

Save the contents of LUMPNAME to the file named FILENAME. (Wad file will -not be changed in any way.)

-

list [-v]

-

List all lumps in the wad, in the order they appear in the directory. -With the -v option, include numbers and lump lengths.

-

rename [OLDNAME NEWNAME]...

-

Rename a lump in the wad.

-

update [LUMPNAME FILENAME]...

-

Update LUMPNAME with the contents of FILENAME. If no lump named LUMPNAME -exists in the wad, no action will be taken.

-

Changes

-

Version 0.2.1 adds the -d option to the add command.

-

Version 0.2 contains a fix to a bug involving empty sections. The initial -public release was version 0.1.

-

Bugs

-

LumpMod currently chokes on completely empty wad files (i.e., those that -contain absolutely no lumps). Let me know if you find any other bugs.

-

Author

-

Catatonic Porpoise, <graue@oceanbase.org>. -Updates can be found at http://www.thunderpalace.com/software/.

-

Thanks

-

Thanks to Matthew S. Fell for writing "The Unofficial DOOM -Specs," which were very helpful in making this program.

-

License

-

Copyright © 2003 Thunder Palace Entertainment.

-

This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version.

-

This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details.

-

You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

-