parent
a1be167fd3
commit
ca69505055
60
src/color.cc
60
src/color.cc
|
@ -7,35 +7,47 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
static int colorPaletteFileOpen(const char* filePath, int flags);
|
||||
static int colorPaletteFileRead(int fd, void* buffer, size_t size);
|
||||
static int colorPaletteFileClose(int fd);
|
||||
static void* colorPaletteMallocDefaultImpl(size_t size);
|
||||
static void* colorPaletteReallocDefaultImpl(void* ptr, size_t size);
|
||||
static void colorPaletteFreeDefaultImpl(void* ptr);
|
||||
static void _setIntensityTableColor(int a1);
|
||||
static void _setIntensityTables();
|
||||
static void _setMixTableColor(int a1);
|
||||
static void _buildBlendTable(unsigned char* ptr, unsigned char ch);
|
||||
static void _rebuildColorBlendTables();
|
||||
|
||||
// 0x50F930
|
||||
char _aColor_cNoError[] = "color.c: No errors\n";
|
||||
static char _aColor_cNoError[] = "color.c: No errors\n";
|
||||
|
||||
// 0x50F95C
|
||||
char _aColor_cColorTa[] = "color.c: color table not found\n";
|
||||
static char _aColor_cColorTa[] = "color.c: color table not found\n";
|
||||
|
||||
// 0x51DF10
|
||||
char* _errorStr = _aColor_cNoError;
|
||||
static char* _errorStr = _aColor_cNoError;
|
||||
|
||||
// 0x51DF14
|
||||
bool _colorsInited = false;
|
||||
static bool _colorsInited = false;
|
||||
|
||||
// 0x51DF18
|
||||
double gBrightness = 1.0;
|
||||
static double gBrightness = 1.0;
|
||||
|
||||
// 0x51DF20
|
||||
ColorTransitionCallback* gColorPaletteTransitionCallback = NULL;
|
||||
static ColorTransitionCallback* gColorPaletteTransitionCallback = NULL;
|
||||
|
||||
// 0x51DF24
|
||||
MallocProc* gColorPaletteMallocProc = colorPaletteMallocDefaultImpl;
|
||||
static MallocProc* gColorPaletteMallocProc = colorPaletteMallocDefaultImpl;
|
||||
|
||||
// 0x51DF28
|
||||
ReallocProc* gColorPaletteReallocProc = colorPaletteReallocDefaultImpl;
|
||||
static ReallocProc* gColorPaletteReallocProc = colorPaletteReallocDefaultImpl;
|
||||
|
||||
// 0x51DF2C
|
||||
FreeProc* gColorPaletteFreeProc = colorPaletteFreeDefaultImpl;
|
||||
static FreeProc* gColorPaletteFreeProc = colorPaletteFreeDefaultImpl;
|
||||
|
||||
// 0x51DF30
|
||||
ColorFileNameManger* gColorFileNameMangler = NULL;
|
||||
static ColorFileNameManger* gColorFileNameMangler = NULL;
|
||||
|
||||
// 0x51DF34
|
||||
unsigned char _cmap[768] = {
|
||||
|
@ -67,18 +79,18 @@ unsigned char _colorMixMulTable[65536];
|
|||
unsigned char _colorTable[32768];
|
||||
|
||||
// 0x6AB928
|
||||
ColorPaletteFileReadProc* gColorPaletteFileReadProc;
|
||||
static ColorPaletteFileReadProc* gColorPaletteFileReadProc;
|
||||
|
||||
// 0x6AB92C
|
||||
ColorPaletteCloseProc* gColorPaletteFileCloseProc;
|
||||
static ColorPaletteCloseProc* gColorPaletteFileCloseProc;
|
||||
|
||||
// 0x6AB930
|
||||
ColorPaletteFileOpenProc* gColorPaletteFileOpenProc;
|
||||
static ColorPaletteFileOpenProc* gColorPaletteFileOpenProc;
|
||||
|
||||
// NOTE: Inlined.
|
||||
//
|
||||
// 0x4C7200
|
||||
int colorPaletteFileOpen(const char* filePath, int flags)
|
||||
static int colorPaletteFileOpen(const char* filePath, int flags)
|
||||
{
|
||||
if (gColorPaletteFileOpenProc != NULL) {
|
||||
return gColorPaletteFileOpenProc(filePath, flags);
|
||||
|
@ -90,7 +102,7 @@ int colorPaletteFileOpen(const char* filePath, int flags)
|
|||
// NOTE: Inlined.
|
||||
//
|
||||
// 0x4C7218
|
||||
int colorPaletteFileRead(int fd, void* buffer, size_t size)
|
||||
static int colorPaletteFileRead(int fd, void* buffer, size_t size)
|
||||
{
|
||||
if (gColorPaletteFileReadProc != NULL) {
|
||||
return gColorPaletteFileReadProc(fd, buffer, size);
|
||||
|
@ -102,7 +114,7 @@ int colorPaletteFileRead(int fd, void* buffer, size_t size)
|
|||
// NOTE: Inlined.
|
||||
//
|
||||
// 0x4C7230
|
||||
int colorPaletteFileClose(int fd)
|
||||
static int colorPaletteFileClose(int fd)
|
||||
{
|
||||
if (gColorPaletteFileCloseProc != NULL) {
|
||||
return gColorPaletteFileCloseProc(fd);
|
||||
|
@ -120,19 +132,19 @@ void colorPaletteSetFileIO(ColorPaletteFileOpenProc* openProc, ColorPaletteFileR
|
|||
}
|
||||
|
||||
// 0x4C725C
|
||||
void* colorPaletteMallocDefaultImpl(size_t size)
|
||||
static void* colorPaletteMallocDefaultImpl(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
// 0x4C7264
|
||||
void* colorPaletteReallocDefaultImpl(void* ptr, size_t size)
|
||||
static void* colorPaletteReallocDefaultImpl(void* ptr, size_t size)
|
||||
{
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
|
||||
// 0x4C726C
|
||||
void colorPaletteFreeDefaultImpl(void* ptr)
|
||||
static void colorPaletteFreeDefaultImpl(void* ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
@ -225,7 +237,7 @@ void _setSystemPaletteEntries(unsigned char* palette, int start, int end)
|
|||
}
|
||||
|
||||
// 0x4C7550
|
||||
void _setIntensityTableColor(int a1)
|
||||
static void _setIntensityTableColor(int a1)
|
||||
{
|
||||
int v1, v2, v3, v4, v5, v6, v7, v8, v9, v10;
|
||||
|
||||
|
@ -252,7 +264,7 @@ void _setIntensityTableColor(int a1)
|
|||
}
|
||||
|
||||
// 0x4C7658
|
||||
void _setIntensityTables()
|
||||
static void _setIntensityTables()
|
||||
{
|
||||
for (int index = 0; index < 256; index++) {
|
||||
if (_mappedColor[index] != 0) {
|
||||
|
@ -264,7 +276,7 @@ void _setIntensityTables()
|
|||
}
|
||||
|
||||
// 0x4C769C
|
||||
void _setMixTableColor(int a1)
|
||||
static void _setMixTableColor(int a1)
|
||||
{
|
||||
int i;
|
||||
int v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19;
|
||||
|
@ -436,7 +448,7 @@ char* _colorError()
|
|||
}
|
||||
|
||||
// 0x4C7B44
|
||||
void _buildBlendTable(unsigned char* ptr, unsigned char ch)
|
||||
static void _buildBlendTable(unsigned char* ptr, unsigned char ch)
|
||||
{
|
||||
int r, g, b;
|
||||
int i, j;
|
||||
|
@ -496,7 +508,7 @@ void _buildBlendTable(unsigned char* ptr, unsigned char ch)
|
|||
}
|
||||
|
||||
// 0x4C7D90
|
||||
void _rebuildColorBlendTables()
|
||||
static void _rebuildColorBlendTables()
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
27
src/color.h
27
src/color.h
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include "memory_defs.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef const char*(ColorFileNameManger)(const char*);
|
||||
typedef void(ColorTransitionCallback)();
|
||||
|
||||
|
@ -12,17 +10,6 @@ typedef int(ColorPaletteFileOpenProc)(const char* path, int mode);
|
|||
typedef int(ColorPaletteFileReadProc)(int fd, void* buffer, size_t size);
|
||||
typedef int(ColorPaletteCloseProc)(int fd);
|
||||
|
||||
extern char _aColor_cNoError[];
|
||||
extern char _aColor_cColorTa[];
|
||||
|
||||
extern char* _errorStr;
|
||||
extern bool _colorsInited;
|
||||
extern double gBrightness;
|
||||
extern ColorTransitionCallback* gColorPaletteTransitionCallback;
|
||||
extern MallocProc* gColorPaletteMallocProc;
|
||||
extern ReallocProc* gColorPaletteReallocProc;
|
||||
extern FreeProc* gColorPaletteFreeProc;
|
||||
extern ColorFileNameManger* gColorFileNameMangler;
|
||||
extern unsigned char _cmap[768];
|
||||
|
||||
extern unsigned char _systemCmap[256 * 3];
|
||||
|
@ -33,17 +20,8 @@ extern unsigned char _colorMixAddTable[65536];
|
|||
extern unsigned char _intensityColorTable[65536];
|
||||
extern unsigned char _colorMixMulTable[65536];
|
||||
extern unsigned char _colorTable[32768];
|
||||
extern ColorPaletteFileReadProc* gColorPaletteFileReadProc;
|
||||
extern ColorPaletteCloseProc* gColorPaletteFileCloseProc;
|
||||
extern ColorPaletteFileOpenProc* gColorPaletteFileOpenProc;
|
||||
|
||||
int colorPaletteFileOpen(const char* filePath, int flags);
|
||||
int colorPaletteFileRead(int fd, void* buffer, size_t size);
|
||||
int colorPaletteFileClose(int fd);
|
||||
void colorPaletteSetFileIO(ColorPaletteFileOpenProc* openProc, ColorPaletteFileReadProc* readProc, ColorPaletteCloseProc* closeProc);
|
||||
void* colorPaletteMallocDefaultImpl(size_t size);
|
||||
void* colorPaletteReallocDefaultImpl(void* ptr, size_t size);
|
||||
void colorPaletteFreeDefaultImpl(void* ptr);
|
||||
int _calculateColor(int a1, int a2);
|
||||
int _Color2RGB_(int a1);
|
||||
void colorPaletteFadeBetween(unsigned char* oldPalette, unsigned char* newPalette, int steps);
|
||||
|
@ -51,13 +29,8 @@ void colorPaletteSetTransitionCallback(ColorTransitionCallback* callback);
|
|||
void _setSystemPalette(unsigned char* palette);
|
||||
unsigned char* _getSystemPalette();
|
||||
void _setSystemPaletteEntries(unsigned char* a1, int a2, int a3);
|
||||
void _setIntensityTableColor(int a1);
|
||||
void _setIntensityTables();
|
||||
void _setMixTableColor(int a1);
|
||||
bool colorPaletteLoad(const char* path);
|
||||
char* _colorError();
|
||||
void _buildBlendTable(unsigned char* ptr, unsigned char ch);
|
||||
void _rebuildColorBlendTables();
|
||||
unsigned char* _getColorBlendTable(int ch);
|
||||
void _freeColorBlendTable(int a1);
|
||||
void colorPaletteSetMemoryProcs(MallocProc* mallocProc, ReallocProc* reallocProc, FreeProc* freeProc);
|
||||
|
|
Loading…
Reference in New Issue