[Video] Move ucode code in to c++ files

This commit is contained in:
zilmar 2017-05-16 17:41:05 +10:00
parent a238cc62d0
commit d057f3b0ef
32 changed files with 737 additions and 250 deletions

View File

@ -169,6 +169,20 @@
<ClCompile Include="TextureEnhancer\TxTexCache.cpp" />
<ClCompile Include="TextureEnhancer\TxUtil.cpp" />
<ClCompile Include="trace.cpp" />
<ClCompile Include="turbo3D.cpp" />
<ClCompile Include="ucode.cpp" />
<ClCompile Include="ucode00.cpp" />
<ClCompile Include="ucode01.cpp" />
<ClCompile Include="ucode02.cpp" />
<ClCompile Include="ucode03.cpp" />
<ClCompile Include="ucode04.cpp" />
<ClCompile Include="ucode05.cpp" />
<ClCompile Include="ucode06.cpp" />
<ClCompile Include="ucode07.cpp" />
<ClCompile Include="ucode08.cpp" />
<ClCompile Include="ucode09.cpp" />
<ClCompile Include="ucode09rdp.cpp" />
<ClCompile Include="ucodeFB.cpp" />
<ClCompile Include="Util.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -224,6 +224,48 @@
<ClCompile Include="Renderer\OGLESwrappers.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="turbo3D.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode00.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode01.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode02.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode03.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode04.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode05.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode06.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode07.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode08.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode09.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucode09rdp.cpp">
<Filter>ucode</Filter>
</ClCompile>
<ClCompile Include="ucodeFB.cpp">
<Filter>ucode</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="gpl.txt">

View File

@ -125,58 +125,6 @@ uint32_t frame_count; // frame counter
bool g_ucode_error_report = TRUE;
int wrong_tile = -1;
// ** RDP graphics functions **
static void undef();
static void spnoop();
static void rdp_noop();
static void rdp_texrect();
//static void rdp_texrectflip();
static void rdp_loadsync();
static void rdp_pipesync();
static void rdp_tilesync();
static void rdp_fullsync();
static void rdp_setkeygb();
static void rdp_setkeyr();
static void rdp_setconvert();
static void rdp_setscissor();
static void rdp_setprimdepth();
static void rdp_setothermode();
static void rdp_loadtlut();
static void rdp_settilesize();
static void rdp_loadblock();
static void rdp_loadtile();
static void rdp_settile();
static void rdp_fillrect();
static void rdp_setfillcolor();
static void rdp_setfogcolor();
static void rdp_setblendcolor();
static void rdp_setprimcolor();
static void rdp_setenvcolor();
static void rdp_setcombine();
static void rdp_settextureimage();
static void rdp_setdepthimage();
static void rdp_setcolorimage();
static void rdp_trifill();
static void rdp_trishade();
static void rdp_tritxtr();
static void rdp_trishadetxtr();
static void rdp_trifillz();
static void rdp_trishadez();
static void rdp_tritxtrz();
static void rdp_trishadetxtrz();
static void rdphalf_1();
static void rdphalf_2();
static void rdphalf_cont();
static void rsp_reserved0();
static void rsp_reserved1();
static void rsp_reserved2();
static void rsp_reserved3();
static void ys_memrect();
uint8_t microcode[4096];
uint32_t uc_crc;
void microcheck();
@ -199,6 +147,8 @@ void microcheck();
static int reset = 0;
static CSettings::ucode_t g_old_ucode = CSettings::uCode_Unsupported;
extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y;
void RDP::Reset()
{
memset(this, 0, sizeof(RDP_Base));
@ -749,7 +699,7 @@ EXPORT void CALL ProcessDList(void)
}
// undef - undefined instruction, always ignore
static void undef()
void undef()
{
WriteTrace(TraceRDP, TraceWarning, "** undefined ** (%08lx) - IGNORED", rdp.cmd0);
*gfx.MI_INTR_REG |= 0x20;
@ -758,13 +708,13 @@ static void undef()
}
// spnoop - no operation, always ignore
static void spnoop()
void spnoop()
{
WriteTrace(TraceRDP, TraceDebug, "spnoop");
}
// noop - no operation, always ignore
static void rdp_noop()
void rdp_noop()
{
WriteTrace(TraceRDP, TraceDebug, "noop");
}
@ -854,7 +804,7 @@ static void DrawDepthBufferFog()
DrawDepthBufferToScreen(fb_info);
}
static void rdp_texrect()
void rdp_texrect()
{
if (!rdp.LLE)
{
@ -1393,22 +1343,22 @@ static void rdp_texrect()
delete[] vnew;
}
static void rdp_loadsync()
void rdp_loadsync()
{
WriteTrace(TraceRDP, TraceDebug, "loadsync - ignored");
}
static void rdp_pipesync()
void rdp_pipesync()
{
WriteTrace(TraceRDP, TraceDebug, "pipesync - ignored");
}
static void rdp_tilesync()
void rdp_tilesync()
{
WriteTrace(TraceRDP, TraceDebug, "tilesync - ignored");
}
static void rdp_fullsync()
void rdp_fullsync()
{
// Set an interrupt to allow the game to continue
*gfx.MI_INTR_REG |= 0x20;
@ -1416,7 +1366,7 @@ static void rdp_fullsync()
WriteTrace(TraceRDP, TraceDebug, "fullsync");
}
static void rdp_setkeygb()
void rdp_setkeygb()
{
uint32_t sB = rdp.cmd1 & 0xFF;
uint32_t cB = (rdp.cmd1 >> 8) & 0xFF;
@ -1427,7 +1377,7 @@ static void rdp_setkeygb()
WriteTrace(TraceRDP, TraceDebug, "setkeygb. cG=%02lx, sG=%02lx, cB=%02lx, sB=%02lx", cG, sG, cB, sB);
}
static void rdp_setkeyr()
void rdp_setkeyr()
{
uint32_t sR = rdp.cmd1 & 0xFF;
uint32_t cR = (rdp.cmd1 >> 8) & 0xFF;
@ -1436,7 +1386,7 @@ static void rdp_setkeyr()
WriteTrace(TraceRDP, TraceDebug, "setkeyr. cR=%02lx, sR=%02lx", cR, sR);
}
static void rdp_setconvert()
void rdp_setconvert()
{
/*
rdp.YUV_C0 = 1.1647f ;
@ -1454,7 +1404,7 @@ static void rdp_setconvert()
// setscissor - sets the screen clipping rectangle
//
static void rdp_setscissor()
void rdp_setscissor()
{
// clipper resolution is 320x240, scale based on computer resolution
rdp.scissor_o.ul_x = /*minval(*/(uint32_t)(((rdp.cmd0 & 0x00FFF000) >> 14))/*, 320)*/;
@ -1481,7 +1431,7 @@ static void rdp_setscissor()
}
}
static void rdp_setprimdepth()
void rdp_setprimdepth()
{
rdp.prim_depth = (uint16_t)((rdp.cmd1 >> 16) & 0x7FFF);
rdp.prim_dz = (uint16_t)(rdp.cmd1 & 0x7FFF);
@ -1489,7 +1439,7 @@ static void rdp_setprimdepth()
WriteTrace(TraceRDP, TraceDebug, "setprimdepth: %d", rdp.prim_depth);
}
static void rdp_setothermode()
void rdp_setothermode()
{
#define F3DEX2_SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \
@ -1548,7 +1498,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count)
WriteTrace(TraceRDP, TraceDebug, "Done.");
}
static void rdp_loadtlut()
void rdp_loadtlut()
{
uint32_t tile = (rdp.cmd1 >> 24) & 0x07;
uint16_t start = rdp.tiles[tile].t_mem - 256; // starting location in the palettes
@ -1588,7 +1538,7 @@ static void rdp_loadtlut()
}
int tile_set = 0;
static void rdp_settilesize()
void rdp_settilesize()
{
uint32_t tile = (rdp.cmd1 >> 24) & 0x07;
rdp.last_tile_size = tile;
@ -1795,7 +1745,7 @@ end_dxt_test:
}
void LoadBlock32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t lr_s, uint32_t dxt);
static void rdp_loadblock()
void rdp_loadblock()
{
if (rdp.skip_drawing)
{
@ -2012,7 +1962,7 @@ static inline void loadTile(uint32_t *src, uint32_t *dst, int width, int height,
}
void LoadTile32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t width, uint32_t height);
static void rdp_loadtile()
void rdp_loadtile()
{
if (rdp.skip_drawing)
{
@ -2115,7 +2065,7 @@ static void rdp_loadtile()
}
}
static void rdp_settile()
void rdp_settile()
{
tile_set = 1; // used to check if we only load the first settilesize
@ -2176,7 +2126,7 @@ static void rdp_settile()
// fillrect - fills a rectangle
//
static void rdp_fillrect()
void rdp_fillrect()
{
uint32_t ul_x = ((rdp.cmd1 & 0x00FFF000) >> 14);
uint32_t ul_y = (rdp.cmd1 & 0x00000FFF) >> 2;
@ -2372,7 +2322,7 @@ static void rdp_fillrect()
// setfillcolor - sets the filling color
//
static void rdp_setfillcolor()
void rdp_setfillcolor()
{
rdp.fill_color = rdp.cmd1;
rdp.update |= UPDATE_ALPHA_COMPARE | UPDATE_COMBINE;
@ -2380,7 +2330,7 @@ static void rdp_setfillcolor()
WriteTrace(TraceRDP, TraceDebug, "setfillcolor: %08lx", rdp.cmd1);
}
static void rdp_setfogcolor()
void rdp_setfogcolor()
{
rdp.fog_color = rdp.cmd1;
rdp.update |= UPDATE_COMBINE | UPDATE_FOG_ENABLED;
@ -2388,7 +2338,7 @@ static void rdp_setfogcolor()
WriteTrace(TraceRDP, TraceDebug, "setfogcolor - %08lx", rdp.cmd1);
}
static void rdp_setblendcolor()
void rdp_setblendcolor()
{
rdp.blend_color = rdp.cmd1;
rdp.update |= UPDATE_COMBINE;
@ -2396,7 +2346,7 @@ static void rdp_setblendcolor()
WriteTrace(TraceRDP, TraceDebug, "setblendcolor: %08lx", rdp.cmd1);
}
static void rdp_setprimcolor()
void rdp_setprimcolor()
{
rdp.prim_color = rdp.cmd1;
rdp.prim_lodmin = (rdp.cmd0 >> 8) & 0xFF;
@ -2407,7 +2357,7 @@ static void rdp_setprimcolor()
rdp.prim_lodfrac);
}
static void rdp_setenvcolor()
void rdp_setenvcolor()
{
rdp.env_color = rdp.cmd1;
rdp.update |= UPDATE_COMBINE;
@ -2415,7 +2365,7 @@ static void rdp_setenvcolor()
WriteTrace(TraceRDP, TraceDebug, "setenvcolor: %08lx", rdp.cmd1);
}
static void rdp_setcombine()
void rdp_setcombine()
{
rdp.c_a0 = (uint8_t)((rdp.cmd0 >> 20) & 0xF);
rdp.c_b0 = (uint8_t)((rdp.cmd1 >> 28) & 0xF);
@ -2453,7 +2403,7 @@ static void rdp_setcombine()
// settextureimage - sets the source for an image copy
//
static void rdp_settextureimage()
void rdp_settextureimage()
{
static const char *format[] = { "RGBA", "YUV", "CI", "IA", "I", "?", "?", "?" };
static const char *size[] = { "4bit", "8bit", "16bit", "32bit" };
@ -2500,7 +2450,7 @@ static void rdp_settextureimage()
rdp.timg.width, rdp.timg.addr);
}
static void rdp_setdepthimage()
void rdp_setdepthimage()
{
rdp.zimg = segoffset(rdp.cmd1) & BMASK;
rdp.zi_width = rdp.ci_width;
@ -2528,7 +2478,7 @@ static void RestoreScale()
static uint32_t swapped_addr = 0;
static void rdp_setcolorimage()
void rdp_setcolorimage()
{
if (g_settings->fb_emulation_enabled() && (rdp.num_of_ci < NUMTEXBUF))
{
@ -2899,7 +2849,7 @@ static void rdp_setcolorimage()
}
}
static void rsp_reserved0()
void rsp_reserved0()
{
if (g_settings->ucode() == CSettings::ucode_DiddyKong)
{
@ -2913,17 +2863,17 @@ static void rsp_reserved0()
}
}
static void rsp_reserved1()
void rsp_reserved1()
{
WriteTrace(TraceRDP, TraceDebug, "reserved1 - ignored");
}
static void rsp_reserved2()
void rsp_reserved2()
{
WriteTrace(TraceRDP, TraceDebug, "reserved2");
}
static void rsp_reserved3()
void rsp_reserved3()
{
WriteTrace(TraceRDP, TraceDebug, "reserved3 - ignored");
}
@ -3768,54 +3718,54 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX));
}
static void rdp_triangle(int shade, int texture, int zbuffer)
void rdp_triangle(int shade, int texture, int zbuffer)
{
lle_triangle(rdp.cmd0, rdp.cmd1, shade, texture, zbuffer, rdp_cmd_data + rdp_cmd_cur);
}
static void rdp_trifill()
void rdp_trifill()
{
rdp_triangle(0, 0, 0);
WriteTrace(TraceRDP, TraceDebug, "trifill");
}
static void rdp_trishade()
void rdp_trishade()
{
rdp_triangle(1, 0, 0);
WriteTrace(TraceRDP, TraceDebug, "trishade");
}
static void rdp_tritxtr()
void rdp_tritxtr()
{
rdp_triangle(0, 1, 0);
WriteTrace(TraceRDP, TraceDebug, "tritxtr");
}
static void rdp_trishadetxtr()
void rdp_trishadetxtr()
{
rdp_triangle(1, 1, 0);
WriteTrace(TraceRDP, TraceDebug, "trishadetxtr");
}
static void rdp_trifillz()
void rdp_trifillz()
{
rdp_triangle(0, 0, 1);
WriteTrace(TraceRDP, TraceDebug, "trifillz");
}
static void rdp_trishadez()
void rdp_trishadez()
{
rdp_triangle(1, 0, 1);
WriteTrace(TraceRDP, TraceDebug, "trishadez");
}
static void rdp_tritxtrz()
void rdp_tritxtrz()
{
rdp_triangle(0, 1, 1);
WriteTrace(TraceRDP, TraceDebug, "tritxtrz");
}
static void rdp_trishadetxtrz()
void rdp_trishadetxtrz()
{
rdp_triangle(1, 1, 1);
WriteTrace(TraceRDP, TraceDebug, "trishadetxtrz");
@ -3929,7 +3879,7 @@ inline uint32_t READ_RDP_DATA(uint32_t address)
return rdram[address >> 2];
}
static void rdphalf_1()
void rdphalf_1()
{
uint32_t cmd = rdp.cmd1 >> 24;
if (cmd >= 0xc8 && cmd <= 0xcf) //triangle command
@ -3984,12 +3934,12 @@ static void rdphalf_1()
}
}
static void rdphalf_2()
void rdphalf_2()
{
WriteTrace(TraceRDP, TraceWarning, "rdphalf_2 - IGNORED");
}
static void rdphalf_cont()
void rdphalf_cont()
{
WriteTrace(TraceRDP, TraceWarning, "rdphalf_cont - IGNORED");
}

