Skip to content

Commit

Permalink
fixes #715 RAYMAN
Browse files Browse the repository at this point in the history
(cherry picked from commit 6adac87798bb94437a87313113032d28716eae83)
  • Loading branch information
devmiyax committed May 21, 2020
1 parent c9eb408 commit 68edd4c
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 172 deletions.
4 changes: 2 additions & 2 deletions yabause/src/vdp1.c
Expand Up @@ -125,7 +125,7 @@ u8 FASTCALL Vdp1FrameBufferReadByte(u32 addr) {

u16 FASTCALL Vdp1FrameBufferReadWord(u32 addr) {
addr &= 0x3FFFF;
if (VIDCore->Vdp1ReadFrameBuffer && addr < 0x30000 ){
if (VIDCore->Vdp1ReadFrameBuffer ){
u16 val;
VdpLockVram();
VIDCore->Vdp1ReadFrameBuffer(1, addr, &val);
Expand All @@ -139,7 +139,7 @@ u16 FASTCALL Vdp1FrameBufferReadWord(u32 addr) {

u32 FASTCALL Vdp1FrameBufferReadLong(u32 addr) {
addr &= 0x3FFFF;
if (VIDCore->Vdp1ReadFrameBuffer && addr < 0x30000 ){
if (VIDCore->Vdp1ReadFrameBuffer ){
u32 val;
VdpLockVram();
VIDCore->Vdp1ReadFrameBuffer(2, addr, &val);
Expand Down
2 changes: 2 additions & 0 deletions yabause/src/vdp2.c
Expand Up @@ -968,6 +968,8 @@ void vdp2VBlankOUT(void) {
if (Vdp1External.frame_change_plot == 1 || Vdp1External.status == VDP1_STATUS_RUNNING ){
FRAMELOG("[VDP1] frame_change_plot == 1 start drawing immidiatly", Vdp1Regs->EDSR);
LOG("[VDP1] Start Drawing");
Vdp1Regs->addr = 0;
Vdp1Regs->COPR = 0;
Vdp1Draw();
isrender = 1;
}
Expand Down
8 changes: 5 additions & 3 deletions yabause/src/vidogl.c
Expand Up @@ -210,7 +210,7 @@ static void Vdp2DrawRotation_in(RBGDrawInfo * rbg);
static void Vdp2DrawRotationSync();
static void Vdp2DrawRBG0(void);

static u32 Vdp2ColorRamGetColor(u32 colorindex, int alpha);
u32 Vdp2ColorRamGetColor(u32 colorindex, int alpha);
static void Vdp2PatternAddrPos(vdp2draw_struct *info, int planex, int x, int planey, int y);
static void Vdp2DrawPatternPos(vdp2draw_struct *info, YglTexture *texture, int x, int y, int cx, int cy, int lines);
static INLINE void ReadVdp2ColorOffset(Vdp2 * regs, vdp2draw_struct *info, int mask);
Expand Down Expand Up @@ -1135,7 +1135,7 @@ static u16 Vdp2ColorRamGetColorRaw(u32 colorindex) {
return 0;
}

static u32 Vdp2ColorRamGetColor(u32 colorindex, int alpha)
u32 Vdp2ColorRamGetColor(u32 colorindex, int alpha)
{
switch (Vdp2Internal.ColorMode)
{
Expand Down Expand Up @@ -2536,7 +2536,7 @@ static void FASTCALL Vdp2DrawBitmapCoordinateInc(vdp2draw_struct *info, YglTextu

static void Vdp2DrawPatternPos(vdp2draw_struct *info, YglTexture *texture, int x, int y, int cx, int cy, int lines )
{
u64 cacheaddr = ((u32)(info->alpha >> 3) << 27) |
u64 cacheaddr = (((u64)(info->priority&0xF))<<35) | ((u32)(info->alpha >> 3) << 27) |
(info->paladdr << 20) | info->charaddr | info->transparencyenable |
((info->patternpixelwh >> 4) << 1) | (((u64)(info->coloroffset >> 8) & 0x07) << 32);

Expand Down Expand Up @@ -2597,10 +2597,12 @@ static void Vdp2DrawPatternPos(vdp2draw_struct *info, YglTexture *texture, int x

if (1 == YglIsCached(_Ygl->texture_manager, cacheaddr, &c))
{
//printf("x=%d,y=%d %lx cached\n",x,y,cacheaddr);
YglCachedQuadOffset(&tile, &c, cx, cy, info->coordincx, info->coordincy);
return;
}

//printf("x=%d,y=%d %lx not cached\n",x,y,cacheaddr);
YglQuadOffset(&tile, texture, &c, cx, cy, info->coordincx, info->coordincy);
YglCacheAdd(_Ygl->texture_manager, cacheaddr, &c);

Expand Down
8 changes: 4 additions & 4 deletions yabause/src/vidsoft.c
Expand Up @@ -203,7 +203,7 @@ typedef struct

//////////////////////////////////////////////////////////////////////////////

static INLINE u32 FASTCALL Vdp2ColorRamGetColor(u32 addr, u8* vdp2_color_ram)
static INLINE u32 FASTCALL Vdp2ColorRamGetColorSoft(u32 addr, u8* vdp2_color_ram)
{
switch(Vdp2Internal.ColorMode)
{
Expand Down Expand Up @@ -392,23 +392,23 @@ static INLINE int Vdp2FetchPixel(vdp2draw_struct *info, int x, int y, u32 *color
if (!(*dot & 0xF) && info->transparencyenable) return 0;
else
{
*color = Vdp2ColorRamGetColor(info->coloroffset + (paladdr | (*dot & 0xF)),vdp2_color_ram);
*color = Vdp2ColorRamGetColorSoft(info->coloroffset + (paladdr | (*dot & 0xF)),vdp2_color_ram);
return 1;
}
case 1: // 8 BPP
*dot = T1ReadByte(ram, ((charaddr + (y * info->cellw) + x) & 0x7FFFF));
if (!(*dot & 0xFF) && info->transparencyenable) return 0;
else
{
*color = Vdp2ColorRamGetColor(info->coloroffset + (paladdr | (*dot & 0xFF)), vdp2_color_ram);
*color = Vdp2ColorRamGetColorSoft(info->coloroffset + (paladdr | (*dot & 0xFF)), vdp2_color_ram);
return 1;
}
case 2: // 16 BPP(palette)
*dot = T1ReadWord(ram, ((charaddr + ((y * info->cellw) + x) * 2) & 0x7FFFF));
if ((*dot == 0) && info->transparencyenable) return 0;
else
{
*color = Vdp2ColorRamGetColor(info->coloroffset + *dot, vdp2_color_ram);
*color = Vdp2ColorRamGetColorSoft(info->coloroffset + *dot, vdp2_color_ram);
return 1;
}
case 3: // 16 BPP(RGB)
Expand Down
10 changes: 6 additions & 4 deletions yabause/src/ygl.h
Expand Up @@ -628,10 +628,6 @@ typedef struct {
u32 targetfbo;
int vpd1_running;
int cpu_framebuffer_write[2];
int min_fb_x;
int max_fb_x;
int min_fb_y;
int max_fb_y;

GLuint cram_tex;
GLuint cram_tex_pbo;
Expand All @@ -652,6 +648,9 @@ typedef struct {

ASPECT_RATE_MODE aspect_rate_mode;

int bWriteCpuFrameBuffer;
u32 * CpuWriteFrameBuffer;

} Ygl;

extern Ygl * _Ygl;
Expand Down Expand Up @@ -848,6 +847,9 @@ void Ygl_uniformVDP2DrawFrameBufferShadow(void * p);
void Ygl_uniformVDP2DrawFramebuffer(void * p, float from, float to, float * offsetcol, int blend);
int YglDrawBackScreen(float w, float h);

u32 Vdp2ColorRamGetColor(u32 colorindex, int alpha);


#endif // YGL_H

#endif // defined(HAVE_LIBGL) || defined(__ANDROID__)
Expand Down

0 comments on commit 68edd4c

Please sign in to comment.