Skip to content

Commit

Permalink
Using vanilla SNES9X code (except 4 lines added to port.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lmmenge committed Feb 15, 2012
1 parent 237ae1b commit 0a75c99
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 18 deletions.
1 change: 1 addition & 0 deletions Classes/LMAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#import "LMROMBrowserController.h"

// TODO: LM: Crash when deleting the last file in a "Section" in LMROMBrowserController
// TODO: LM: Open SMC, SFC, FIG, ZIP files from other iOS apps
// TODO: LM: License

Expand Down
23 changes: 17 additions & 6 deletions Classes/Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,30 @@
#define __IPHONE__
#define ZLIB
#define UNZIP_SUPPORT
#define LSB_FIRST

// "fixing" port.h so we don't have to modify the original SNES9X source
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64)
#undef LSB_FIRST
#endif
#define LSB_FIRST

// "Fixing" SNES9X Source when updated
// ===================================
// IMPORTANT: if you crash on S9xFixColour* when porting updated SNES9X sources, modify port.h to have these, after "#define GFX_MULTI_FORMAT"
#ifdef __IPHONE__
#undef GFX_MULTI_FORMAT
#define PIXEL_FORMAT RGB555
#endif

// IMPORTANT: there was another fix that was applied some time ago, but it seems not to matter now. In apu.cpp, replace:
// - if (shrink_buffer_size < (sample_count << 1))
// with
// + if (shrink_buffer_size < (sample_count << 1) || spc::shrink_buff


// "fixing" port.h so we don't have to further modify the original SNES9X source
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64)
#undef LSB_FIRST
#endif

// "fixing" uint8_t error in spc7110dec.cpp
#import <stdint.h>


// "Fixing" unzip
// ==============
Expand Down
8 changes: 4 additions & 4 deletions SNES9X/apu/apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@


#include <math.h>
#include "../snes9x.h"
#include "snes9x.h"
#include "apu.h"
#include "../snapshot.h"
#include "../display.h"
#include "snapshot.h"
#include "display.h"
#include "linear_resampler.h"
#include "hermite_resampler.h"

Expand Down Expand Up @@ -292,7 +292,7 @@ bool8 S9xMixSamples (uint8 *buffer, int sample_count)
sample_count <<= 1;

/* We still have to generate 16-bit samples for bit-dropping, too */
if (shrink_buffer_size < (sample_count << 1) || spc::shrink_buffer == NULL)
if (shrink_buffer_size < (sample_count << 1))
{
delete[] spc::shrink_buffer;
spc::shrink_buffer = new uint8[sample_count << 1];
Expand Down
2 changes: 1 addition & 1 deletion SNES9X/apu/apu.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
#ifndef _APU_H_
#define _APU_H_

#include "../snes9x.h"
#include "snes9x.h"
#include "SNES_SPC.h"

typedef void (*apu_callback) (void *);
Expand Down
2 changes: 1 addition & 1 deletion SNES9X/apu/linear_resampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define __LINEAR_RESAMPLER_H

#include "resampler.h"
#include "../snes9x.h"
#include "snes9x.h"

static const int f_prec = 15;
static const uint32 f__one = (1 << f_prec);
Expand Down
2 changes: 1 addition & 1 deletion SNES9X/spc7110dec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void SPC7110Decomp::reset() {
}

SPC7110Decomp::SPC7110Decomp() {
decomp_buffer = new uint8[decomp_buffer_size];
decomp_buffer = new uint8_t[decomp_buffer_size];
reset();

//initialize reverse morton lookup tables
Expand Down
2 changes: 1 addition & 1 deletion SNES9X/unzip/miniunz.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <errno.h>
#include <fcntl.h>

#if defined(unix) || defined(__IPHONE__)
#ifdef unix
# include <unistd.h>
# include <utime.h>
#else
Expand Down
2 changes: 1 addition & 1 deletion SNES9X/unzip/minizip.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <errno.h>
#include <fcntl.h>

#if defined(unix) || defined(__IPHONE__)
#ifdef unix
# include <unistd.h>
# include <utime.h>
# include <sys/types.h>
Expand Down
2 changes: 1 addition & 1 deletion SNES9X/unzip/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
return UNZ_PARAMERROR;


if (pfile_in_zip_read_info->read_buffer == NULL)
if ((pfile_in_zip_read_info->read_buffer == NULL))
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;
Expand Down
4 changes: 2 additions & 2 deletions SNES9X/unzip/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,9 @@ extern int ZEXPORT zipOpenNewFileInZip4 (file, filename, zipfi,
zi->ci.flag = flagBase;
if ((level==8) || (level==9))
zi->ci.flag |= 2;
if (level==2)
if ((level==2))
zi->ci.flag |= 4;
if (level==1)
if ((level==1))
zi->ci.flag |= 6;
if (password != NULL)
zi->ci.flag |= 1;
Expand Down

0 comments on commit 0a75c99

Please sign in to comment.