View File

@ -14,6 +14,7 @@
#pragma once
#include <Common/stdtypes.h>
#include "glide.h"
extern char out_buf[2048];
@ -700,3 +701,57 @@ extern int SwapOK;
// ** utility functions
void load_palette(uint32_t addr, uint16_t start, uint16_t count);
void setTBufTex(uint16_t t_mem, uint32_t cnt);
// ** RDP graphics functions **
void undef();
void spnoop();
void rdp_noop();
void rdp_texrect();
//void rdp_texrectflip();
void rdp_loadsync();
void rdp_pipesync();
void rdp_tilesync();
void rdp_fullsync();
void rdp_setkeygb();
void rdp_setkeyr();
void rdp_setconvert();
void rdp_setscissor();
void rdp_setprimdepth();
void rdp_loadtlut();
void rdp_settilesize();
void rdp_loadblock();
void rdp_loadtile();
void rdp_settile();
void rdp_fillrect();
void rdp_setfillcolor();
void rdp_setfogcolor();
void rdp_setblendcolor();
void rdp_setprimcolor();
void rdp_setenvcolor();
void rdp_setcombine();
void rdp_settextureimage();
void rdp_setdepthimage();
void rdp_setcolorimage();
void rdp_setothermode();
void rdp_trifill();
void rdp_trishade();
void rdp_tritxtr();
void rdp_trishadetxtr();
void rdp_trifillz();
void rdp_trishadez();
void rdp_tritxtrz();
void rdp_trishadetxtrz();
void rdphalf_1();
void rdphalf_2();
void rdphalf_cont();
void rsp_reserved0();
void rsp_reserved1();
void rsp_reserved2();
void rsp_reserved3();
void ys_memrect();
void microcheck();
extern const char *str_dither[];
extern uint8_t microcode[4096];

View File

@ -11,9 +11,17 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "ucode00.h"
#include "util.h"
struct t3dGlobState {
/******************Turbo3D microcode*************************/
struct t3dGlobState
{
uint16_t pad0;
uint16_t perspNorm;
uint32_t flag;
@ -210,7 +218,7 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
}
}
static void Turbo3D()
void Turbo3D()
{
WriteTrace(TraceRDP, TraceDebug, "Start Turbo3D microcode");
g_settings->SetUcode(CSettings::ucode_Fast3D);
@ -237,4 +245,4 @@ static void Turbo3D()
rdp.pc[rdp.pc_i] += 16;
} while (pstate);
g_settings->SetUcode(CSettings::ucode_Turbo3d);
}
}

View File

@ -0,0 +1,16 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void Turbo3D();

View File

