Unverified Commit dc8bd272 authored by Libretro-Admin's avatar Libretro-Admin Committed by GitHub
Browse files

Merge pull request #45 from negativeExponent/updates

Updates
parents 88c91e09 9cb3b249
Pipeline #2586 passed with stages
in 1 minute and 28 seconds
......@@ -206,7 +206,7 @@ static bool MDFNI_LoadGame(const uint8_t *data, size_t size)
MDFN_indent(1);
MDFN_printf(_("Using module: lynx\n\n"));
MDFN_printf("Using module: lynx\n\n");
MDFN_indent(1);
//
......@@ -301,31 +301,14 @@ bool retro_load_game(const struct retro_game_info *info)
surf->height = FB_HEIGHT;
surf->pitch = FB_WIDTH;
surf->bpp = system_color_depth;
surf->pixels = (uint16_t*)calloc(4, FB_WIDTH * FB_HEIGHT);
if (system_color_depth == 32)
if (!surf->pixels)
{
surf->pixels = (uint32_t*)calloc(4, FB_WIDTH * FB_HEIGHT);
if (!surf->pixels)
{
free(surf);
surf = NULL;
return false;
}
}
else if (system_color_depth == 16)
{
surf->pixels16 = (uint16_t*)calloc(2, FB_WIDTH * FB_HEIGHT);
if (!surf->pixels16)
{
free(surf);
surf = NULL;
return false;
}
}
else
free(surf);
surf = NULL;
return false;
}
lynxie->DisplaySetAttributes(surf->bpp);
......@@ -499,17 +482,9 @@ void retro_run()
unsigned width = spec.DisplayRect.w;
unsigned height = spec.DisplayRect.h;
unsigned pitch = FB_WIDTH << (system_color_depth >> 4);
if (surf->bpp == 32)
{
const uint32_t *pix = surf->pixels;
video_cb(pix, width, height, FB_WIDTH << 2);
}
else if (surf->bpp == 16)
{
const uint16_t *pix = surf->pixels16;
video_cb(pix, width, height, FB_WIDTH << 1);
}
video_cb(surf->pixels, width, height, pitch);
audio_batch_cb(spec.SoundBuf, spec.SoundBufSize);
......@@ -547,10 +522,6 @@ void retro_deinit()
{
if (surf)
{
if (surf->pixels16)
free(surf->pixels16);
surf->pixels16 = NULL;
if (surf->pixels)
free(surf->pixels);
surf->pixels = NULL;
......
......@@ -222,10 +222,10 @@ CCart::CCart(MDFNFILE *fp)
if(fp)
{
gamesize = GET_FSIZE_PTR(fp);
gamesize = fp->size;
// Calculate file's CRC32
mCRC32 = crc32(0, GET_FDATA_PTR(fp), gamesize);
mCRC32 = crc32(0, fp->data, gamesize);
MDFN_printf("File CRC32: 0x%08X.\n", mCRC32);
// Checkout the header bytes
......@@ -268,7 +268,7 @@ CCart::CCart(MDFNFILE *fp)
if (fp)
{
// re-calculate file crc32 minus header if any
mCRC32 = crc32(0, GET_FDATA_PTR(fp) + header_size, gamesize);
mCRC32 = crc32(0, fp->data + header_size, gamesize);
LYNX_DB db = CheckHash(mCRC32);
if (found)
{
......
......@@ -68,7 +68,7 @@ struct LYNX_HEADER
struct LYNX_DB
{
uint32 crc32;
char name[100];
const char *name;
uint32 filesize;
uint32 rotation;
uint32 reserved;
......
......@@ -422,7 +422,7 @@ void CMikie::CopyLineSurface(int32 bpp)
{
case 16:
{
uint16 *bitmap_tmp = mpDisplayCurrent->pixels16 + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
uint16 *bitmap_tmp = mpDisplayCurrent->pixels + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
for (uint32 loop = 0; loop < SCREEN_WIDTH / 2; loop++)
{
uint32 source = mpRamPointer[(uint16)mLynxAddr];
......@@ -447,7 +447,7 @@ void CMikie::CopyLineSurface(int32 bpp)
}
case 32:
{
uint32 *bitmap_tmp = mpDisplayCurrent->pixels + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
uint32 *bitmap_tmp = (uint32 *)mpDisplayCurrent->pixels + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
for (uint32 loop = 0; loop < SCREEN_WIDTH / 2; loop++)
{
uint32 source = mpRamPointer[(uint16)mLynxAddr];
......
......@@ -82,7 +82,7 @@ CSystem::CSystem(MDFNFILE *fp)
mFileType=HANDY_FILETYPE_HOMEBREW;
else if(!strcmp(&clip[0],"LYNX"))
mFileType=HANDY_FILETYPE_LNX;
else if(GET_FSIZE_PTR(fp)==128*1024 || GET_FSIZE_PTR(fp)==256*1024 || GET_FSIZE_PTR(fp)==512*1024)
else if(fp->size==128*1024 || fp->size==256*1024 || fp->size==512*1024)
/* Invalid Cart (type). but 128/256/512k size -> set to RAW and try to load raw rom image */
mFileType=HANDY_FILETYPE_RAW;
else
......@@ -293,7 +293,7 @@ void Emulate(EmulateSpecStruct *espec)
color_black = MAKECOLOR_16(30, 30, 30, 0);
for (int y = 0; y < 102; y++)
{
uint16 *row = espec->surface->pixels16 + y * espec->surface->pitch;
uint16 *row = espec->surface->pixels + y * espec->surface->pitch;
if (!LynxLineDrawn[y])
{
......@@ -307,7 +307,7 @@ void Emulate(EmulateSpecStruct *espec)
color_black = MAKECOLOR_32(30, 30, 30, 0);
for (int y = 0; y < 102; y++)
{
uint32 *row = espec->surface->pixels + y * espec->surface->pitch;
uint32 *row = (uint32*)espec->surface->pixels + y * espec->surface->pitch;
if (!LynxLineDrawn[y])
{
......
......@@ -6,26 +6,12 @@
#include <stdlib.h>
#include <string.h>
#define _(String) (String)
#include "git.h"
#ifdef _WIN32
#define strcasecmp _stricmp
#endif
#define GET_FDATA(fp) (fp.f_data)
#define GET_FSIZE(fp) (fp.f_size)
#define GET_FEXTS(fp) (fp.f_ext)
#define GET_FDATA_PTR(fp) (fp->data)
#define GET_FSIZE_PTR(fp) (fp->size)
#define GET_FEXTS_PTR(fp) (fp->ext)
#define gzopen(a, b) fopen(a, b)
#define gzread(a, b, c) fread(b, c, 1, a)
#define gzclose(a) fclose(a)
#define gzgetc(a) fgetc(a)
#define gzseek(a,b,c) fseek(a,b,c)
extern MDFNGI *MDFNGameInfo;
#include "settings.h"
......
......@@ -50,8 +50,7 @@ typedef struct
typedef struct
{
uint16 *pixels16;
uint32 *pixels;
uint16 *pixels;
int32 width;
int32 height;
int32 pitch;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment