mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
DSP: add a crazy little shell script that will build DSPCore into DSPSpy. make DSPCore build in gekko mode. re-add GC-pad controls to DSPSpy (now it can run inside Dolphin, kind of neat but not super useful for the obvious reasons).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3141 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -152,6 +152,10 @@
|
||||
RelativePath=".\processor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Stubs.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -17,16 +17,16 @@ include $(DEVKITPPC)/wii_rules
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := . source
|
||||
SOURCES := . emu
|
||||
RESOURCES := ../resources
|
||||
DATA := data
|
||||
DATA := data
|
||||
INCLUDES := include ../Core/Common/Src .
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -save-temps -g -O2 -Wall --no-strict-aliasing $(MACHDEP) $(INCLUDE)
|
||||
CFLAGS = -save-temps -O2 -Wall --no-strict-aliasing $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
@ -66,6 +66,7 @@ sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
|
99
Source/DSPSpy/Stubs.cpp
Normal file
99
Source/DSPSpy/Stubs.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
// Stubs to make DSPCore compile as part of DSPSpy.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Thread.h"
|
||||
|
||||
void *AllocateMemoryPages(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void FreeMemoryPages(void *pages, size_t size)
|
||||
{
|
||||
free(pages);
|
||||
}
|
||||
|
||||
void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
}
|
||||
|
||||
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
}
|
||||
|
||||
bool DSPHost_OnThread()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Well, it's just RAM right? :)
|
||||
u8 DSPHost_ReadHostMemory(u32 address)
|
||||
{
|
||||
u8 *ptr = (u8*)address;
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void DSPHost_CodeLoaded(const u8 *code, int size)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
CriticalSection::CriticalSection(int)
|
||||
{
|
||||
}
|
||||
CriticalSection::~CriticalSection()
|
||||
{
|
||||
}
|
||||
|
||||
void CriticalSection::Enter()
|
||||
{
|
||||
}
|
||||
|
||||
void CriticalSection::Leave()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace File
|
||||
{
|
||||
|
||||
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, text_file ? "w" : "wb");
|
||||
if (!f)
|
||||
return false;
|
||||
size_t len = str.size();
|
||||
if (len != fwrite(str.data(), 1, str.size(), f))
|
||||
{
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadFileToString(bool text_file, const char *filename, std::string &str)
|
||||
{
|
||||
FILE *f = fopen(filename, text_file ? "r" : "rb");
|
||||
if (!f)
|
||||
return false;
|
||||
fseek(f, 0, SEEK_END);
|
||||
size_t len = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
char *buf = new char[len + 1];
|
||||
buf[fread(buf, 1, len, f)] = 0;
|
||||
str = std::string(buf, len);
|
||||
fclose(f);
|
||||
delete [] buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
6
Source/DSPSpy/build.sh
Normal file
6
Source/DSPSpy/build.sh
Normal file
@ -0,0 +1,6 @@
|
||||
../../Binary/x64/DSPTool.exe -h dsp_code tests/mul_test.ds
|
||||
mkdir emu
|
||||
cp ../Core/DSPCore/Src/*.cpp emu
|
||||
cp ../Core/DSPCore/Src/*.h emu
|
||||
make
|
||||
|
@ -303,7 +303,6 @@ void init_video(void)
|
||||
break;
|
||||
}
|
||||
|
||||
PAD_Init();
|
||||
xfb = SYS_AllocateFramebuffer(rmode);
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
@ -366,6 +365,8 @@ int main()
|
||||
//printf("Network Intitalized\n");
|
||||
#endif
|
||||
|
||||
// Both GC and Wii controls.
|
||||
PAD_Init();
|
||||
WPAD_Init();
|
||||
|
||||
int dsp_steps = 0;
|
||||
@ -424,6 +425,7 @@ int main()
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
PAD_ScanPads();
|
||||
WPAD_ScanPads();
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
|
||||
exit(0);
|
||||
@ -452,7 +454,7 @@ int main()
|
||||
DCFlushRange(xfb, 0x200000);
|
||||
|
||||
// Use B to start over.
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_B)
|
||||
if ((WPAD_ButtonsDown(0) & WPAD_BUTTON_B) || (PAD_ButtonsDown(0) & PAD_BUTTON_START))
|
||||
{
|
||||
dsp_steps = 0; // Let's not add the new steps after the original ones. That was just annoying.
|
||||
|
||||
@ -474,14 +476,14 @@ int main()
|
||||
|
||||
// Navigate between results using + and - buttons.
|
||||
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_PLUS)
|
||||
if ((WPAD_ButtonsDown(0) & WPAD_BUTTON_PLUS) || (PAD_ButtonsDown(0) & PAD_BUTTON_X))
|
||||
{
|
||||
show_step++;
|
||||
if (show_step >= dsp_steps)
|
||||
show_step = 0;
|
||||
}
|
||||
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_MINUS)
|
||||
if ((WPAD_ButtonsDown(0) & WPAD_BUTTON_MINUS) || (PAD_ButtonsDown(0) & PAD_BUTTON_Y))
|
||||
{
|
||||
show_step--;
|
||||
if (show_step < 0)
|
||||
|
4
Source/DSPSpy/sbuild.sh
Normal file
4
Source/DSPSpy/sbuild.sh
Normal file
@ -0,0 +1,4 @@
|
||||
../../Binary/x64/DSPTool.exe -h dsp_code tests/mul_test.ds
|
||||
rm -rf emu
|
||||
make
|
||||
|
Reference in New Issue
Block a user