@ -11,13 +11,22 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include "ucode00.h"
#include "ucode01.h"
#include "ucode02.h"
#include "ucode03.h"
#include "ucode04.h"
#include "ucode05.h"
#include "ucode06.h"
#include "ucode07.h"
#include "ucode08.h"
#include "ucode09.h"
typedef void(*rdp_instr)();
// RDP graphic instructions pointer table
static rdp_instr gfx_instruction[10][256] =
rdp_instr gfx_instruction[10][256] =
{
{
// uCode 0 - RSP SW 2.0X

View File

@ -0,0 +1,18 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
typedef void(*rdp_instr)();
extern rdp_instr gfx_instruction[10][256];

View File

@ -11,8 +11,15 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
static void rsp_vertex(int v0, int n)
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "3dmath.h"
#include "Util.h"
void rsp_vertex(int v0, int n)
{
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
int i;
@ -107,7 +114,7 @@ static void rsp_vertex(int v0, int n)
}
}
static void rsp_tri1(VERTEX **v, uint16_t linew = 0)
void rsp_tri1(VERTEX **v, uint16_t linew = 0)
{
if (cull_tri(v))
rdp.tri_n++;
@ -119,7 +126,7 @@ static void rsp_tri1(VERTEX **v, uint16_t linew = 0)
}
}
static void rsp_tri2(VERTEX **v)
void rsp_tri2(VERTEX **v)
{
int updated = 0;
@ -149,7 +156,7 @@ static void rsp_tri2(VERTEX **v)
//
// uc0:vertex - loads vertices
//
static void uc0_vertex()
void uc0_vertex()
{
int v0 = (rdp.cmd0 >> 16) & 0xF; // Current vertex
int n = ((rdp.cmd0 >> 20) & 0xF) + 1; // Number of vertices to copy
@ -246,7 +253,7 @@ void load_matrix(float m[4][4], uint32_t addr)
//
// uc0:matrix - performs matrix operations
//
static void uc0_matrix()
void uc0_matrix()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:matrix ");
@ -313,7 +320,7 @@ static void uc0_matrix()
//
// uc0:movemem - loads a structure with data
//
static void uc0_movemem()
void uc0_movemem()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:movemem ");
@ -450,7 +457,7 @@ static void uc0_movemem()
//
// uc0:displaylist - makes a call to another section of code
//
static void uc0_displaylist()
void uc0_displaylist()
{
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
@ -486,7 +493,7 @@ static void uc0_displaylist()
//
// tri1 - renders a triangle
//
static void uc0_tri1()
void uc0_tri1()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:tri1 #%d - %d, %d, %d", rdp.tri_n,
((rdp.cmd1 >> 16) & 0xFF) / 10,
@ -516,7 +523,7 @@ static void uc0_tri1()
//
// uc0:enddl - ends a call made by uc0:displaylist
//
static void uc0_enddl()
void uc0_enddl()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:enddl");
@ -531,7 +538,7 @@ static void uc0_enddl()
rdp.pc_i--;
}
static void uc0_culldl()
void uc0_culldl()
{
uint8_t vStart = (uint8_t)((rdp.cmd0 & 0x00FFFFFF) / 40) & 0xF;
uint8_t vEnd = (uint8_t)(rdp.cmd1 / 40) & 0x0F;
@ -564,7 +571,7 @@ static void uc0_culldl()
uc0_enddl();
}
static void uc0_popmatrix()
void uc0_popmatrix()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:popmatrix");
@ -584,9 +591,9 @@ static void uc0_popmatrix()
}
}
static void uc6_obj_sprite();
void uc6_obj_sprite();
static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
{
VERTEX *v = &rdp.vtx[vtx];
@ -662,7 +669,7 @@ static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
//
// uc0:moveword - moves a word to someplace, like the segment pointers
//
static void uc0_moveword()
void uc0_moveword()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:moveword ");
@ -735,7 +742,7 @@ static void uc0_moveword()
}
}
static void uc0_texture()
void uc0_texture()
{
int tile = (rdp.cmd0 >> 8) & 0x07;
if (tile == 7 && g_settings->hacks(CSettings::hack_Supercross))
@ -772,7 +779,7 @@ static void uc0_texture()
}
}
static void uc0_setothermode_h()
void uc0_setothermode_h()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_h: ");
@ -850,7 +857,7 @@ static void uc0_setothermode_h()
}
}
static void uc0_setothermode_l()
void uc0_setothermode_l()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_l ");
@ -907,7 +914,7 @@ static void uc0_setothermode_l()
// there is not one setothermode_l that's not handled :)
}
static void uc0_setgeometrymode()
void uc0_setgeometrymode()
{
rdp.geom_mode |= rdp.cmd1;
WriteTrace(TraceRDP, TraceDebug, "uc0:setgeometrymode %08lx; result: %08lx", rdp.cmd1, rdp.geom_mode);
@ -948,7 +955,7 @@ static void uc0_setgeometrymode()
}
}
static void uc0_cleargeometrymode()
void uc0_cleargeometrymode()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:cleargeometrymode %08lx", rdp.cmd1);
@ -990,7 +997,7 @@ static void uc0_cleargeometrymode()
}
}
static void uc0_line3d()
void uc0_line3d()
{
uint32_t v0 = ((rdp.cmd1 >> 16) & 0xff) / 10;
uint32_t v1 = ((rdp.cmd1 >> 8) & 0xff) / 10;
@ -1012,7 +1019,7 @@ static void uc0_line3d()
WriteTrace(TraceRDP, TraceDebug, "uc0:line3d v0:%d, v1:%d, width:%d", v0, v1, width);
}
static void uc0_tri4()
void uc0_tri4()
{
// c0: 0000 0123, c1: 456789ab
// becomes: 405 617 829 a3b
@ -1101,4 +1108,4 @@ static void uc0_tri4()
draw_tri(v + 9);
rdp.tri_n++;
}
}
}

View File

@ -0,0 +1,47 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc0_cleargeometrymode();
void uc0_culldl();
void uc0_displaylist();
void uc0_enddl();
void uc0_line3d();
void uc0_matrix();
void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val);
void uc0_movemem();
void uc0_moveword();
void uc0_popmatrix();
void uc0_tri1();
void uc0_tri4();
void uc0_setgeometrymode();
void uc0_setothermode_l();
void uc0_setothermode_h();
void uc0_texture();
void uc0_vertex();
void modelview_pop(int num = 1);
void modelview_mul(float m[4][4]);
void modelview_mul_push(float m[4][4]);
void modelview_load(float m[4][4]);
void modelview_load_push(float m[4][4]);
void projection_load(float m[4][4]);
void projection_mul(float m[4][4]);
void rsp_tri1(VERTEX **v, uint16_t linew = 0);
void rsp_tri2(VERTEX **v);
void rsp_vertex(int v0, int n);
void load_matrix(float m[4][4], uint32_t addr);

View File

