Merge pull request #301 from ogamespec/master

PE Regs
This commit is contained in:
ogamespec 2023-08-17 18:06:46 +03:00 committed by GitHub
commit f1b8b93a8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 635 additions and 335 deletions

View file

@ -1,5 +1,7 @@
#include "pch.h"
// There are still some parts of old sources with attempts to "abstract" the backend. It is absolutely hopeless, just use core OpenGL and don't worry about it.
using namespace Debug;
namespace GX
@ -197,22 +199,17 @@ namespace GX
#endif
glDrawBuffer(GL_BACK);
if (set_clear)
{
glClearColor(
(float)(cr / 255.0f),
(float)(cg / 255.0f),
(float)(cb / 255.0f),
(float)(ca / 255.0f)
);
glClearColor(
(float)(pe_copy_clear_ar.red / 255.0f),
(float)(pe_copy_clear_gb.green / 255.0f),
(float)(pe_copy_clear_gb.blue / 255.0f),
(float)(pe_copy_clear_ar.alpha / 255.0f)
);
glClearDepth((double)(clear_z / 16777215.0));
set_clear = false;
}
glClearDepth((double)(pe_copy_clear_z.value / 16777215.0));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
frameReady = 1;
frameReady = true;
}
// done rendering (call when frame is ready)
@ -249,7 +246,7 @@ namespace GX
EndPaint(hwndMain, &psFrame);
#endif
frameReady = 0;
frameReady = false;
//Report(Channel::GP, "gfx frame: %d\n", frames);
frames++;
tris = pts = lines = 0;
@ -263,6 +260,15 @@ namespace GX
frame_done = true;
}
void GXCore::ResizeRenderTarget(size_t width, size_t height)
{
if (backend_started) {
scr_w = width;
scr_h = height;
glViewport(0, 0, width, height);
}
}
void GXCore::UploadShaders(const char* vert_source, const char* frag_source)
{
char infoLog[0x1000]{};

View file

@ -49,6 +49,8 @@ namespace GX
bool gxOpened = false;
bool frame_done = true;
bool disableDraw = false;
bool frameReady = false;
bool backend_started = false;
// logging
bool logOpcode = false;
@ -67,15 +69,9 @@ namespace GX
FILE* snap_file = nullptr;
uint32_t snap_w, snap_h;
int frameReady = 0;
bool backend_started = false;
// optionable
uint32_t scr_w = 640, scr_h = 480;
// perfomance counters
size_t frames = 0, tris = 0, pts = 0, lines = 0;
public:
GXCore();
~GXCore();
@ -90,6 +86,8 @@ namespace GX
void GL_EndFrame();
void GPFrameDone();
void ResizeRenderTarget(size_t width, size_t height);
// Debug
void DumpPIFIFO();
void DumpCPFIFO();
@ -130,6 +128,14 @@ namespace GX
#pragma endregion "Interface to Flipper"
#pragma region "Gfx Common"
GenMode genmode;
GenMsloc msloc[4];
#pragma endregion "Gfx Common"
#pragma region "Command Processor"
CPHostRegs cpregs; // Mapped command processor registers
@ -189,7 +195,6 @@ namespace GX
#pragma region "Setup Unit"
GenMode genmode; // TODO: SU?
SU_SCIS0 scis0; // 0x20
SU_SCIS1 scis1; // 0x21
SU_TS0 ssize[8]; // 0x3n
@ -205,6 +210,9 @@ namespace GX
#pragma region "Rasterizers"
// perfomance counters
size_t tris = 0, pts = 0, lines = 0;
bool ras_wireframe = false; // Enable wireframe drawing of primitives (DEBUG)
bool ras_use_texture = false;
@ -273,20 +281,36 @@ namespace GX
#pragma region "Pixel Engine"
PERegs peregs;
size_t frames = 0;
uint8_t cr = 0, cg = 0, cb = 0, ca = 0;
uint32_t clear_z = -1;
bool set_clear = false;
PERegs peregs; // PE PI regs
Color copyClearRGBA;
uint32_t copyClearZ;
uint16_t tokint;
PE_ZMODE zmode; // 0x40
ColMode0 cmode0; // 0x41
ColMode1 cmode1; // 0x42
PE_CMODE0 cmode0; // 0x41
PE_CMODE1 cmode1; // 0x42
PE_CONTROL pe_control; // 0x43
PE_FIELD_MASK pe_field_mask; // 0x44
PE_FINISH pe_finish; // 0x45
PE_REFRESH pe_refresh; // 0x46
PE_TOKEN pe_token; // 0x47
PE_TOKEN_INT pe_token_int; // 0x48
PE_COPY_SRC_ADDR pe_copy_src_addr; // 0x49
PE_COPY_SRC_SIZE pe_copy_src_size; // 0x4a
PE_COPY_DST_BASE pe_copy_dst_base[2]; // 0x4b, 0x4c
PE_COPY_DST_STRIDE pe_copy_dst_stride; // 0x4d
PE_COPY_SCALE pe_copy_scale; // 0x4e
PE_COPY_CLEAR_AR pe_copy_clear_ar; // 0x4F
PE_COPY_CLEAR_GB pe_copy_clear_gb; // 0x50
PE_COPY_CLEAR_Z pe_copy_clear_z; // 0x51
PE_COPY_CMD pe_copy_cmd; // 0x52
PE_VFILTER_0 pe_vfilter_0; // 0x53
PE_VFILTER_1 pe_vfilter_1; // 0x54
PE_XBOUND pe_xbound; // 0x55
PE_YBOUND pe_ybound; // 0x56
PE_PERFMODE pe_perfmode; // 0x57
PE_CHICKEN pe_chicken; // 0x58
PE_QUAD_OFFSET pe_quad_offset; // 0x59
void GL_SetClear(Color clr, uint32_t z);
void GL_DoSnapshot(bool sel, FILE* f, uint8_t* dst, int width, int height);
void GL_MakeSnapshot(char* path);
void GL_SaveBitmap(uint8_t* buf);

View file

@ -67,35 +67,6 @@ namespace GX
Report(Channel::GP, "EfbPoke, address: 0x%08X, value: 0x%08X\n", addr, value);
}
// set clear rules
void GXCore::GL_SetClear(Color clr, uint32_t z)
{
cr = clr.R;
cg = clr.G;
cb = clr.B;
ca = clr.A;
clear_z = z;
set_clear = true;
/*/
if(set_clear)
{
glClearColor(
(float)(cr / 255.0f),
(float)(cg / 255.0f),
(float)(cb / 255.0f),
(float)(ca / 255.0f)
);
glClearDepth((double)(clear_z / 16777215.0));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
set_clear = FALSE;
}
/*/
}
// sel:0 - file, sel:1 - memory
void GXCore::GL_DoSnapshot(bool sel, FILE* f, uint8_t* dst, int width, int height)
{

365
src/pe.h
View file

@ -39,6 +39,8 @@ namespace GX
#define PE_SR_DONEMSK (1 << 2)
#define PE_SR_TOKENMSK (1 << 3)
// The register definitions for PE PI are slightly different from command stream PE registers because PE PI registers are 16-bit
// PE registers mapped to CPU
struct PERegs
{
@ -46,69 +48,352 @@ namespace GX
uint16_t token; // last token
};
// Fog type
// Blend mode
// Blend factor
// Compare
// Logic Op
// Pixel format
// Z format
// Projection type
// Tex Op
// Alpha read mode
// PE register definitions that come through the command stream.
// 0x40
union PE_ZMODE
{
struct
{
unsigned enable : 1;
unsigned func : 3;
unsigned mask : 1;
unsigned enable : 1;
unsigned func : 3;
unsigned mask : 1;
unsigned unused : 19;
unsigned rid : 8;
};
uint32_t bits;
uint32_t bits;
};
// 0x41
union ColMode0
union PE_CMODE0
{
struct
{
unsigned blend_en : 1;
unsigned logop_en : 1;
unsigned dither_en : 1;
unsigned col_mask : 1;
unsigned alpha_mask : 1;
unsigned dfactor : 3;
unsigned sfactor : 3;
unsigned blebdop : 1;
unsigned logop : 12;
unsigned blend_en : 1;
unsigned logop_en : 1;
unsigned dither_en : 1;
unsigned col_mask : 1;
unsigned alpha_mask : 1;
unsigned dfactor : 3;
unsigned sfactor : 3;
unsigned blendop : 1;
unsigned logop : 12;
unsigned unused : 8;
unsigned rid : 8;
};
uint32_t bits;
uint32_t bits;
};
// 0x42
union ColMode1
union PE_CMODE1
{
struct
{
unsigned const_alpha_en : 1;
unsigned rsrv : 7;
unsigned const_alpha : 8;
unsigned rid : 16;
unsigned const_alpha : 8;
unsigned const_alpha_en : 1;
unsigned yuv : 2;
unsigned unused : 13;
unsigned rid : 8;
};
uint32_t bits;
uint32_t bits;
};
// 0x43
union PE_CONTROL
{
struct
{
unsigned pixtype : 3;
unsigned zcmode : 3;
unsigned ztop : 1;
unsigned unused : 17;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x44
union PE_FIELD_MASK
{
struct
{
unsigned even : 1;
unsigned odd : 1;
unsigned unused : 22;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x45
union PE_FINISH
{
struct
{
unsigned dst : 2;
unsigned unused : 22;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x46
union PE_REFRESH
{
struct
{
unsigned interval : 9;
unsigned enable : 1;
unsigned unused : 14;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x47
union PE_TOKEN
{
struct
{
unsigned token : 16;
unsigned unused : 8;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x48
union PE_TOKEN_INT
{
struct
{
unsigned token : 16;
unsigned unused : 8;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x49
union PE_COPY_SRC_ADDR
{
struct
{
unsigned x : 10;
unsigned y : 10;
unsigned unused : 4;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x4a
union PE_COPY_SRC_SIZE
{
struct
{
unsigned x : 10;
unsigned y : 10;
unsigned unused : 4;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x4b, 0x4c
union PE_COPY_DST_BASE
{
struct
{
unsigned base : 21;
unsigned unused : 3;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x4d
union PE_COPY_DST_STRIDE
{
struct
{
unsigned stride : 10;
unsigned unused : 14;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x4e
union PE_COPY_SCALE
{
struct
{
unsigned scale : 9;
unsigned unused : 15;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x4F
union PE_COPY_CLEAR_AR
{
struct
{
unsigned red : 8;
unsigned alpha : 8;
unsigned unused : 8;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x50
union PE_COPY_CLEAR_GB
{
struct
{
unsigned blue : 8;
unsigned green : 8;
unsigned unused : 8;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x51
union PE_COPY_CLEAR_Z
{
struct
{
unsigned value : 24;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x52
union PE_COPY_CMD
{
struct
{
unsigned clamp_top : 1;
unsigned clamp_bottom : 1;
unsigned unused1 : 1;
unsigned tex_format_h : 1;
unsigned tex_format : 3;
unsigned gamma : 2;
unsigned mip_map_filter : 1;
unsigned vert_scale : 1;
unsigned clear : 1;
unsigned interlaced : 2;
unsigned opcode : 1;
unsigned ccv : 2;
unsigned unused2 : 7;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x53
union PE_VFILTER_0
{
struct
{
unsigned coeff0 : 6;
unsigned coeff1 : 6;
unsigned coeff2 : 6;
unsigned coeff3 : 6;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x54
union PE_VFILTER_1
{
struct
{
unsigned coeff4 : 6;
unsigned coeff5 : 6;
unsigned coeff6 : 6;
unsigned unused : 6;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x55
union PE_XBOUND
{
struct
{
unsigned left : 10;
unsigned right : 10;
unsigned unused : 4;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x56
union PE_YBOUND
{
struct
{
unsigned top : 10;
unsigned bottom : 10;
unsigned unused : 4;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x57
union PE_PERFMODE
{
struct
{
unsigned conter0 : 2;
unsigned conter1 : 2;
unsigned conter2 : 2;
unsigned conter3 : 2;
unsigned conter4 : 2;
unsigned conter5 : 2;
unsigned unused : 12;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x58
union PE_CHICKEN
{
struct
{
unsigned piwr : 1;
unsigned tx_copy_fmt : 1;
unsigned tx_copy_ccv : 1;
unsigned blendop : 1;
unsigned unused : 20;
unsigned rid : 8;
};
uint32_t bits;
};
// 0x59
union PE_QUAD_OFFSET
{
struct
{
unsigned x : 10;
unsigned y : 10;
unsigned pad : 4;
unsigned rid : 8;
};
uint32_t bits;
};
}
void PEOpen();

View file

@ -74,31 +74,6 @@ namespace GX
switch (index)
{
// draw done
case PE_FINISH_ID:
{
GPFrameDone();
CPDrawDone();
}
return;
// token
case PE_TOKEN_INT_ID:
{
tokint = (uint16_t)value;
}
return;
case PE_TOKEN_ID:
{
if ((uint16_t)value == tokint)
{
GPFrameDone();
CPDrawToken(tokint);
}
}
return;
//
// gen mode
//
@ -110,6 +85,21 @@ namespace GX
}
return;
// I don't see any use for MSLOC yet, I added it to avoid spamming with warnings
case GEN_MSLOC0_ID:
msloc[0].bits = value;
break;
case GEN_MSLOC1_ID:
msloc[1].bits = value;
break;
case GEN_MSLOC2_ID:
msloc[2].bits = value;
break;
case GEN_MSLOC3_ID:
msloc[3].bits = value;
break;
//
// set scissor box
//
@ -146,30 +136,219 @@ namespace GX
}
return;
//
// set copy clear color/z
//
// Pixel Engine block
case PE_ZMODE_ID:
{
static const char* zf[] = {
"NEVER",
"LESS",
"EQUAL",
"LEQUAL",
"GREATER",
"NEQUAL",
"GEQUAL",
"ALWAYS"
};
static uint32_t glzf[] = {
GL_NEVER,
GL_LESS,
GL_EQUAL,
GL_LEQUAL,
GL_GREATER,
GL_NOTEQUAL,
GL_GEQUAL,
GL_ALWAYS
};
zmode.bits = value;
/*/
GFXError(
"z mode:\n"
"compare: %s\n"
"func: %s\n"
"update: %s",
(bpRegs.zmode.enable) ? ("yes") : ("no"),
zf[bpRegs.zmode.func],
(bpRegs.zmode.mask) ? ("yes") : ("no")
);
/*/
if (zmode.enable)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(glzf[zmode.func]);
glDepthMask(zmode.mask);
}
else glDisable(GL_DEPTH_TEST);
}
return;
// set blending rules
case PE_CMODE0_ID:
{
cmode0.bits = value;
static const char* logicop[] = {
"clear",
"and",
"revand",
"copy",
"invand",
"nop",
"xor",
"or",
"nor",
"eqv",
"inv",
"revor",
"invcopy",
"invor",
"nand",
"set"
};
static const char* sfactor[] = {
"zero",
"one",
"srcclr",
"invsrcclr",
"srcalpha",
"invsrcalpha",
"dstalpha",
"invdstalpha"
};
static const char* dfactor[] = {
"zero",
"one",
"dstclr",
"invdstclr",
"srcalpha",
"invsrcalpha",
"dstalpha",
"invdstalpha"
};
/*/
GFXError(
"blend rules\n\n"
"blend:%s, logic:%s\n"
"logic op : %s\n"
"sfactor : %s\n"
"dfactor : %s\n",
(bpRegs.cmode0.blend_en) ? ("on") : ("off"),
(bpRegs.cmode0.logop_en) ? ("on") : ("off"),
logicop[bpRegs.cmode0.logop],
sfactor[bpRegs.cmode0.sfactor],
dfactor[bpRegs.cmode0.dfactor]
);
/*/
static uint32_t glsf[] = {
GL_ZERO,
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA
};
static uint32_t gldf[] = {
GL_ZERO,
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA
};
// blend hack
if (cmode0.blend_en)
{
glEnable(GL_BLEND);
glBlendFunc(glsf[cmode0.sfactor], gldf[cmode0.dfactor]);
}
else glDisable(GL_BLEND);
static uint32_t logop[] = {
GL_CLEAR,
GL_AND,
GL_AND_REVERSE,
GL_COPY,
GL_AND_INVERTED,
GL_NOOP,
GL_XOR,
GL_OR,
GL_NOR,
GL_EQUIV,
GL_INVERT,
GL_OR_REVERSE,
GL_COPY_INVERTED,
GL_OR_INVERTED,
GL_NAND,
GL_SET
};
// logic operations
if (cmode0.logop_en)
{
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(logop[cmode0.logop]);
}
else glDisable(GL_COLOR_LOGIC_OP);
}
return;
case PE_CMODE1_ID:
cmode1.bits = value;
break;
// draw done
case PE_FINISH_ID:
{
GPFrameDone();
CPDrawDone();
}
break;
case PE_TOKEN_ID:
{
pe_token.bits = value;
if (pe_token.token == pe_token_int.token)
{
GPFrameDone();
CPDrawToken(pe_token.token);
}
}
break;
// token
case PE_TOKEN_INT_ID:
pe_token_int.bits = value;
break;
case PE_COPY_CLEAR_AR_ID:
{
copyClearRGBA.A = (uint8_t)(value >> 8);
copyClearRGBA.R = (uint8_t)(value);
return;
}
pe_copy_clear_ar.bits = value;
break;
case PE_COPY_CLEAR_GB_ID:
{
copyClearRGBA.G = (uint8_t)(value >> 8);
copyClearRGBA.B = (uint8_t)(value);
}
return;
pe_copy_clear_gb.bits = value;
break;
case PE_COPY_CLEAR_Z_ID:
{
copyClearZ = value & 0xffffff;
GL_SetClear(copyClearRGBA, copyClearZ);
}
return;
pe_copy_clear_z.bits = value;
break;
//
// SetImage0. texture image width, height, format
@ -359,183 +538,6 @@ namespace GX
}
return;
//
// set blending rules
//
case PE_CMODE0_ID:
{
cmode0.bits = value;
static const char* logicop[] = {
"clear",
"and",
"revand",
"copy",
"invand",
"nop",
"xor",
"or",
"nor",
"eqv",
"inv",
"revor",
"invcopy",
"invor",
"nand",
"set"
};
static const char* sfactor[] = {
"zero",
"one",
"srcclr",
"invsrcclr",
"srcalpha",
"invsrcalpha",
"dstalpha",
"invdstalpha"
};
static const char* dfactor[] = {
"zero",
"one",
"dstclr",
"invdstclr",
"srcalpha",
"invsrcalpha",
"dstalpha",
"invdstalpha"
};
/*/
GFXError(
"blend rules\n\n"
"blend:%s, logic:%s\n"
"logic op : %s\n"
"sfactor : %s\n"
"dfactor : %s\n",
(bpRegs.cmode0.blend_en) ? ("on") : ("off"),
(bpRegs.cmode0.logop_en) ? ("on") : ("off"),
logicop[bpRegs.cmode0.logop],
sfactor[bpRegs.cmode0.sfactor],
dfactor[bpRegs.cmode0.dfactor]
);
/*/
static uint32_t glsf[] = {
GL_ZERO,
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA
};
static uint32_t gldf[] = {
GL_ZERO,
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA
};
// blend hack
if (cmode0.blend_en)
{
glEnable(GL_BLEND);
glBlendFunc(glsf[cmode0.sfactor], gldf[cmode0.dfactor]);
}
else glDisable(GL_BLEND);
static uint32_t logop[] = {
GL_CLEAR,
GL_AND,
GL_AND_REVERSE,
GL_COPY,
GL_AND_INVERTED,
GL_NOOP,
GL_XOR,
GL_OR,
GL_NOR,
GL_EQUIV,
GL_INVERT,
GL_OR_REVERSE,
GL_COPY_INVERTED,
GL_OR_INVERTED,
GL_NAND,
GL_SET
};
// logic operations
if (cmode0.logop_en)
{
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(logop[cmode0.logop]);
}
else glDisable(GL_COLOR_LOGIC_OP);
}
return;
case PE_CMODE1_ID:
{
cmode1.bits = value;
}
return;
case PE_ZMODE_ID:
{
static const char* zf[] = {
"NEVER",
"LESS",
"EQUAL",
"LEQUAL",
"GREATER",
"NEQUAL",
"GEQUAL",
"ALWAYS"
};
static uint32_t glzf[] = {
GL_NEVER,
GL_LESS,
GL_EQUAL,
GL_LEQUAL,
GL_GREATER,
GL_NOTEQUAL,
GL_GEQUAL,
GL_ALWAYS
};
zmode.bits = value;
/*/
GFXError(
"z mode:\n"
"compare: %s\n"
"func: %s\n"
"update: %s",
(bpRegs.zmode.enable) ? ("yes") : ("no"),
zf[bpRegs.zmode.func],
(bpRegs.zmode.mask) ? ("yes") : ("no")
);
/*/
if (zmode.enable)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(glzf[zmode.func]);
glDepthMask(zmode.mask);
}
else glDisable(GL_DEPTH_TEST);
}
return;
//
// texture coord scale
//

View file

@ -10,10 +10,10 @@ namespace GX
{
// "Gen" registers are shared between all GFX blocks and have global purpose
GEN_MODE_ID = 0x00,
GEN_MSLOC0 = 0x01,
GEN_MSLOC1 = 0x02,
GEN_MSLOC2 = 0x03,
GEN_MSLOC3 = 0x04,
GEN_MSLOC0_ID = 0x01,
GEN_MSLOC1_ID = 0x02,
GEN_MSLOC2_ID = 0x03,
GEN_MSLOC3_ID = 0x04,
// Bump mapping Unit
BUMP_MATRIX_A0_ID = 0x6,

View file

@ -3,10 +3,6 @@
using namespace Debug;
// IMPORTANT : EXE loading base must be 0x00400000, for correct HLE.
// MSVC : Project/Settings/Link/Output/Base Address
// CW : Edit/** Win32 x86 Settings/Linker/x86 COFF/Base address
// all important variables are here
SYMControl sym; // default workspace
static SYMControl *work = &sym; // current workspace (in use)
@ -360,7 +356,7 @@ static MAP_FORMAT LoadMapRAW(const wchar_t *mapname)
// cut string
while (*ptr == '\n') ptr++;
if (!*ptr) break;
while (*ptr != '\n') line[i++] = *ptr++;
while (*ptr != '\n' && *ptr) line[i++] = *ptr++;
line[i++] = 0;
// remove comments
@ -752,12 +748,12 @@ void MAPFinish()
// MAP saver is moved to stand-alone module, because MAP saving operation
// is not easy, like you may think. We should watch for MAP file formats
// MAP saver.
// MAP saving operation is not easy, like you may think. We should watch for MAP file formats
// and try to append symbols into alredy present MAP.
#define DEFAULT_MAP L"Data\\default.map"
#define DEFAULT_MAP L"./Data/default.map"
//#define HEX "0x"
#define HEX

View file

@ -4607,6 +4607,12 @@ static LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
);
}
// Resize xfb renderer
VideoOutResize(LOWORD(lParam), HIWORD(lParam));
// Resize gfx renderer
Flipper::Gx->ResizeRenderTarget(LOWORD(lParam), HIWORD(lParam));
return 0;
}

View file

@ -526,10 +526,10 @@ namespace GX
void GXCore::GL_SetViewport(int x, int y, int w, int h, float znear, float zfar)
{
//h += 32;
#ifndef NO_VIEWPORT
//#ifndef NO_VIEWPORT
glViewport(x, scr_h - (h + y), w, h);
glDepthRange(znear, zfar);
#endif
//#endif
}
// index range = 0000..FFFF

View file

@ -83,12 +83,22 @@ void VideoOutRefresh()
{
if (gdi_init)
{
BitBlt(
//BitBlt(
// hdcMainWnd,
// 0, 0,
// gdi_width, gdi_height,
// hdcWndComp,
// 0, 0,
// SRCCOPY
//);
StretchBlt (
hdcMainWnd,
0, 0,
gdi_width, gdi_height,
hdcWndComp,
0, 0,
640, 480,
SRCCOPY
);
}