Get rid of mmx stuff

This commit is contained in:
Alexander Batalov 2023-02-13 14:17:52 +03:00
parent 7a8711caf5
commit 9b40277052
8 changed files with 31 additions and 91 deletions

View File

@ -232,8 +232,6 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
"src/plib/gnw/kb.h"
"src/plib/gnw/memory.cc"
"src/plib/gnw/memory.h"
"src/plib/gnw/mmx.cc"
"src/plib/gnw/mmx.h"
"src/plib/gnw/mouse.cc"
"src/plib/gnw/mouse.h"
"src/plib/gnw/rect.cc"

View File

@ -3,8 +3,6 @@
#include <string.h>
#include "plib/color/color.h"
#include "plib/gnw/input.h"
#include "plib/gnw/mmx.h"
namespace fallout {
@ -332,4 +330,33 @@ void buf_outline(unsigned char* buf, int width, int height, int pitch, int color
}
}
// 0x4CDB50
void srcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height)
{
for (int y = 0; y < height; y++) {
memcpy(dest, src, width);
dest += destPitch;
src += srcPitch;
}
}
// 0x4CDC75
void transSrcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height)
{
int destSkip = destPitch - width;
int srcSkip = srcPitch - width;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
unsigned char c = *src++;
if (c != 0) {
*dest = c;
}
dest++;
}
src += srcSkip;
dest += destSkip;
}
}
} // namespace fallout

View File

@ -16,6 +16,8 @@ void buf_texture(unsigned char* buf, int width, int height, int pitch, void* a5,
void lighten_buf(unsigned char* buf, int width, int height, int pitch);
void swap_color_buf(unsigned char* buf, int width, int height, int pitch, int color1, int color2);
void buf_outline(unsigned char* buf, int width, int height, int pitch, int a5);
void srcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height);
void transSrcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height);
} // namespace fallout

View File

@ -11,7 +11,6 @@
#include "plib/gnw/grbuf.h"
#include "plib/gnw/intrface.h"
#include "plib/gnw/memory.h"
#include "plib/gnw/mmx.h"
#include "plib/gnw/svga.h"
#include "plib/gnw/text.h"
#include "plib/gnw/vcr.h"

View File

@ -1,46 +0,0 @@
#include "plib/gnw/mmx.h"
#include <string.h>
#include "plib/gnw/svga.h"
namespace fallout {
// Return `true` if CPU supports MMX.
//
// 0x4CD640
bool mmxTest()
{
return SDL_HasMMX() == SDL_TRUE;
}
// 0x4CDB50
void srcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height)
{
for (int y = 0; y < height; y++) {
memcpy(dest, src, width);
dest += destPitch;
src += srcPitch;
}
}
// 0x4CDC75
void transSrcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height)
{
int destSkip = destPitch - width;
int srcSkip = srcPitch - width;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
unsigned char c = *src++;
if (c != 0) {
*dest = c;
}
dest++;
}
src += srcSkip;
dest += destSkip;
}
}
} // namespace fallout

View File

@ -1,12 +0,0 @@
#ifndef FALLOUT_PLIB_GNW_MMX_H_
#define FALLOUT_PLIB_GNW_MMX_H_
namespace fallout {
bool mmxTest();
void srcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height);
void transSrcCopy(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height);
} // namespace fallout
#endif /* FALLOUT_PLIB_GNW_MMX_H_ */

View File

@ -4,7 +4,6 @@
#include "game/intface.h"
#include "plib/gnw/gnw.h"
#include "plib/gnw/grbuf.h"
#include "plib/gnw/mmx.h"
#include "plib/gnw/mouse.h"
#include "plib/gnw/winmain.h"
@ -16,9 +15,6 @@ static int GNW95_init_mode(int width, int height);
static bool createRenderer(int width, int height);
static void destroyRenderer();
// 0x51E2C8
bool mmxEnabled = true;
// screen rect
Rect scr_size;
@ -34,25 +30,6 @@ SDL_Surface* gSdlTextureSurface = NULL;
// TODO: Remove once migration to update-render cycle is completed.
FpsLimiter sharedFpsLimiter;
// 0x4CACD0
void mmxEnable(bool enable)
{
// 0x51E2CC
static bool inited = false;
// 0x6ACA20
static bool mmx;
if (!inited) {
mmx = mmxTest();
inited = true;
}
if (mmx) {
mmxEnabled = enable;
}
}
// 0x4CAD08
int init_mode_320_200()
{
@ -161,8 +138,6 @@ static int GNW95_init_mode_ex(int width, int height, int bpp)
scr_size.lrx = width - 1;
scr_size.lry = height - 1;
mmxEnable(true);
mouse_blit_trans = NULL;
scr_blit = GNW95_ShowRect;
mouse_blit = GNW95_ShowRect;

View File

@ -9,8 +9,6 @@
namespace fallout {
extern bool mmxEnabled;
extern Rect scr_size;
extern ScreenBlitFunc* scr_blit;
@ -21,7 +19,6 @@ extern SDL_Texture* gSdlTexture;
extern SDL_Surface* gSdlTextureSurface;
extern FpsLimiter sharedFpsLimiter;
void mmxEnable(bool enable);
int init_mode_320_200();
int init_mode_320_400();
int init_mode_640_480_16();