@ -11,9 +11,18 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "ucode00.h"
static void uc1_vertex()
//
// vertex - loads vertices
//
void uc1_vertex()
{
int v0 = (rdp.cmd0 >> 17) & 0x7F; // Current vertex
int n = (rdp.cmd0 >> 10) & 0x3F; // Number to copy
@ -24,7 +33,7 @@ static void uc1_vertex()
// tri1 - renders a triangle
//
static void uc1_tri1()
void uc1_tri1()
{
if (rdp.skip_drawing)
{
@ -45,7 +54,7 @@ static void uc1_tri1()
rsp_tri1(v);
}
static void uc1_tri2()
void uc1_tri2()
{
if (rdp.skip_drawing)
{
@ -74,7 +83,7 @@ static void uc1_tri2()
rsp_tri2(v);
}
static void uc1_line3d()
void uc1_line3d()
{
if (!g_settings->force_quad3d() && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
{
@ -116,14 +125,14 @@ static void uc1_line3d()
uint32_t branch_dl = 0;
static void uc1_rdphalf_1()
void uc1_rdphalf_1()
{
WriteTrace(TraceRDP, TraceDebug, "uc1:rdphalf_1");
branch_dl = rdp.cmd1;
rdphalf_1();
}
static void uc1_branch_z()
void uc1_branch_z()
{
uint32_t addr = segoffset(branch_dl);
WriteTrace(TraceRDP, TraceDebug, "uc1:branch_less_z, addr: %08lx", addr);
@ -132,4 +141,4 @@ static void uc1_branch_z()
{
rdp.pc[rdp.pc_i] = addr;
}
}
}

View File

@ -0,0 +1,23 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc1_branch_z();
void uc1_rdphalf_1();
void uc1_line3d();
void uc1_tri1();
void uc1_tri2();
void uc1_vertex();
extern uint32_t branch_dl;

View File

@ -11,7 +11,14 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "3dmath.h"
#include "ucode00.h"
static void calc_point_light(VERTEX *v, float * vpos)
{
float light_intensity = 0.0f;
@ -53,9 +60,9 @@ static void calc_point_light(VERTEX *v, float * vpos)
v->b = (uint8_t)(color[2] * 255.0f);
}
static void uc6_obj_rectangle();
void uc6_obj_rectangle();
static void uc2_vertex()
void uc2_vertex()
{
if (!(rdp.cmd0 & 0x00FFFFFF))
{
@ -183,7 +190,7 @@ static void uc2_vertex()
rdp.geom_mode = geom_mode;
}
static void uc2_modifyvtx()
void uc2_modifyvtx()
{
uint8_t where = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
uint16_t vtx = (uint16_t)((rdp.cmd0 >> 1) & 0xFFFF);
@ -192,7 +199,7 @@ static void uc2_modifyvtx()
uc0_modifyvtx(where, vtx, rdp.cmd1);
}
static void uc2_culldl()
void uc2_culldl()
{
uint16_t vStart = (uint16_t)(rdp.cmd0 & 0xFFFF) >> 1;
uint16_t vEnd = (uint16_t)(rdp.cmd1 & 0xFFFF) >> 1;
@ -231,9 +238,9 @@ static void uc2_culldl()
uc0_enddl();
}
static void uc6_obj_loadtxtr();
void uc6_obj_loadtxtr();
static void uc2_tri1()
void uc2_tri1()
{
if ((rdp.cmd0 & 0x00FFFFFF) == 0x17)
{
@ -260,10 +267,10 @@ static void uc2_tri1()
rsp_tri1(v);
}
static void uc6_obj_ldtx_sprite();
static void uc6_obj_ldtx_rect();
void uc6_obj_ldtx_sprite();
void uc6_obj_ldtx_rect();
static void uc2_quad()
void uc2_quad()
{
if ((rdp.cmd0 & 0x00FFFFFF) == 0x2F)
{
@ -308,9 +315,9 @@ static void uc2_quad()
rsp_tri2(v);
}
static void uc6_ldtx_rect_r();
void uc6_ldtx_rect_r();
static void uc2_line3d()
void uc2_line3d()
{
if ((rdp.cmd0 & 0xFF) == 0x2F)
uc6_ldtx_rect_r();
@ -336,22 +343,22 @@ static void uc2_line3d()
}
}
static void uc2_special3()
void uc2_special3()
{
WriteTrace(TraceRDP, TraceDebug, "uc2:special3");
}
static void uc2_special2()
void uc2_special2()
{
WriteTrace(TraceRDP, TraceDebug, "uc2:special2");
}
static void uc2_dma_io()
void uc2_dma_io()
{
WriteTrace(TraceRDP, TraceDebug, "uc2:dma_io");
}
static void uc2_pop_matrix()
void uc2_pop_matrix()
{
WriteTrace(TraceRDP, TraceDebug, "uc2:pop_matrix %08lx, %08lx", rdp.cmd0, rdp.cmd1);
@ -359,7 +366,7 @@ static void uc2_pop_matrix()
modelview_pop(rdp.cmd1 >> 6);
}
static void uc2_geom_mode()
void uc2_geom_mode()
{
// Switch around some things
uint32_t clr_mode = (rdp.cmd0 & 0x00DFC9FF) |
@ -447,9 +454,9 @@ static void uc2_geom_mode()
}
}
static void uc6_obj_rectangle_r();
void uc6_obj_rectangle_r();
static void uc2_matrix()
void uc2_matrix()
{
if (!(rdp.cmd0 & 0x00FFFFFF))
{
@ -514,7 +521,7 @@ static void uc2_matrix()
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
}
static void uc2_moveword()
void uc2_moveword()
{
uint8_t index = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
uint16_t offset = (uint16_t)(rdp.cmd0 & 0xFFFF);
@ -625,9 +632,9 @@ static void uc2_moveword()
}
}
static void uc6_obj_movemem();
void uc6_obj_movemem();
static void uc2_movemem()
void uc2_movemem()
{
int idx = rdp.cmd0 & 0xFF;
uint32_t addr = segoffset(rdp.cmd1);
@ -739,17 +746,17 @@ static void uc2_movemem()
}
}
static void uc2_load_ucode()
void uc2_load_ucode()
{
WriteTrace(TraceRDP, TraceDebug, "uc2:load_ucode");
}
static void uc2_rdphalf_2()
void uc2_rdphalf_2()
{
WriteTrace(TraceRDP, TraceDebug, "uc2:rdphalf_2");
}
static void uc2_dlist_cnt()
void uc2_dlist_cnt()
{
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int count = rdp.cmd0 & 0x000000FF;
@ -765,4 +772,4 @@ static void uc2_dlist_cnt()
rdp.pc_i++; // go to the next PC in the stack
rdp.pc[rdp.pc_i] = addr; // jump to the address
rdp.dl_count = count + 1;
}
}

View File

@ -0,0 +1,32 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc2_culldl();
void uc2_dlist_cnt();
void uc2_dma_io();
void uc2_geom_mode();
void uc2_line3d();
void uc2_load_ucode();
void uc2_matrix();
void uc2_modifyvtx();
void uc2_movemem();
void uc2_moveword();
void uc2_pop_matrix();
void uc2_rdphalf_2();
void uc2_special2();
void uc2_special3();
void uc2_tri1();
void uc2_quad();
void uc2_vertex();

View File

@ -11,9 +11,17 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include "ucode00.h"
static void uc3_vertex()
//
// vertex - loads vertices
//
void uc3_vertex()
{
int v0 = ((rdp.cmd0 >> 16) & 0xFF) / 5; // Current vertex
int n = (uint16_t)((rdp.cmd0 & 0xFFFF) + 1) / 0x210; // Number to copy
@ -31,7 +39,7 @@ static void uc3_vertex()
// tri1 - renders a triangle
//
static void uc3_tri1()
void uc3_tri1()
{
WriteTrace(TraceRDP, TraceDebug, "uc3:tri1 #%d - %d, %d, %d - %08lx - %08lx", rdp.tri_n,
((rdp.cmd1 >> 16) & 0xFF) / 5,
@ -47,7 +55,7 @@ static void uc3_tri1()
rsp_tri1(v);
}
static void uc3_tri2()
void uc3_tri2()
{
WriteTrace(TraceRDP, TraceDebug, "uc3:tri2 #%d, #%d - %d, %d, %d - %d, %d, %d", rdp.tri_n, rdp.tri_n + 1,
((rdp.cmd0 >> 16) & 0xFF) / 5,
@ -69,7 +77,7 @@ static void uc3_tri2()
rsp_tri2(v);
}
static void uc3_quad3d()
void uc3_quad3d()
{
WriteTrace(TraceRDP, TraceDebug, "uc3:quad3d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
@ -83,4 +91,4 @@ static void uc3_quad3d()
};
rsp_tri2(v);
}
}

View File

@ -0,0 +1,19 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc3_tri1();
void uc3_tri2();
void uc3_quad3d();
void uc3_vertex();

View File

@ -11,16 +11,24 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
static void uc4_vertex()
//****************************************************************
// uCode 4 - RSP SW 2.0D EXT
//****************************************************************
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include "ucode00.h"
void uc4_vertex()
{
int v0 = 0; // Current vertex
int n = ((rdp.cmd0 >> 4) & 0xFFF) / 33 + 1; // Number of vertices to copy
rsp_vertex(v0, n);
}
static void uc4_tri1()
void uc4_tri1()
{
int v1 = ((rdp.cmd1 >> 16) & 0xFF) / 5;
int v2 = ((rdp.cmd1 >> 8) & 0xFF) / 5;
@ -37,7 +45,7 @@ static void uc4_tri1()
rsp_tri1(v);
}
static void uc4_quad3d()
void uc4_quad3d()
{
WriteTrace(TraceRDP, TraceDebug, "uc4:quad3d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
@ -51,4 +59,4 @@ static void uc4_quad3d()
};
rsp_tri2(v);
}
}

View File

@ -0,0 +1,18 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc4_tri1();
void uc4_quad3d();
void uc4_vertex();

View File

@ -11,7 +11,14 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "3dmath.h"
#include "ucode00.h"
#include "util.h"
int cur_mtx = 0;
int billboarding = 0;
@ -19,7 +26,7 @@ int vtx_last = 0;
uint32_t dma_offset_mtx = 0;
uint32_t dma_offset_vtx = 0;
static void uc5_dma_offsets()
void uc5_dma_offsets()
{
dma_offset_mtx = rdp.cmd0 & 0x00FFFFFF;
dma_offset_vtx = rdp.cmd1 & 0x00FFFFFF;
@ -27,7 +34,7 @@ static void uc5_dma_offsets()
WriteTrace(TraceRDP, TraceDebug, "uc5:dma_offsets - mtx: %08lx, vtx: %08lx", dma_offset_mtx, dma_offset_vtx);
}
static void uc5_matrix()
void uc5_matrix()
{
// Use segment offset to get the address
uint32_t addr = dma_offset_mtx + (segoffset(rdp.cmd1) & BMASK);
@ -78,7 +85,7 @@ static void uc5_matrix()
}
}
static void uc5_vertex()
void uc5_vertex()
{
uint32_t addr = dma_offset_vtx + (segoffset(rdp.cmd1) & BMASK);
@ -159,7 +166,7 @@ static void uc5_vertex()
vtx_last += n;
}
static void uc5_tridma()
void uc5_tridma()
{
vtx_last = 0; // we've drawn something, so the vertex index needs resetting
if (rdp.skip_drawing)
@ -234,7 +241,7 @@ static void uc5_tridma()
}
}
static void uc5_dl_in_mem()
void uc5_dl_in_mem()
{
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int count = (rdp.cmd0 & 0x00FF0000) >> 16;
@ -250,7 +257,7 @@ static void uc5_dl_in_mem()
rdp.dl_count = count + 1;
}
static void uc5_moveword()
void uc5_moveword()
{
WriteTrace(TraceRDP, TraceDebug, "uc5:moveword ");
@ -295,7 +302,7 @@ static void uc5_moveword()
}
}
static void uc5_setgeometrymode()
void uc5_setgeometrymode()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:setgeometrymode %08lx", rdp.cmd1);
@ -321,7 +328,7 @@ static void uc5_setgeometrymode()
}
}
static void uc5_cleargeometrymode()
void uc5_cleargeometrymode()
{
WriteTrace(TraceRDP, TraceDebug, "uc0:cleargeometrymode %08lx", rdp.cmd1);
@ -344,4 +351,4 @@ static void uc5_cleargeometrymode()
rdp.update |= UPDATE_FOG_ENABLED;
}
}
}
}

