mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
- more of the same.
This commit is contained in:
parent
ad41b23506
commit
6c6bab73ad
10 changed files with 145 additions and 145 deletions
|
@ -293,7 +293,7 @@ static int ListActionCommands (const char *pattern)
|
||||||
#undef get16bits
|
#undef get16bits
|
||||||
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|
||||||
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
|
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
|
||||||
#define get16bits(d) (*((const WORD *) (d)))
|
#define get16bits(d) (*((const uint16_t *) (d)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (get16bits)
|
#if !defined (get16bits)
|
||||||
|
@ -317,7 +317,7 @@ DWORD SuperFastHash (const char *data, size_t len)
|
||||||
hash += get16bits (data);
|
hash += get16bits (data);
|
||||||
tmp = (get16bits (data+2) << 11) ^ hash;
|
tmp = (get16bits (data+2) << 11) ^ hash;
|
||||||
hash = (hash << 16) ^ tmp;
|
hash = (hash << 16) ^ tmp;
|
||||||
data += 2*sizeof (WORD);
|
data += 2*sizeof (uint16_t);
|
||||||
hash += hash >> 11;
|
hash += hash >> 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ DWORD SuperFastHash (const char *data, size_t len)
|
||||||
{
|
{
|
||||||
case 3: hash += get16bits (data);
|
case 3: hash += get16bits (data);
|
||||||
hash ^= hash << 16;
|
hash ^= hash << 16;
|
||||||
hash ^= data[sizeof (WORD)] << 18;
|
hash ^= data[sizeof (uint16_t)] << 18;
|
||||||
hash += hash >> 11;
|
hash += hash >> 11;
|
||||||
break;
|
break;
|
||||||
case 2: hash += get16bits (data);
|
case 2: hash += get16bits (data);
|
||||||
|
@ -371,7 +371,7 @@ DWORD SuperFastHashI (const char *data, size_t len)
|
||||||
hash += get16bits (data);
|
hash += get16bits (data);
|
||||||
tmp = (get16bits (data+2) << 11) ^ hash;
|
tmp = (get16bits (data+2) << 11) ^ hash;
|
||||||
hash = (hash << 16) ^ tmp;
|
hash = (hash << 16) ^ tmp;
|
||||||
data += 2*sizeof (WORD);
|
data += 2*sizeof (uint16_t);
|
||||||
hash += hash >> 11;
|
hash += hash >> 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ DWORD SuperFastHashI (const char *data, size_t len)
|
||||||
{
|
{
|
||||||
case 3: hash += get16bits (data);
|
case 3: hash += get16bits (data);
|
||||||
hash ^= hash << 16;
|
hash ^= hash << 16;
|
||||||
hash ^= tolower(data[sizeof (WORD)]) << 18;
|
hash ^= tolower(data[sizeof (uint16_t)]) << 18;
|
||||||
hash += hash >> 11;
|
hash += hash >> 11;
|
||||||
break;
|
break;
|
||||||
case 2: hash += get16bits (data);
|
case 2: hash += get16bits (data);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
{
|
{
|
||||||
Choices.ReplaceValues(from, to);
|
Choices.ReplaceValues(from, to);
|
||||||
}
|
}
|
||||||
void AddDecal (FDecalBase *decal, WORD weight)
|
void AddDecal (FDecalBase *decal, uint16_t weight)
|
||||||
{
|
{
|
||||||
Choices.AddEntry (decal, weight);
|
Choices.AddEntry (decal, weight);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ struct FDecalLib::FTranslation
|
||||||
|
|
||||||
DWORD StartColor, EndColor;
|
DWORD StartColor, EndColor;
|
||||||
FTranslation *Next;
|
FTranslation *Next;
|
||||||
WORD Index;
|
uint16_t Index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FDecalAnimator
|
struct FDecalAnimator
|
||||||
|
@ -422,7 +422,7 @@ void FDecalLib::ReadDecals(FScanner &sc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD FDecalLib::GetDecalID (FScanner &sc)
|
uint16_t FDecalLib::GetDecalID (FScanner &sc)
|
||||||
{
|
{
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
if (!IsNum (sc.String))
|
if (!IsNum (sc.String))
|
||||||
|
@ -437,14 +437,14 @@ WORD FDecalLib::GetDecalID (FScanner &sc)
|
||||||
{
|
{
|
||||||
sc.ScriptError ("Decal ID must be between 1 and 65535");
|
sc.ScriptError ("Decal ID must be between 1 and 65535");
|
||||||
}
|
}
|
||||||
return (WORD)num;
|
return (uint16_t)num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDecalLib::ParseDecal (FScanner &sc)
|
void FDecalLib::ParseDecal (FScanner &sc)
|
||||||
{
|
{
|
||||||
FString decalName;
|
FString decalName;
|
||||||
WORD decalNum;
|
uint16_t decalNum;
|
||||||
FDecalTemplate newdecal;
|
FDecalTemplate newdecal;
|
||||||
FTextureID picnum;
|
FTextureID picnum;
|
||||||
int lumpnum;
|
int lumpnum;
|
||||||
|
@ -569,7 +569,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
|
||||||
void FDecalLib::ParseDecalGroup (FScanner &sc)
|
void FDecalLib::ParseDecalGroup (FScanner &sc)
|
||||||
{
|
{
|
||||||
FString groupName;
|
FString groupName;
|
||||||
WORD decalNum;
|
uint16_t decalNum;
|
||||||
FDecalBase *targetDecal;
|
FDecalBase *targetDecal;
|
||||||
FDecalGroup *group;
|
FDecalGroup *group;
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ void FDecalLib::ReplaceDecalRef (FDecalBase *from, FDecalBase *to, FDecalBase *r
|
||||||
root->ReplaceDecalRef (from, to);
|
root->ReplaceDecalRef (from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDecalLib::AddDecal (const char *name, WORD num, const FDecalTemplate &decal)
|
void FDecalLib::AddDecal (const char *name, uint16_t num, const FDecalTemplate &decal)
|
||||||
{
|
{
|
||||||
FDecalTemplate *newDecal = new FDecalTemplate;
|
FDecalTemplate *newDecal = new FDecalTemplate;
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ void FDecalLib::AddDecal (FDecalBase *decal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const FDecalTemplate *FDecalLib::GetDecalByNum (WORD num) const
|
const FDecalTemplate *FDecalLib::GetDecalByNum (uint16_t num) const
|
||||||
{
|
{
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
{
|
{
|
||||||
|
@ -972,7 +972,7 @@ const FDecalTemplate *FDecalLib::GetDecalByName (const char *name) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FDecalBase *FDecalLib::ScanTreeForNum (const WORD num, FDecalBase *root)
|
FDecalBase *FDecalLib::ScanTreeForNum (const uint16_t num, FDecalBase *root)
|
||||||
{
|
{
|
||||||
while (root != NULL)
|
while (root != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1109,7 +1109,7 @@ FDecalLib::FTranslation::FTranslation (DWORD start, DWORD end)
|
||||||
table[i] = ColorMatcher.Pick (ri >> 24, gi >> 24, bi >> 24);
|
table[i] = ColorMatcher.Pick (ri >> 24, gi >> 24, bi >> 24);
|
||||||
}
|
}
|
||||||
table[0] = table[1];
|
table[0] = table[1];
|
||||||
Index = (WORD)TRANSLATION(TRANSLATION_Decals, tablei >> 8);
|
Index = (uint16_t)TRANSLATION(TRANSLATION_Decals, tablei >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
FDecalLib::FTranslation *FDecalLib::FTranslation::LocateTranslation (DWORD start, DWORD end)
|
FDecalLib::FTranslation *FDecalLib::FTranslation::LocateTranslation (DWORD start, DWORD end)
|
||||||
|
|
|
@ -641,7 +641,7 @@ void PInt::SetValue(void *addr, int val)
|
||||||
}
|
}
|
||||||
else if (Size == 2)
|
else if (Size == 2)
|
||||||
{
|
{
|
||||||
*(WORD *)addr = val;
|
*(uint16_t *)addr = val;
|
||||||
}
|
}
|
||||||
else if (Size == 8)
|
else if (Size == 8)
|
||||||
{
|
{
|
||||||
|
@ -677,7 +677,7 @@ int PInt::GetValueInt(void *addr) const
|
||||||
}
|
}
|
||||||
else if (Size == 2)
|
else if (Size == 2)
|
||||||
{
|
{
|
||||||
return Unsigned ? *(WORD *)addr : *(SWORD *)addr;
|
return Unsigned ? *(uint16_t *)addr : *(SWORD *)addr;
|
||||||
}
|
}
|
||||||
else if (Size == 8)
|
else if (Size == 8)
|
||||||
{ // truncated output
|
{ // truncated output
|
||||||
|
|
|
@ -41,38 +41,38 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
#define MIDI_SYSEX ((BYTE)0xF0) // SysEx begin
|
#define MIDI_SYSEX ((uint8_t)0xF0) // SysEx begin
|
||||||
#define MIDI_SYSEXEND ((BYTE)0xF7) // SysEx end
|
#define MIDI_SYSEXEND ((uint8_t)0xF7) // SysEx end
|
||||||
#define MIDI_META ((BYTE)0xFF) // Meta event begin
|
#define MIDI_META ((uint8_t)0xFF) // Meta event begin
|
||||||
#define MIDI_META_TEMPO ((BYTE)0x51)
|
#define MIDI_META_TEMPO ((uint8_t)0x51)
|
||||||
#define MIDI_META_EOT ((BYTE)0x2F) // End-of-track
|
#define MIDI_META_EOT ((uint8_t)0x2F) // End-of-track
|
||||||
#define MIDI_META_SSPEC ((BYTE)0x7F) // System-specific event
|
#define MIDI_META_SSPEC ((uint8_t)0x7F) // System-specific event
|
||||||
|
|
||||||
#define MIDI_NOTEOFF ((BYTE)0x80) // + note + velocity
|
#define MIDI_NOTEOFF ((uint8_t)0x80) // + note + velocity
|
||||||
#define MIDI_NOTEON ((BYTE)0x90) // + note + velocity
|
#define MIDI_NOTEON ((uint8_t)0x90) // + note + velocity
|
||||||
#define MIDI_POLYPRESS ((BYTE)0xA0) // + pressure (2 bytes)
|
#define MIDI_POLYPRESS ((uint8_t)0xA0) // + pressure (2 bytes)
|
||||||
#define MIDI_CTRLCHANGE ((BYTE)0xB0) // + ctrlr + value
|
#define MIDI_CTRLCHANGE ((uint8_t)0xB0) // + ctrlr + value
|
||||||
#define MIDI_PRGMCHANGE ((BYTE)0xC0) // + new patch
|
#define MIDI_PRGMCHANGE ((uint8_t)0xC0) // + new patch
|
||||||
#define MIDI_CHANPRESS ((BYTE)0xD0) // + pressure (1 byte)
|
#define MIDI_CHANPRESS ((uint8_t)0xD0) // + pressure (1 byte)
|
||||||
#define MIDI_PITCHBEND ((BYTE)0xE0) // + pitch bend (2 bytes)
|
#define MIDI_PITCHBEND ((uint8_t)0xE0) // + pitch bend (2 bytes)
|
||||||
|
|
||||||
#define MUS_NOTEOFF ((BYTE)0x00)
|
#define MUS_NOTEOFF ((uint8_t)0x00)
|
||||||
#define MUS_NOTEON ((BYTE)0x10)
|
#define MUS_NOTEON ((uint8_t)0x10)
|
||||||
#define MUS_PITCHBEND ((BYTE)0x20)
|
#define MUS_PITCHBEND ((uint8_t)0x20)
|
||||||
#define MUS_SYSEVENT ((BYTE)0x30)
|
#define MUS_SYSEVENT ((uint8_t)0x30)
|
||||||
#define MUS_CTRLCHANGE ((BYTE)0x40)
|
#define MUS_CTRLCHANGE ((uint8_t)0x40)
|
||||||
#define MUS_SCOREEND ((BYTE)0x60)
|
#define MUS_SCOREEND ((uint8_t)0x60)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DWORD Magic;
|
uint32_t Magic;
|
||||||
WORD SongLen;
|
uint16_t SongLen;
|
||||||
WORD SongStart;
|
uint16_t SongStart;
|
||||||
WORD NumChans;
|
uint16_t NumChans;
|
||||||
WORD NumSecondaryChans;
|
uint16_t NumSecondaryChans;
|
||||||
WORD NumInstruments;
|
uint16_t NumInstruments;
|
||||||
WORD Pad;
|
uint16_t Pad;
|
||||||
// WORD UsedInstruments[NumInstruments];
|
// uint16_t UsedInstruments[NumInstruments];
|
||||||
} MUSHeader;
|
} MUSHeader;
|
||||||
|
|
||||||
#endif //__MUS2MIDI_H__
|
#endif //__MUS2MIDI_H__
|
||||||
|
|
|
@ -79,15 +79,15 @@ struct FRandomSoundList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD *Sounds; // A list of sounds that can result for the following id
|
uint16_t *Sounds; // A list of sounds that can result for the following id
|
||||||
WORD SfxHead; // The sound id used to reference this list
|
uint16_t SfxHead; // The sound id used to reference this list
|
||||||
WORD NumSounds;
|
uint16_t NumSounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FPlayerClassLookup
|
struct FPlayerClassLookup
|
||||||
{
|
{
|
||||||
FString Name;
|
FString Name;
|
||||||
WORD ListIndex[3]; // indices into PlayerSounds (0xffff means empty)
|
uint16_t ListIndex[3]; // indices into PlayerSounds (0xffff means empty)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used to lookup a sound like "*grunt". This contains all player sounds for
|
// Used to lookup a sound like "*grunt". This contains all player sounds for
|
||||||
|
@ -1070,7 +1070,7 @@ void S_AddLocalSndInfo(int lump)
|
||||||
static void S_AddSNDINFO (int lump)
|
static void S_AddSNDINFO (int lump)
|
||||||
{
|
{
|
||||||
bool skipToEndIf;
|
bool skipToEndIf;
|
||||||
TArray<WORD> list;
|
TArray<uint16_t> list;
|
||||||
|
|
||||||
FScanner sc(lump);
|
FScanner sc(lump);
|
||||||
skipToEndIf = false;
|
skipToEndIf = false;
|
||||||
|
@ -1395,7 +1395,7 @@ static void S_AddSNDINFO (int lump)
|
||||||
sc.MustGetStringName ("{");
|
sc.MustGetStringName ("{");
|
||||||
while (sc.GetString () && !sc.Compare ("}"))
|
while (sc.GetString () && !sc.Compare ("}"))
|
||||||
{
|
{
|
||||||
WORD sfxto = S_FindSoundTentative (sc.String);
|
uint16_t sfxto = S_FindSoundTentative (sc.String);
|
||||||
if (sfxto == random.SfxHead)
|
if (sfxto == random.SfxHead)
|
||||||
{
|
{
|
||||||
Printf("Definition of random sound '%s' refers to itself recursively.", sc.String);
|
Printf("Definition of random sound '%s' refers to itself recursively.", sc.String);
|
||||||
|
@ -1410,11 +1410,11 @@ static void S_AddSNDINFO (int lump)
|
||||||
}
|
}
|
||||||
else if (list.Size() > 1)
|
else if (list.Size() > 1)
|
||||||
{ // Only add non-empty random lists
|
{ // Only add non-empty random lists
|
||||||
random.NumSounds = (WORD)list.Size();
|
random.NumSounds = (uint16_t)list.Size();
|
||||||
S_sfx[random.SfxHead].link = (WORD)S_rnd.Push (random);
|
S_sfx[random.SfxHead].link = (uint16_t)S_rnd.Push (random);
|
||||||
S_sfx[random.SfxHead].bRandomHeader = true;
|
S_sfx[random.SfxHead].bRandomHeader = true;
|
||||||
S_rnd[S_sfx[random.SfxHead].link].Sounds = new WORD[random.NumSounds];
|
S_rnd[S_sfx[random.SfxHead].link].Sounds = new uint16_t[random.NumSounds];
|
||||||
memcpy (S_rnd[S_sfx[random.SfxHead].link].Sounds, &list[0], sizeof(WORD)*random.NumSounds);
|
memcpy (S_rnd[S_sfx[random.SfxHead].link].Sounds, &list[0], sizeof(uint16_t)*random.NumSounds);
|
||||||
S_sfx[random.SfxHead].NearLimit = -1;
|
S_sfx[random.SfxHead].NearLimit = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1700,7 +1700,7 @@ static int S_AddPlayerGender (int classnum, int gender)
|
||||||
if (index == 0xffff)
|
if (index == 0xffff)
|
||||||
{
|
{
|
||||||
index = PlayerSounds.Reserve (1);
|
index = PlayerSounds.Reserve (1);
|
||||||
PlayerClassLookups[classnum].ListIndex[gender] = (WORD)index;
|
PlayerClassLookups[classnum].ListIndex[gender] = (uint16_t)index;
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,17 +50,17 @@ struct sfxinfo_t
|
||||||
SWORD NearLimit; // 0 means unlimited
|
SWORD NearLimit; // 0 means unlimited
|
||||||
float LimitRange; // Range for sound limiting (squared for faster computations)
|
float LimitRange; // Range for sound limiting (squared for faster computations)
|
||||||
|
|
||||||
WORD bRandomHeader:1;
|
unsigned bRandomHeader:1;
|
||||||
WORD bPlayerReserve:1;
|
unsigned bPlayerReserve:1;
|
||||||
WORD bLoadRAW:1;
|
unsigned bLoadRAW:1;
|
||||||
WORD bPlayerCompat:1;
|
unsigned bPlayerCompat:1;
|
||||||
WORD b16bit:1;
|
unsigned b16bit:1;
|
||||||
WORD bUsed:1;
|
unsigned bUsed:1;
|
||||||
WORD bSingular:1;
|
unsigned bSingular:1;
|
||||||
WORD bTentative:1;
|
unsigned bTentative:1;
|
||||||
WORD bPlayerSilent:1; // This player sound is intentionally silent.
|
unsigned bPlayerSilent:1; // This player sound is intentionally silent.
|
||||||
|
|
||||||
WORD RawRate; // Sample rate to use when bLoadRAW is true
|
int RawRate; // Sample rate to use when bLoadRAW is true
|
||||||
|
|
||||||
int LoopStart; // -1 means no specific loop defined
|
int LoopStart; // -1 means no specific loop defined
|
||||||
|
|
||||||
|
|
|
@ -80,26 +80,26 @@ typedef struct tagITFILEHEADER
|
||||||
{
|
{
|
||||||
DWORD id; // 0x4D504D49
|
DWORD id; // 0x4D504D49
|
||||||
char songname[26];
|
char songname[26];
|
||||||
WORD reserved1; // 0x1004
|
uint16_t reserved1; // 0x1004
|
||||||
WORD ordnum;
|
uint16_t ordnum;
|
||||||
WORD insnum;
|
uint16_t insnum;
|
||||||
WORD smpnum;
|
uint16_t smpnum;
|
||||||
WORD patnum;
|
uint16_t patnum;
|
||||||
WORD cwtv;
|
uint16_t cwtv;
|
||||||
WORD cmwt;
|
uint16_t cmwt;
|
||||||
WORD flags;
|
uint16_t flags;
|
||||||
WORD special;
|
uint16_t special;
|
||||||
BYTE globalvol;
|
uint8_t globalvol;
|
||||||
BYTE mv;
|
uint8_t mv;
|
||||||
BYTE speed;
|
uint8_t speed;
|
||||||
BYTE tempo;
|
uint8_t tempo;
|
||||||
BYTE sep;
|
uint8_t sep;
|
||||||
BYTE zero;
|
uint8_t zero;
|
||||||
WORD msglength;
|
uint16_t msglength;
|
||||||
DWORD msgoffset;
|
DWORD msgoffset;
|
||||||
DWORD reserved2;
|
DWORD reserved2;
|
||||||
BYTE chnpan[64];
|
uint8_t chnpan[64];
|
||||||
BYTE chnvol[64];
|
uint8_t chnvol[64];
|
||||||
} FORCE_PACKED ITFILEHEADER, *PITFILEHEADER;
|
} FORCE_PACKED ITFILEHEADER, *PITFILEHEADER;
|
||||||
|
|
||||||
typedef struct MODMIDICFG
|
typedef struct MODMIDICFG
|
||||||
|
@ -242,7 +242,7 @@ static void ReadDUH(DUH * duh, input_mod *info, bool meta, bool dos)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static bool ReadIT(const BYTE * ptr, unsigned size, input_mod *info, bool meta)
|
static bool ReadIT(const uint8_t * ptr, unsigned size, input_mod *info, bool meta)
|
||||||
{
|
{
|
||||||
PITFILEHEADER pifh = (PITFILEHEADER) ptr;
|
PITFILEHEADER pifh = (PITFILEHEADER) ptr;
|
||||||
if ((!ptr) || (size < 0x100)) return false;
|
if ((!ptr) || (size < 0x100)) return false;
|
||||||
|
@ -327,7 +327,7 @@ static bool ReadIT(const BYTE * ptr, unsigned size, input_mod *info, bool meta)
|
||||||
|
|
||||||
if (pos < size)
|
if (pos < size)
|
||||||
{
|
{
|
||||||
WORD val16 = LittleShort( *(WORD *)(ptr + pos) );
|
uint16_t val16 = LittleShort( *(uint16_t *)(ptr + pos) );
|
||||||
pos += 2;
|
pos += 2;
|
||||||
if (pos + val16 * 8 < size) pos += val16 * 8;
|
if (pos + val16 * 8 < size) pos += val16 * 8;
|
||||||
}
|
}
|
||||||
|
@ -395,24 +395,24 @@ static bool ReadIT(const BYTE * ptr, unsigned size, input_mod *info, bool meta)
|
||||||
|
|
||||||
offset = (DWORD *)(ptr + 0xC0 + LittleShort(pifh->ordnum) + LittleShort(pifh->insnum) * 4 + LittleShort(pifh->smpnum) * 4);
|
offset = (DWORD *)(ptr + 0xC0 + LittleShort(pifh->ordnum) + LittleShort(pifh->insnum) * 4 + LittleShort(pifh->smpnum) * 4);
|
||||||
|
|
||||||
BYTE chnmask[64];
|
uint8_t chnmask[64];
|
||||||
|
|
||||||
for (n = 0, l = LittleShort(pifh->patnum); n < l; n++)
|
for (n = 0, l = LittleShort(pifh->patnum); n < l; n++)
|
||||||
{
|
{
|
||||||
memset(chnmask, 0, sizeof(chnmask));
|
memset(chnmask, 0, sizeof(chnmask));
|
||||||
DWORD offset_n = LittleLong( offset[n] );
|
DWORD offset_n = LittleLong( offset[n] );
|
||||||
if ((!offset_n) || (offset_n + 4 >= size)) continue;
|
if ((!offset_n) || (offset_n + 4 >= size)) continue;
|
||||||
unsigned len = LittleShort(*(WORD *)(ptr + offset_n));
|
unsigned len = LittleShort(*(uint16_t *)(ptr + offset_n));
|
||||||
unsigned rows = LittleShort(*(WORD *)(ptr + offset_n + 2));
|
unsigned rows = LittleShort(*(uint16_t *)(ptr + offset_n + 2));
|
||||||
if ((rows < 4) || (rows > 256)) continue;
|
if ((rows < 4) || (rows > 256)) continue;
|
||||||
if (offset_n + 8 + len > size) continue;
|
if (offset_n + 8 + len > size) continue;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
const BYTE * p = ptr + offset_n + 8;
|
const uint8_t * p = ptr + offset_n + 8;
|
||||||
unsigned nrow = 0;
|
unsigned nrow = 0;
|
||||||
while (nrow < rows)
|
while (nrow < rows)
|
||||||
{
|
{
|
||||||
if (i >= len) break;
|
if (i >= len) break;
|
||||||
BYTE b = p[i++];
|
uint8_t b = p[i++];
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
nrow++;
|
nrow++;
|
||||||
|
@ -464,7 +464,7 @@ static bool ReadIT(const BYTE * ptr, unsigned size, input_mod *info, bool meta)
|
||||||
|
|
||||||
typedef struct tdumbfile_mem_status
|
typedef struct tdumbfile_mem_status
|
||||||
{
|
{
|
||||||
const BYTE *ptr;
|
const uint8_t *ptr;
|
||||||
unsigned int offset, size;
|
unsigned int offset, size;
|
||||||
} dumbfile_mem_status;
|
} dumbfile_mem_status;
|
||||||
|
|
||||||
|
@ -537,15 +537,15 @@ static DUMBFILE_SYSTEM mem_dfs = {
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
DUMBFILE *dumb_read_allfile(dumbfile_mem_status *filestate, BYTE *start, FileReader &reader, int lenhave, int lenfull)
|
DUMBFILE *dumb_read_allfile(dumbfile_mem_status *filestate, uint8_t *start, FileReader &reader, int lenhave, int lenfull)
|
||||||
{
|
{
|
||||||
filestate->size = lenfull;
|
filestate->size = lenfull;
|
||||||
filestate->offset = 0;
|
filestate->offset = 0;
|
||||||
if (lenhave >= lenfull)
|
if (lenhave >= lenfull)
|
||||||
filestate->ptr = (BYTE *)start;
|
filestate->ptr = (uint8_t *)start;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BYTE *mem = new BYTE[lenfull];
|
uint8_t *mem = new uint8_t[lenfull];
|
||||||
memcpy(mem, start, lenhave);
|
memcpy(mem, start, lenhave);
|
||||||
if (reader.Read(mem + lenhave, lenfull - lenhave) != (lenfull - lenhave))
|
if (reader.Read(mem + lenhave, lenfull - lenhave) != (lenfull - lenhave))
|
||||||
{
|
{
|
||||||
|
@ -758,7 +758,7 @@ MusInfo *MOD_OpenSong(FileReader &reader)
|
||||||
int headsize;
|
int headsize;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
BYTE start[64];
|
uint8_t start[64];
|
||||||
DWORD dstart[64/4];
|
DWORD dstart[64/4];
|
||||||
};
|
};
|
||||||
dumbfile_mem_status filestate;
|
dumbfile_mem_status filestate;
|
||||||
|
@ -891,7 +891,7 @@ MusInfo *MOD_OpenSong(FileReader &reader)
|
||||||
if ( ! duh )
|
if ( ! duh )
|
||||||
{
|
{
|
||||||
is_dos = false;
|
is_dos = false;
|
||||||
if (filestate.ptr == (BYTE *)start)
|
if (filestate.ptr == (uint8_t *)start)
|
||||||
{
|
{
|
||||||
if (!(f = dumb_read_allfile(&filestate, start, reader, headsize, size)))
|
if (!(f = dumb_read_allfile(&filestate, start, reader, headsize, size)))
|
||||||
{
|
{
|
||||||
|
@ -938,9 +938,9 @@ MusInfo *MOD_OpenSong(FileReader &reader)
|
||||||
// Reposition file pointer for other codecs to do their checks.
|
// Reposition file pointer for other codecs to do their checks.
|
||||||
reader.Seek(fpos, SEEK_SET);
|
reader.Seek(fpos, SEEK_SET);
|
||||||
}
|
}
|
||||||
if (filestate.ptr != (BYTE *)start)
|
if (filestate.ptr != (uint8_t *)start)
|
||||||
{
|
{
|
||||||
delete[] const_cast<BYTE *>(filestate.ptr);
|
delete[] const_cast<uint8_t *>(filestate.ptr);
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ bool input_mod::read(SoundStream *stream, void *buffer, int sizebytes, void *use
|
||||||
((float *)buffer)[i] = (((int *)buffer)[i] / (float)(1 << 24)) * mod_dumb_mastervolume;
|
((float *)buffer)[i] = (((int *)buffer)[i] / (float)(1 << 24)) * mod_dumb_mastervolume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer = (BYTE *)buffer + written * 8;
|
buffer = (uint8_t *)buffer + written * 8;
|
||||||
sizebytes -= written * 8;
|
sizebytes -= written * 8;
|
||||||
}
|
}
|
||||||
state->crit_sec.Leave();
|
state->crit_sec.Leave();
|
||||||
|
|
|
@ -51,18 +51,18 @@ struct FmtChunk
|
||||||
{
|
{
|
||||||
DWORD ChunkID;
|
DWORD ChunkID;
|
||||||
DWORD ChunkLen;
|
DWORD ChunkLen;
|
||||||
WORD FormatTag;
|
uint16_t FormatTag;
|
||||||
WORD Channels;
|
uint16_t Channels;
|
||||||
DWORD SamplesPerSec;
|
DWORD SamplesPerSec;
|
||||||
DWORD AvgBytesPerSec;
|
DWORD AvgBytesPerSec;
|
||||||
WORD BlockAlign;
|
uint16_t BlockAlign;
|
||||||
WORD BitsPerSample;
|
uint16_t BitsPerSample;
|
||||||
WORD ExtensionSize;
|
uint16_t ExtensionSize;
|
||||||
WORD ValidBitsPerSample;
|
uint16_t ValidBitsPerSample;
|
||||||
DWORD ChannelMask;
|
DWORD ChannelMask;
|
||||||
DWORD SubFormatA;
|
DWORD SubFormatA;
|
||||||
WORD SubFormatB;
|
uint16_t SubFormatB;
|
||||||
WORD SubFormatC;
|
uint16_t SubFormatC;
|
||||||
BYTE SubFormatD[8];
|
BYTE SubFormatD[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ int TimidityMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void TimidityMIDIDevice::PrecacheInstruments(const WORD *instruments, int count)
|
void TimidityMIDIDevice::PrecacheInstruments(const uint16_t *instruments, int count)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,9 +58,9 @@ struct PfxState
|
||||||
} Bits16;
|
} Bits16;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 Red;
|
uint32_t Red;
|
||||||
uint32 Green;
|
uint32_t Green;
|
||||||
uint32 Blue;
|
uint32_t Blue;
|
||||||
} Bits32;
|
} Bits32;
|
||||||
} Masks;
|
} Masks;
|
||||||
BYTE RedShift;
|
BYTE RedShift;
|
||||||
|
@ -70,7 +70,7 @@ struct PfxState
|
||||||
BITFIELD BlueLeft:1;
|
BITFIELD BlueLeft:1;
|
||||||
BITFIELD GreenLeft:1;
|
BITFIELD GreenLeft:1;
|
||||||
|
|
||||||
void SetFormat (int bits, uint32 redMask, uint32 greenMask, uint32 blueMask);
|
void SetFormat (int bits, uint32_t redMask, uint32_t greenMask, uint32_t blueMask);
|
||||||
void (*SetPalette) (const PalEntry *pal);
|
void (*SetPalette) (const PalEntry *pal);
|
||||||
void (*Convert) (BYTE *src, int srcpitch,
|
void (*Convert) (BYTE *src, int srcpitch,
|
||||||
void *dest, int destpitch, int destwidth, int destheight,
|
void *dest, int destpitch, int destwidth, int destheight,
|
||||||
|
|
66
src/w_zip.h
66
src/w_zip.h
|
@ -5,53 +5,53 @@
|
||||||
// FZipCentralInfo
|
// FZipCentralInfo
|
||||||
struct FZipEndOfCentralDirectory
|
struct FZipEndOfCentralDirectory
|
||||||
{
|
{
|
||||||
DWORD Magic;
|
uint32_t Magic;
|
||||||
WORD DiskNumber;
|
uint16_t DiskNumber;
|
||||||
WORD FirstDisk;
|
uint16_t FirstDisk;
|
||||||
WORD NumEntries;
|
uint16_t NumEntries;
|
||||||
WORD NumEntriesOnAllDisks;
|
uint16_t NumEntriesOnAllDisks;
|
||||||
DWORD DirectorySize;
|
uint32_t DirectorySize;
|
||||||
DWORD DirectoryOffset;
|
uint32_t DirectoryOffset;
|
||||||
WORD ZipCommentLength;
|
uint16_t ZipCommentLength;
|
||||||
} FORCE_PACKED;
|
} FORCE_PACKED;
|
||||||
|
|
||||||
// FZipFileInfo
|
// FZipFileInfo
|
||||||
struct FZipCentralDirectoryInfo
|
struct FZipCentralDirectoryInfo
|
||||||
{
|
{
|
||||||
DWORD Magic;
|
uint32_t Magic;
|
||||||
BYTE VersionMadeBy[2];
|
BYTE VersionMadeBy[2];
|
||||||
BYTE VersionToExtract[2];
|
BYTE VersionToExtract[2];
|
||||||
WORD Flags;
|
uint16_t Flags;
|
||||||
WORD Method;
|
uint16_t Method;
|
||||||
WORD ModTime;
|
uint16_t ModTime;
|
||||||
WORD ModDate;
|
uint16_t ModDate;
|
||||||
DWORD CRC32;
|
uint32_t CRC32;
|
||||||
DWORD CompressedSize;
|
uint32_t CompressedSize;
|
||||||
DWORD UncompressedSize;
|
uint32_t UncompressedSize;
|
||||||
WORD NameLength;
|
uint16_t NameLength;
|
||||||
WORD ExtraLength;
|
uint16_t ExtraLength;
|
||||||
WORD CommentLength;
|
uint16_t CommentLength;
|
||||||
WORD StartingDiskNumber;
|
uint16_t StartingDiskNumber;
|
||||||
WORD InternalAttributes;
|
uint16_t InternalAttributes;
|
||||||
DWORD ExternalAttributes;
|
uint32_t ExternalAttributes;
|
||||||
DWORD LocalHeaderOffset;
|
uint32_t LocalHeaderOffset;
|
||||||
// file name and other variable length info follows
|
// file name and other variable length info follows
|
||||||
} FORCE_PACKED;
|
} FORCE_PACKED;
|
||||||
|
|
||||||
// FZipLocalHeader
|
// FZipLocalHeader
|
||||||
struct FZipLocalFileHeader
|
struct FZipLocalFileHeader
|
||||||
{
|
{
|
||||||
DWORD Magic;
|
uint32_t Magic;
|
||||||
BYTE VersionToExtract[2];
|
BYTE VersionToExtract[2];
|
||||||
WORD Flags;
|
uint16_t Flags;
|
||||||
WORD Method;
|
uint16_t Method;
|
||||||
WORD ModTime;
|
uint16_t ModTime;
|
||||||
WORD ModDate;
|
uint16_t ModDate;
|
||||||
DWORD CRC32;
|
uint32_t CRC32;
|
||||||
DWORD CompressedSize;
|
uint32_t CompressedSize;
|
||||||
DWORD UncompressedSize;
|
uint32_t UncompressedSize;
|
||||||
WORD NameLength;
|
uint16_t NameLength;
|
||||||
WORD ExtraLength;
|
uint16_t ExtraLength;
|
||||||
// file name and other variable length info follows
|
// file name and other variable length info follows
|
||||||
} FORCE_PACKED;
|
} FORCE_PACKED;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue