(Xbox 1 MSVC) Runs now on Xbox 1

This commit is contained in:
twinaphex 2012-08-18 15:37:40 +02:00
parent 18e119b746
commit fd52ca3d2d
6 changed files with 42 additions and 41 deletions

View File

@ -19,7 +19,7 @@
#include "makesinckernel.h"
#include "array.h"
void makeSincKernel(short *const kernel, const unsigned phases, const unsigned phaseLen, double fc, double (*win)(long m, long M)) {
void makeSincKernel(short *const kernel, const unsigned phases, const unsigned phaseLen, double fc, double (*win)(const long m, const long M)) {
static const double PI = 3.14159265358979323846;
fc /= phases;

View File

@ -23,6 +23,6 @@
#include <cstdlib>
void makeSincKernel(short *kernel, unsigned phases,
unsigned phaseLen, double fc, double (*win)(long m, long M));
unsigned phaseLen, double fc, double (*win)(const long m, const long M));
#endif

View File

@ -169,28 +169,6 @@ size_t retro_get_memory_size(unsigned id)
return 0;
}
static void convert_frame(uint16_t *output, const uint32_t *input)
{
for (unsigned y = 0; y < 144; y++)
{
const uint32_t *src = input + y * 256;
uint16_t *dst = output + y * 256;
for (unsigned x = 0; x < 160; x++)
{
unsigned color = src[x];
unsigned out_color = 0;
// ARGB8888 => XRGB555. Should output 32-bit directly if libretro gets ARGB support later on.
out_color |= (color & 0xf80000) >> (3 + 6);
out_color |= (color & 0x00f800) >> (3 + 3);
out_color |= (color & 0x0000f8) >> (3 + 0);
dst[x] = out_color;
}
}
}
static void output_audio(const int16_t *samples, unsigned frames)
{
if (!frames)
@ -221,13 +199,14 @@ void retro_run()
union
{
uint32_t u32[2064 + 2064];
gambatte::uint_least32_t u32[2064 + 2064];
int16_t i16[2 * (2064 + 2064)];
} sound_buf;
unsigned samples = 2064;
uint32_t video_buf[256 * 144];
while (gb.runFor(video_buf, 256, sound_buf.u32, samples) == -1)
gambatte::uint_least32_t video_buf[256 * 144];
gambatte::uint_least32_t param2 = 256;
while (gb.runFor(video_buf, param2, sound_buf.u32, samples) == -1)
{
output_audio(sound_buf.i16, samples);
samples_count += samples;
@ -237,7 +216,25 @@ void retro_run()
samples_count += samples;
output_audio(sound_buf.i16, samples);
convert_frame(output_video, video_buf);
for (unsigned y = 0; y < 144; y++)
{
const gambatte::uint_least32_t *src = video_buf + y * 256;
uint16_t *dst = output_video + y * 256;
for (unsigned x = 0; x < 160; x++)
{
unsigned color = src[x];
unsigned out_color = 0;
// ARGB8888 => XRGB555. Should output 32-bit directly if libretro gets ARGB support later on.
out_color |= (color & 0xf80000) >> (3 + 6);
out_color |= (color & 0x00f800) >> (3 + 3);
out_color |= (color & 0x0000f8) >> (3 + 0);
dst[x] = out_color;
}
}
video_cb(output_video, 160, 144, 512);
frames_count++;
}

View File

@ -21,7 +21,7 @@
Optimization="0"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-2003-xbox1&quot;;..\..\..\src;..\..\..\..\common;..\..\..\..\common\resample;..\..\..\include"
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB"
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB;_XBOX1;__LIBRETRO__;LSB_FIRST"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -35,7 +35,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/$(ProjectName).lib"/>
OutputFile="$(OutDir)/libretro_xdk.lib"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
@ -55,7 +55,7 @@
OmitFramePointers="TRUE"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-2003-xbox1&quot;;..\..\..\src;..\..\..\..\common;..\..\..\..\common\resample;..\..\..\include"
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;_LIB"
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;_LIB;_XBOX1;__LIBRETRO__;LSB_FIRST"
StringPooling="TRUE"
RuntimeLibrary="0"
BufferSecurityCheck="TRUE"
@ -70,7 +70,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/$(ProjectName).lib"/>
OutputFile="$(OutDir)/libretro_xdk.lib"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
@ -90,7 +90,7 @@
OmitFramePointers="TRUE"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-2003-xbox1&quot;;..\..\..\src;..\..\..\..\common;..\..\..\..\common\resample;..\..\..\include"
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB"
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB;_XBOX1;__LIBRETRO__;LSB_FIRST"
StringPooling="TRUE"
RuntimeLibrary="0"
BufferSecurityCheck="TRUE"
@ -106,7 +106,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/$(ProjectName).lib"/>
OutputFile="$(OutDir)/libretro_xdk.lib"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
@ -126,7 +126,7 @@
OmitFramePointers="TRUE"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-2003-xbox1&quot;;..\..\..\src;..\..\..\..\common;..\..\..\..\common\resample;..\..\..\include"
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB"
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB;_XBOX1;__LIBRETRO__;LSB_FIRST"
StringPooling="TRUE"
RuntimeLibrary="0"
BufferSecurityCheck="TRUE"
@ -141,7 +141,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/$(ProjectName).lib"/>
OutputFile="$(OutDir)/libretro_xdk.lib"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
@ -162,7 +162,7 @@
OmitFramePointers="TRUE"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-2003-xbox1&quot;;..\..\..\src;..\..\..\..\common;..\..\..\..\common\resample;..\..\..\include"
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG;_LIB"
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG;_LIB;_XBOX1;__LIBRETRO__;LSB_FIRST"
StringPooling="TRUE"
RuntimeLibrary="0"
BufferSecurityCheck="TRUE"
@ -177,7 +177,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/$(ProjectName).lib"/>
OutputFile="$(OutDir)/libretro_xdk.lib"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
@ -196,6 +196,9 @@
<Filter
Name="libretro"
Filter="">
<File
RelativePath="..\..\libretro.cpp">
</File>
</Filter>
<Filter
Name="src"

View File

@ -70,16 +70,16 @@ class MinKeeper {
};
template<int dummy> struct FillLut<-1,dummy> {
static void fillLut(MinKeeper<ids> *) {}
static void fillLut(MinKeeper<ids> *const) {}
};
unsigned long values[ids];
unsigned long minValue_;
void (*updateValueLut[Num<LEVELS-1>::RESULT])(MinKeeper<ids>*);
void (*updateValueLut[Num<LEVELS-1>::RESULT])(MinKeeper<ids>*const);
int a[Sum<LEVELS>::RESULT];
template<int id> static void updateValue(MinKeeper<ids> *s);
template<int id> static void updateValue(MinKeeper<ids> *const s);
public:
MinKeeper(unsigned long initValue = 0xFFFFFFFF);

View File

@ -19,6 +19,7 @@
#include "statesaver.h"
#include "savestate.h"
#include "array.h"
#include <stdint.h>
#include <vector>
#include <cstring>
#include <algorithm>