View File

@ -0,0 +1,23 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc5_cleargeometrymode();
void uc5_dl_in_mem();
void uc5_dma_offsets();
void uc5_matrix();
void uc5_tridma();
void uc5_vertex();
void uc5_setgeometrymode();
void uc5_moveword();

View File

@ -11,10 +11,21 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include "Combine.h"
#include "Util.h"
#include "TexCache.h"
#include "TexBuffer.h"
#include "ucode06.h"
extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y;
static float set_sprite_combine_mode()
// STANDARD DRAWIMAGE - draws a 2d image based on the following structure
float set_sprite_combine_mode()
{
if (rdp.cycle_mode == 2)
{
@ -90,25 +101,6 @@ static float set_sprite_combine_mode()
void uc6_sprite2d();
typedef struct DRAWIMAGE_t {
float frameX;
float frameY;
uint16_t frameW;
uint16_t frameH;
uint16_t imageX;
uint16_t imageY;
uint16_t imageW;
uint16_t imageH;
uint32_t imagePtr;
uint8_t imageFmt;
uint8_t imageSiz;
uint16_t imagePal;
uint8_t flipX;
uint8_t flipY;
float scaleX;
float scaleY;
} DRAWIMAGE;
typedef struct DRAWOBJECT_t {
float objX;
float objY;
@ -561,7 +553,7 @@ void DrawImage(DRAWIMAGE & d)
rdp.bg_image_height = 0xFFFF;
}
void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
void DrawHiresImage(DRAWIMAGE & d, int screensize)
{
TBUFF_COLOR_IMAGE *tbuff_tex = rdp.tbuff_tex;
if (rdp.motionblur)
@ -726,12 +718,12 @@ static void uc6_bg(bool bg_1cyc)
}
}
static void uc6_bg_1cyc()
void uc6_bg_1cyc()
{
uc6_bg(true);
}
static void uc6_bg_copy()
void uc6_bg_copy()
{
uc6_bg(false);
}
@ -987,7 +979,7 @@ static void uc6_init_tile(const DRAWOBJECT & d)
rdp.tiles[0].lr_t = (d.imageH > 0) ? d.imageH - 1 : 0;
}
static void uc6_obj_rectangle()
void uc6_obj_rectangle()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_rectangle ");
DRAWOBJECT d;
@ -1056,7 +1048,7 @@ static void uc6_obj_rectangle()
uc6_draw_polygons(v);
}
static void uc6_obj_sprite()
void uc6_obj_sprite()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_sprite ");
DRAWOBJECT d;
@ -1117,7 +1109,7 @@ static void uc6_obj_sprite()
uc6_draw_polygons(v);
}
static void uc6_obj_movemem()
void uc6_obj_movemem()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_movemem");
@ -1148,12 +1140,12 @@ static void uc6_obj_movemem()
}
}
static void uc6_select_dl()
void uc6_select_dl()
{
WriteTrace(TraceRDP, TraceWarning, "uc6:select_dl");
}
static void uc6_obj_rendermode()
void uc6_obj_rendermode()
{
WriteTrace(TraceRDP, TraceWarning, "uc6:obj_rendermode");
}
@ -1217,7 +1209,7 @@ static void uc6_DrawYUVImageToFrameBuffer(uint16_t ul_x, uint16_t ul_y, uint16_t
}
}
static void uc6_obj_rectangle_r()
void uc6_obj_rectangle_r()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_rectangle_r ");
DRAWOBJECT d;
@ -1288,7 +1280,7 @@ static void uc6_obj_rectangle_r()
uc6_draw_polygons(v);
}
static void uc6_obj_loadtxtr()
void uc6_obj_loadtxtr()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_loadtxtr ");
rdp.s2dex_tex_loaded = TRUE;
@ -1352,7 +1344,7 @@ static void uc6_obj_loadtxtr()
}
}
static void uc6_obj_ldtx_sprite()
void uc6_obj_ldtx_sprite()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_ldtx_sprite");
@ -1362,7 +1354,7 @@ static void uc6_obj_ldtx_sprite()
uc6_obj_sprite();
}
static void uc6_obj_ldtx_rect()
void uc6_obj_ldtx_rect()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_ldtx_rect");
@ -1372,7 +1364,7 @@ static void uc6_obj_ldtx_rect()
uc6_obj_rectangle();
}
static void uc6_ldtx_rect_r()
void uc6_ldtx_rect_r()
{
WriteTrace(TraceRDP, TraceDebug, "uc6:ldtx_rect_r");
@ -1382,7 +1374,7 @@ static void uc6_ldtx_rect_r()
uc6_obj_rectangle_r();
}
static void uc6_loaducode()
void uc6_loaducode()
{
WriteTrace(TraceRDP, TraceWarning, "uc6:load_ucode");
@ -1647,4 +1639,4 @@ void uc6_sprite2d()
else
return;
}
}
}

View File

@ -0,0 +1,51 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
typedef struct DRAWIMAGE_t {
float frameX;
float frameY;
uint16_t frameW;
uint16_t frameH;
uint16_t imageX;
uint16_t imageY;
uint16_t imageW;
uint16_t imageH;
uint32_t imagePtr;
uint8_t imageFmt;
uint8_t imageSiz;
uint16_t imagePal;
uint8_t flipX;
uint8_t flipY;
float scaleX;
float scaleY;
} DRAWIMAGE;
void uc6_bg_1cyc();
void uc6_bg_copy();
void uc6_loaducode();
void uc6_ldtx_rect_r();
void uc6_obj_ldtx_rect();
void uc6_obj_ldtx_sprite();
void uc6_obj_loadtxtr();
void uc6_obj_movemem();
void uc6_obj_rectangle();
void uc6_obj_rectangle_r();
void uc6_obj_rendermode();
void uc6_obj_sprite();
void uc6_select_dl();
void uc6_sprite2d();
void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE);
float set_sprite_combine_mode();

View File

@ -11,11 +11,16 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "3dmath.h"
uint32_t pd_col_addr = 0;
static void uc7_colorbase()
void uc7_colorbase()
{
WriteTrace(TraceRDP, TraceDebug, "uc7_colorbase");
pd_col_addr = segoffset(rdp.cmd1);
@ -33,7 +38,7 @@ typedef struct
short s;
} vtx_uc7;
static void uc7_vertex()
void uc7_vertex()
{
if (rdp.update & UPDATE_MULT_MAT)
{
@ -134,4 +139,4 @@ static void uc7_vertex()
WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f", i >> 4, v->x, v->y, v->z, v->w, v->ou, v->ov);
vertex++;
}
}
}

View File

@ -0,0 +1,17 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc7_vertex();
void uc7_colorbase();

View File

@ -11,12 +11,18 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "3dmath.h"
#include "Util.h"
uint32_t uc8_normale_addr = 0;
float uc8_coord_mod[16];
static void uc8_vertex()
void uc8_vertex()
{
if (rdp.update & UPDATE_MULT_MAT)
{
@ -189,7 +195,7 @@ static void uc8_vertex()
}
}
static void uc8_moveword()
void uc8_moveword()
{
uint8_t index = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
uint16_t offset = (uint16_t)(rdp.cmd0 & 0xFFFF);
@ -282,7 +288,7 @@ static void uc8_moveword()
}
}
static void uc8_movemem()
void uc8_movemem()
{
int idx = rdp.cmd0 & 0xFF;
uint32_t addr = segoffset(rdp.cmd1);
@ -394,7 +400,7 @@ static void uc8_movemem()
}
}
static void uc8_tri4() //by Gugaman Apr 19 2002
void uc8_tri4() //by Gugaman Apr 19 2002
{
if (rdp.skip_drawing)
{
@ -487,4 +493,4 @@ static void uc8_tri4() //by Gugaman Apr 19 2002
draw_tri(v + 9);
rdp.tri_n++;
}
}
}

View File

@ -0,0 +1,19 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc8_vertex();
void uc8_tri4();
void uc8_moveword();
void uc8_movemem();

View File

@ -11,7 +11,14 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include <math.h>
#include "Util.h"
#include "3dmath.h"
#include "ucode00.h"
void uc9_rpdcmd();
@ -207,7 +214,7 @@ static uint32_t uc9_load_object(uint32_t zHeader, uint32_t * rdpcmds)
return segoffset(((uint32_t*)addr)[0]);
}
static void uc9_object()
void uc9_object()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:object");
uint32_t rdpcmds[3] = { 0, 0, 0 };
@ -220,12 +227,12 @@ static void uc9_object()
zHeader = uc9_load_object(zHeader, rdpcmds);
}
static void uc9_mix()
void uc9_mix()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:mix IGNORED");
}
static void uc9_fmlight()
void uc9_fmlight()
{
int mid = rdp.cmd0 & 0xFF;
rdp.num_lights = 1 + ((rdp.cmd1 >> 12) & 0xFF);
@ -293,7 +300,7 @@ static void uc9_fmlight()
rdp.use_lookat = TRUE;
}
static void uc9_light()
void uc9_light()
{
uint32_t csrs = -1024 + ((rdp.cmd0 >> 12) & 0xFFF);
uint32_t nsrs = -1024 + (rdp.cmd0 & 0xFFF);
@ -330,7 +337,7 @@ static void uc9_light()
}
}
static void uc9_mtxtrnsp()
void uc9_mtxtrnsp()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:mtxtrnsp - ignored");
/*
@ -362,7 +369,7 @@ static void uc9_mtxtrnsp()
*/
}
static void uc9_mtxcat()
void uc9_mtxcat()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:mtxcat ");
M44 *s = NULL;
@ -437,7 +444,7 @@ static void uc9_mtxcat()
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
}
typedef struct {
typedef struct {
short sy;
short sx;
int invw;
@ -448,7 +455,7 @@ typedef struct {
uint8_t cc;
} zSortVDest;
static void uc9_mult_mpmtx()
void uc9_mult_mpmtx()
{
//int id = rdp.cmd0&0xFF;
int num = 1 + ((rdp.cmd1 >> 24) & 0xFF);
@ -503,22 +510,22 @@ static void uc9_mult_mpmtx()
}
}
static void uc9_link_subdl()
void uc9_link_subdl()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:link_subdl IGNORED");
}
static void uc9_set_subdl()
void uc9_set_subdl()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:set_subdl IGNORED");
}
static void uc9_wait_signal()
void uc9_wait_signal()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:wait_signal IGNORED");
}
static void uc9_send_signal()
void uc9_send_signal()
{
WriteTrace(TraceRDP, TraceDebug, "uc9:send_signal IGNORED");
}
@ -638,7 +645,7 @@ void uc9_movemem()
}
}
static void uc9_setscissor()
void uc9_setscissor()
{
rdp_setscissor();
@ -669,4 +676,4 @@ static void uc9_setscissor()
rdp.geom_mode |= 0x0200;
}
}
}

View File

@ -0,0 +1,29 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
void uc9_object();
void uc9_rpdcmd();
void uc9_mix();
void uc9_fmlight();
void uc9_light();
void uc9_mtxtrnsp();
void uc9_mtxcat();
void uc9_mult_mpmtx();
void uc9_link_subdl();
void uc9_set_subdl();
void uc9_wait_signal();
void uc9_send_signal();
void uc9_movemem();
void uc9_setscissor();

View File

@ -11,7 +11,10 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
void uc9_rpdcmd()
{

View File

@ -0,0 +1,14 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once

View File

@ -11,7 +11,15 @@
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
#include <Project64-video/rdp.h>
#include <Project64-video/Gfx_1.3.h>
#include <Project64-video/trace.h>
#include <Project64-video/ucode.h>
#include "ucode00.h"
#include "ucode01.h"
#include "ucode02.h"
#include "ucode05.h"
#include "ucode06.h"
static void fb_uc0_moveword()
{
@ -418,7 +426,7 @@ static void fb_setcolorimage()
// RDP graphic instructions pointer table used in DetectFrameBufferUsage
static rdp_instr gfx_instruction_lite[9][256] =
rdp_instr gfx_instruction_lite[9][256] =
{
{
// uCode 0 - RSP SW 2.0X
@ -1077,4 +1085,4 @@ static rdp_instr gfx_instruction_lite[9][256] =
0, 0, 0, 0,
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
}
};
};

View File

@ -0,0 +1,16 @@
/***************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
* Copyright (C) 2002 Dave2001 *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License, or (at your option) any later version. *
* *
****************************************************************************/
#pragma once
extern rdp_instr gfx_instruction_lite[9][256];