Browse Source

Replaced lazyusf2 with more compatible lazyusf1, and updated its timing code significantly.

master
parent
commit
88079f6041
39 changed files with 9519 additions and 92 deletions
  1. +20
    -20
      Frameworks/lazyusf/lazyusf.xcodeproj/project.pbxproj
  2. +79
    -25
      Frameworks/lazyusf/lazyusf/audio.c
  3. +9
    -0
      Frameworks/lazyusf/lazyusf/audio.h
  4. +22
    -13
      Frameworks/lazyusf/lazyusf/cpu.c
  5. +2
    -0
      Frameworks/lazyusf/lazyusf/cpu.h
  6. +822
    -0
      Frameworks/lazyusf/lazyusf/debugger/dbg_decoder.c
  7. +61
    -0
      Frameworks/lazyusf/lazyusf/debugger/dbg_decoder.h
  8. +1481
    -0
      Frameworks/lazyusf/lazyusf/debugger/dbg_decoder_local.h
  9. +31
    -0
      Frameworks/lazyusf/lazyusf/debugger/dbg_types.h
  10. +1
    -1
      Frameworks/lazyusf/lazyusf/interpreter_cpu.c
  11. +0
    -0
      Frameworks/lazyusf/lazyusf/lazyusf-Info.plist
  12. +1
    -2
      Frameworks/lazyusf/lazyusf/memory.c
  13. +57
    -0
      Frameworks/lazyusf/lazyusf/osal/preproc.h
  14. +369
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/LICENSES
  15. +1032
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/alist.c
  16. +174
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/alist.h
  17. +346
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/alist_audio.c
  18. +383
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/alist_naudio.c
  19. +665
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/alist_nead.c
  20. +43
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/arithmetics.h
  21. +130
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/audio.c
  22. +45
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/audio.h
  23. +54
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/cicx105.c
  24. +39
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/common.h
  25. +443
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/hle.c
  26. +54
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/hle.h
  27. +38
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/hle_external.h
  28. +78
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/hle_internal.h
  29. +596
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/jpeg.c
  30. +76
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/memory.c
  31. +184
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/memory.h
  32. +686
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/mp3.c
  33. +985
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/musyx.c
  34. +118
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/plugin.c
  35. +146
    -0
      Frameworks/lazyusf/lazyusf/rsp_hle/ucodes.h
  36. +119
    -1
      Frameworks/lazyusf/lazyusf/usf.c
  37. +70
    -0
      Frameworks/lazyusf/lazyusf/usf_internal.h
  38. +30
    -0
      Frameworks/lazyusf2/lazyusf2/lazyusf2-Info.plist
  39. +30
    -30
      Plugins/HighlyComplete/HighlyComplete.xcodeproj/project.pbxproj

+ 20
- 20
Frameworks/lazyusf/lazyusf.xcodeproj/project.pbxproj View File

@@ -29,17 +29,20 @@
83CA15F01A988138005E7ED4 /* musyx.c in Sources */ = {isa = PBXBuildFile; fileRef = 83CA15151A988138005E7ED4 /* musyx.c */; };
83CA15F11A988138005E7ED4 /* plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 83CA15161A988138005E7ED4 /* plugin.c */; };
83CA15F21A988138005E7ED4 /* ucodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CA15171A988138005E7ED4 /* ucodes.h */; };
83DA153920F6F28E0096D348 /* preproc.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DA153820F6F28E0096D348 /* preproc.h */; };
83DA153E20F6F2A70096D348 /* dbg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DA153A20F6F2A70096D348 /* dbg_types.h */; };
83DA153F20F6F2A70096D348 /* dbg_decoder_local.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DA153B20F6F2A70096D348 /* dbg_decoder_local.h */; };
83DA154020F6F2A70096D348 /* dbg_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 83DA153C20F6F2A70096D348 /* dbg_decoder.c */; };
83DA154120F6F2A70096D348 /* dbg_decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DA153D20F6F2A70096D348 /* dbg_decoder.h */; };
83E1578920F6E2D500BAA65A /* audio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E1578820F6E2D500BAA65A /* audio.h */; };
83E1578C20F6E2E000BAA65A /* interpreter_cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E1578A20F6E2E000BAA65A /* interpreter_cpu.h */; };
83E1578D20F6E2E000BAA65A /* pif.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E1578B20F6E2E000BAA65A /* pif.h */; };
83E1578F20F6E32B00BAA65A /* lazyusf-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 83E1578E20F6E32B00BAA65A /* lazyusf-Info.plist */; };
83E1579220F6E33900BAA65A /* preproc.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E1579120F6E33800BAA65A /* preproc.h */; };
83E1579520F6E3A000BAA65A /* our-stdbool.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E1579420F6E39F00BAA65A /* our-stdbool.h */; };
83E1579620F6E3F100BAA65A /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 835E768C20F6E2BD008F45E7 /* audio.c */; };
83E1579720F6E3F500BAA65A /* audiolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 8309DC5E20F6E24C0056CC70 /* audiolib.c */; };
83E1579820F6E3F900BAA65A /* cpu_hle.c in Sources */ = {isa = PBXBuildFile; fileRef = 835E768420F6E2BC008F45E7 /* cpu_hle.c */; };
83E1579920F6E3FD00BAA65A /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 835E768F20F6E2BD008F45E7 /* cpu.c */; };
83E1579A20F6E40200BAA65A /* dbg_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8309DC6520F6E24C0056CC70 /* dbg_decoder.c */; };
83E1579B20F6E40900BAA65A /* dma.c in Sources */ = {isa = PBXBuildFile; fileRef = 8309DC6A20F6E24D0056CC70 /* dma.c */; };
83E1579C20F6E40C00BAA65A /* exception.c in Sources */ = {isa = PBXBuildFile; fileRef = 8309DC6320F6E24C0056CC70 /* exception.c */; };
83E1579D20F6E41100BAA65A /* interpreter_cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 835E768620F6E2BC008F45E7 /* interpreter_cpu.c */; };
@@ -57,9 +60,6 @@
83E157A920F6E5C600BAA65A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8309DC6220F6E24C0056CC70 /* config.h */; };
83E157AA20F6E5CA00BAA65A /* cpu_hle.h in Headers */ = {isa = PBXBuildFile; fileRef = 835E768520F6E2BC008F45E7 /* cpu_hle.h */; };
83E157AB20F6E5CE00BAA65A /* cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 835E769420F6E2BE008F45E7 /* cpu.h */; };
83E157AC20F6E5D300BAA65A /* dbg_decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8309DC6620F6E24C0056CC70 /* dbg_decoder.h */; };
83E157AD20F6E5D700BAA65A /* dbg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 8309DC6720F6E24C0056CC70 /* dbg_types.h */; };
83E157AE20F6E5DA00BAA65A /* dbg_decoder_local.h in Headers */ = {isa = PBXBuildFile; fileRef = 8309DC6820F6E24C0056CC70 /* dbg_decoder_local.h */; };
83E157AF20F6E5E000BAA65A /* dma.h in Headers */ = {isa = PBXBuildFile; fileRef = 835E768320F6E2BC008F45E7 /* dma.h */; };
83E157B020F6E5E600BAA65A /* exception.h in Headers */ = {isa = PBXBuildFile; fileRef = 835E768920F6E2BD008F45E7 /* exception.h */; };
83E157B120F6E5EE00BAA65A /* interpreter_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = 8309DC5D20F6E24B0056CC70 /* interpreter_ops.h */; };
@@ -135,10 +135,6 @@
8309DC6120F6E24C0056CC70 /* registers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = registers.c; sourceTree = "<group>"; };
8309DC6220F6E24C0056CC70 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
8309DC6320F6E24C0056CC70 /* exception.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exception.c; sourceTree = "<group>"; };
8309DC6520F6E24C0056CC70 /* dbg_decoder.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dbg_decoder.c; sourceTree = "<group>"; };
8309DC6620F6E24C0056CC70 /* dbg_decoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dbg_decoder.h; sourceTree = "<group>"; };
8309DC6720F6E24C0056CC70 /* dbg_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dbg_types.h; sourceTree = "<group>"; };
8309DC6820F6E24C0056CC70 /* dbg_decoder_local.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dbg_decoder_local.h; sourceTree = "<group>"; };
8309DC6920F6E24C0056CC70 /* rsp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rsp.h; sourceTree = "<group>"; };
8309DC6A20F6E24D0056CC70 /* dma.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dma.c; sourceTree = "<group>"; };
8309DC6B20F6E24D0056CC70 /* registers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = registers.h; sourceTree = "<group>"; };
@@ -242,11 +238,15 @@
83CA15161A988138005E7ED4 /* plugin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = plugin.c; sourceTree = "<group>"; };
83CA15171A988138005E7ED4 /* ucodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ucodes.h; sourceTree = "<group>"; };
83CA16381A988191005E7ED4 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
83DA153820F6F28E0096D348 /* preproc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preproc.h; sourceTree = "<group>"; };
83DA153A20F6F2A70096D348 /* dbg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbg_types.h; sourceTree = "<group>"; };
83DA153B20F6F2A70096D348 /* dbg_decoder_local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbg_decoder_local.h; sourceTree = "<group>"; };
83DA153C20F6F2A70096D348 /* dbg_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dbg_decoder.c; sourceTree = "<group>"; };
83DA153D20F6F2A70096D348 /* dbg_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbg_decoder.h; sourceTree = "<group>"; };
83E1578820F6E2D500BAA65A /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.h; sourceTree = "<group>"; };
83E1578A20F6E2E000BAA65A /* interpreter_cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interpreter_cpu.h; sourceTree = "<group>"; };
83E1578B20F6E2E000BAA65A /* pif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pif.h; sourceTree = "<group>"; };
83E1578E20F6E32B00BAA65A /* lazyusf-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "lazyusf-Info.plist"; sourceTree = "<group>"; };
83E1579120F6E33800BAA65A /* preproc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preproc.h; sourceTree = "<group>"; };
83E1579420F6E39F00BAA65A /* our-stdbool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "our-stdbool.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */

@@ -265,10 +265,10 @@
8309DC6420F6E24C0056CC70 /* debugger */ = {
isa = PBXGroup;
children = (
8309DC6520F6E24C0056CC70 /* dbg_decoder.c */,
8309DC6620F6E24C0056CC70 /* dbg_decoder.h */,
8309DC6720F6E24C0056CC70 /* dbg_types.h */,
8309DC6820F6E24C0056CC70 /* dbg_decoder_local.h */,
83DA153B20F6F2A70096D348 /* dbg_decoder_local.h */,
83DA153C20F6F2A70096D348 /* dbg_decoder.c */,
83DA153D20F6F2A70096D348 /* dbg_decoder.h */,
83DA153A20F6F2A70096D348 /* dbg_types.h */,
);
path = debugger;
sourceTree = "<group>";
@@ -463,7 +463,7 @@
83E1579020F6E33800BAA65A /* osal */ = {
isa = PBXGroup;
children = (
83E1579120F6E33800BAA65A /* preproc.h */,
83DA153820F6F28E0096D348 /* preproc.h */,
);
path = osal;
sourceTree = "<group>";
@@ -489,10 +489,8 @@
83E157A920F6E5C600BAA65A /* config.h in Headers */,
83E157AA20F6E5CA00BAA65A /* cpu_hle.h in Headers */,
83E157AB20F6E5CE00BAA65A /* cpu.h in Headers */,
83E157AC20F6E5D300BAA65A /* dbg_decoder.h in Headers */,
83E157AD20F6E5D700BAA65A /* dbg_types.h in Headers */,
83E157AE20F6E5DA00BAA65A /* dbg_decoder_local.h in Headers */,
83E157AF20F6E5E000BAA65A /* dma.h in Headers */,
83DA153F20F6F2A70096D348 /* dbg_decoder_local.h in Headers */,
83E157B020F6E5E600BAA65A /* exception.h in Headers */,
83E1578C20F6E2E000BAA65A /* interpreter_cpu.h in Headers */,
83E157B120F6E5EE00BAA65A /* interpreter_ops.h in Headers */,
@@ -500,7 +498,6 @@
83E157B320F6E5F500BAA65A /* memory.h in Headers */,
83E157B420F6E5F800BAA65A /* opcode.h in Headers */,
83E157B520F6E5FA00BAA65A /* os.h in Headers */,
83E1579220F6E33900BAA65A /* preproc.h in Headers */,
83E1578D20F6E2E000BAA65A /* pif.h in Headers */,
83E157B620F6E60A00BAA65A /* registers.h in Headers */,
83E157B720F6E61A00BAA65A /* resampler.h in Headers */,
@@ -517,6 +514,7 @@
83E157C220F6E62900BAA65A /* vnand.h in Headers */,
83E157C320F6E62900BAA65A /* vrsq.h in Headers */,
83E157C420F6E62900BAA65A /* vnop.h in Headers */,
83DA153E20F6F2A70096D348 /* dbg_types.h in Headers */,
83E157C520F6E62900BAA65A /* vabs.h in Headers */,
83E157C620F6E62900BAA65A /* vadd.h in Headers */,
83E157C720F6E62900BAA65A /* vmacu.h in Headers */,
@@ -524,6 +522,7 @@
83E157C920F6E62900BAA65A /* vsub.h in Headers */,
83E157CA20F6E62900BAA65A /* vmudl.h in Headers */,
83E157CB20F6E62900BAA65A /* vlt.h in Headers */,
83DA153920F6F28E0096D348 /* preproc.h in Headers */,
83E157CC20F6E62900BAA65A /* vmudh.h in Headers */,
83E157CD20F6E62900BAA65A /* vge.h in Headers */,
83E157CE20F6E62900BAA65A /* vmadl.h in Headers */,
@@ -569,6 +568,7 @@
83E157EC20F6E67400BAA65A /* tlb.h in Headers */,
83E157ED20F6E67700BAA65A /* types.h in Headers */,
83E157EE20F6E67D00BAA65A /* usf_internal.h in Headers */,
83DA154120F6F2A70096D348 /* dbg_decoder.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -645,7 +645,6 @@
83E1579720F6E3F500BAA65A /* audiolib.c in Sources */,
83E1579820F6E3F900BAA65A /* cpu_hle.c in Sources */,
83E1579920F6E3FD00BAA65A /* cpu.c in Sources */,
83E1579A20F6E40200BAA65A /* dbg_decoder.c in Sources */,
83E1579B20F6E40900BAA65A /* dma.c in Sources */,
83E1579C20F6E40C00BAA65A /* exception.c in Sources */,
83E1579D20F6E41100BAA65A /* interpreter_cpu.c in Sources */,
@@ -668,6 +667,7 @@
83CA15EC1A988138005E7ED4 /* memory.c in Sources */,
83CA15EE1A988138005E7ED4 /* mp3.c in Sources */,
83CA15F01A988138005E7ED4 /* musyx.c in Sources */,
83DA154020F6F2A70096D348 /* dbg_decoder.c in Sources */,
83CA15F11A988138005E7ED4 /* plugin.c in Sources */,
83E157A620F6E47600BAA65A /* tlb.c in Sources */,
83E157A720F6E47A00BAA65A /* usf.c in Sources */,


+ 79
- 25
Frameworks/lazyusf/lazyusf/audio.c View File

@@ -6,6 +6,29 @@
#include "usf_internal.h"
static const uint32_t AI_STATUS_BUSY = 0x40000000;
static const uint32_t AI_STATUS_FULL = 0x80000000;
static uint32_t get_remaining_dma_length(usf_state_t *state)
{
unsigned int next_ai_event;
unsigned int remaining_dma_duration;
if (state->fifo[0].duration == 0)
return 0;
next_ai_event = state->Timers->NextTimer[AiTimer] + state->Timers->Timer;
if (!state->Timers->Active[AiTimer])
return 0;
remaining_dma_duration = next_ai_event;
if (remaining_dma_duration >= 0x80000000)
return 0;
return (uint32_t)((uint64_t)remaining_dma_duration * state->fifo[0].length / state->fifo[0].duration);
}
void AddBuffer(usf_state_t *state, unsigned char *buf, unsigned int length) {
unsigned int i, do_max;
int16_t * sample_buffer = state->sample_buffer;
@@ -48,42 +71,73 @@ void AddBuffer(usf_state_t *state, unsigned char *buf, unsigned int length) {
}
}
void AiLenChanged(usf_state_t * state) {
int32_t length = 0;
uint32_t address = (AI_DRAM_ADDR_REG & 0x00FFFFF8);
length = AI_LEN_REG & 0x3FFF8;
static unsigned int get_dma_duration(usf_state_t *state)
{
unsigned int samples_per_sec = state->ROM_PARAMS.aidacrate / (1 + AI_DACRATE_REG);
#ifdef DEBUG_INFO
fprintf(state->debug_log, "Audio DMA push: %d %d\n", AI_DRAM_ADDR_REG, length);
#endif
AddBuffer(state, state->RDRAM+address, length);
return (uint32_t)(((uint64_t)(AI_LEN_REG)*state->VI_INTR_TIME*state->ROM_PARAMS.vilimit)
/ (4 * samples_per_sec));
}
if(length && !(AI_STATUS_REG&0x80000000)) {
const float VSyncTiming = 789000.0f;
double BytesPerSecond = 48681812.0 / (AI_DACRATE_REG + 1) * 4;
double CountsPerSecond = (double)((((double)VSyncTiming) * (double)60.0)) * 2.0;
double CountsPerByte = (double)CountsPerSecond / (double)BytesPerSecond;
unsigned int IntScheduled = (unsigned int)((double)AI_LEN_REG * CountsPerByte);
void do_dma(usf_state_t * state, const struct ai_dma * dma) {
AddBuffer(state, state->RDRAM + (dma->address & (state->RdramSize - 1) & ~3), dma->length);
ChangeTimer(state,AiTimer,IntScheduled);
if(!(AI_STATUS_REG&AI_STATUS_FULL)) {
if (state->enableFIFOfull) {
ChangeTimer(state,AiTimer,dma->duration + state->Timers->Timer);
}
else {
state->AudioIntrReg|=4;
}
}
}
if(state->enableFIFOfull) {
if(AI_STATUS_REG&0x40000000)
AI_STATUS_REG|=0x80000000;
}
void AiQueueInt(usf_state_t *state) {
ChangeTimer(state,AiTimer,state->enableFIFOfull ? get_dma_duration(state) + state->Timers->Timer : 0);
}
AI_STATUS_REG|=0x40000000;
void AiLenChanged(usf_state_t *state) {
unsigned int duration = get_dma_duration(state);
if (AI_STATUS_REG & AI_STATUS_BUSY) {
state->fifo[1].address = AI_DRAM_ADDR_REG;
state->fifo[1].length = AI_LEN_REG;
state->fifo[1].duration = duration;
if (state->enableFIFOfull)
AI_STATUS_REG |= AI_STATUS_FULL;
else
do_dma(state, &state->fifo[1]);
}
else {
state->fifo[0].address = AI_DRAM_ADDR_REG;
state->fifo[0].length = AI_LEN_REG;
state->fifo[0].duration = duration;
AI_STATUS_REG |= AI_STATUS_BUSY;
do_dma(state, &state->fifo[0]);
}
}
void AiTimerDone(usf_state_t *state) {
if (AI_STATUS_REG & AI_STATUS_FULL) {
state->fifo[0].address = state->fifo[1].address;
state->fifo[0].length = state->fifo[1].length;
state->fifo[0].duration = state->fifo[1].duration;
AI_STATUS_REG &= ~AI_STATUS_FULL;
do_dma(state, &state->fifo[0]);
}
else {
AI_STATUS_REG &= ~AI_STATUS_BUSY;
}
}
unsigned int AiReadLength(usf_state_t * state) {
AI_LEN_REG = 0;
return AI_LEN_REG;
return get_remaining_dma_length(state);
}
void AiDacrateChanged(usf_state_t * state, unsigned int value) {
AI_DACRATE_REG = value;
state->SampleRate = 48681812 / (AI_DACRATE_REG + 1);
state->SampleRate = (state->ROM_PARAMS.aidacrate) / (AI_DACRATE_REG + 1);
}

+ 9
- 0
Frameworks/lazyusf/lazyusf/audio.h View File

@@ -5,8 +5,17 @@
#include "cpu.h"
#include "memory.h"
struct ai_dma
{
uint32_t address;
uint32_t length;
unsigned int duration;
};
uint32_t AiReadLength(usf_state_t *);
void AiLenChanged(usf_state_t *);
void AiDacrateChanged(usf_state_t *, uint32_t value);
void AiTimerDone(usf_state_t *);
void AiQueueInt(usf_state_t *);
#endif

+ 22
- 13
Frameworks/lazyusf/lazyusf/cpu.c View File

@@ -466,18 +466,28 @@ void StartEmulationFromSave ( usf_state_t * state, void * savestate ) {
init_rsp(state);
Machine_LoadStateFromRAM(state, savestate);
AI_STATUS_REG = 0;
((uint32_t *)(state->RDRAM))[0x300/4] = state->ROM_PARAMS.systemtype;
state->SampleRate = 48681812 / (AI_DACRATE_REG + 1);
state->SampleRate = (state->ROM_PARAMS.aidacrate) / (AI_DACRATE_REG + 1);
if(state->enableFIFOfull) {
const float VSyncTiming = 789000.0f;
double BytesPerSecond = 48681812.0 / (AI_DACRATE_REG + 1) * 4;
double CountsPerSecond = (double)(((double)VSyncTiming) * (double)60.0);
double CountsPerByte = (double)CountsPerSecond / (double)BytesPerSecond;
uint32_t IntScheduled = (uint32_t)((double)AI_LEN_REG * CountsPerByte);
ChangeTimer(state,AiTimer,IntScheduled);
AI_STATUS_REG|=0x40000000;
if (VI_V_SYNC_REG == 0)
{
state->VI_INTR_TIME = 500000;
}
else
{
state->VI_INTR_TIME = (VI_V_SYNC_REG + 1) * 1500;
if ((VI_V_SYNC_REG & 1) != 0)
{
state->VI_INTR_TIME -= 38;
}
}
AiQueueInt(state);
AI_STATUS_REG |= 0x40000000;
}
state->OLD_VI_V_SYNC_REG = ~VI_V_SYNC_REG;
@@ -594,10 +604,9 @@ void TimerDone (usf_state_t * state) {
*state->WaitMode=0;
break;
case AiTimer:
ChangeTimer(state,AiTimer,0);
AI_STATUS_REG=0;
AiTimerDone(state);
state->AudioIntrReg|=4;
//CheckInterrupts(state);
CheckInterrupts(state);
break;
}
CheckTimer(state);


+ 2
- 0
Frameworks/lazyusf/lazyusf/cpu.h View File

@@ -37,6 +37,8 @@
#include "opcode.h"
#include "usf.h"
#define COUNT_PER_OP_DEFAULT 2
typedef struct {
int32_t DoSomething;
int32_t CloseCPU;


+ 822
- 0
Frameworks/lazyusf/lazyusf/debugger/dbg_decoder.c View File

@@ -0,0 +1,822 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus -- dbg_decoder.c *
* Copyright (c) 2010 Marshall B. Rogers <mbr@64.vg> *
* http://64.vg/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
* This is a heavily modified reentrant version of the MIPS disassembler found
* in the NetBSD operating system. I chose to use this as a base due to the
* small, compact, and easily manageable code.
*
* Original copyright/license information is contained below.
*/

/* $NetBSD: db_disasm.c,v 1.21 2009/12/14 00:46:06 matt Exp $ */

/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)kadb.c 8.1 (Berkeley) 6/10/93
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#ifndef MIPS32
#define MIPS32
#endif
#include "dbg_decoder.h"
#include "dbg_decoder_local.h"
#include "osal/preproc.h"


/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Data types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

typedef uint32_t db_addr_t;



/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Local variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

static const char * const r4k_str_op_name[64] =
{
/* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz",
/* 8 */ "addi", "addiu","slti", "sltiu","andi", "ori", "xori", "lui",
/*16 */ "cop0", "cop1", "cop2", "cop3", "beql", "bnel", "blezl","bgtzl",
/*24 */ "daddi","daddiu","ldl", "ldr", "op34", "op35", "op36", "op37",
/*32 */ "lb", "lh", "lwl", "lw", "lbu", "lhu", "lwr", "lwu",
/*40 */ "sb", "sh", "swl", "sw", "sdl", "sdr", "swr", "cache",
/*48 */ "ll", "lwc1", "lwc2", "lwc3", "lld", "ldc1", "ldc2", "ld",
/*56 */ "sc", "swc1", "swc2", "swc3", "scd", "sdc1", "sdc2", "sd"
};

static const char * const r4k_str_spec_name[64] =
{
/* 0 */ "sll", "spec01","srl", "sra", "sllv", "spec05","srlv","srav",
/* 8 */ "jr", "jalr", "spec12","spec13","syscall","break","spec16","sync",
/*16 */ "mfhi", "mthi", "mflo", "mtlo", "dsllv","spec25","dsrlv","dsrav",
/*24 */ "mult", "multu","div", "divu", "dmult","dmultu","ddiv","ddivu",
/*32 */ "add", "addu", "sub", "subu", "and", "or", "xor", "nor",
/*40 */ "spec50","spec51","slt","sltu", "dadd","daddu","dsub","dsubu",
/*48 */ "tge","tgeu","tlt","tltu","teq","spec65","tne","spec67",
/*56 */ "dsll","spec71","dsrl","dsra","dsll32","spec75","dsrl32","dsra32"
};

static const char * const r4k_str_spec2_name[4] = /* QED RM4650, R5000, etc. */
{
/* 0 */ "mad", "madu", "mul", "spec3"
};

static const char * const r4k_str_bcond_name[32] =
{
/* 0 */ "bltz", "bgez", "bltzl", "bgezl", "?", "?", "?", "?",
/* 8 */ "tgei", "tgeiu", "tlti", "tltiu", "teqi", "?", "tnei", "?",
/*16 */ "bltzal", "bgezal", "bltzall", "bgezall", "?", "?", "?", "?",
/*24 */ "?", "?", "?", "?", "?", "?", "?", "?",
};

static const char * const r4k_str_cop1_name[64] =
{
/* 0 */ "add", "sub", "mul", "div", "sqrt","abs", "mov", "neg",
/* 8 */ "fop08", "trunc.l","fop0a","fop0b","fop0c","trunc.w","fop0e","fop0f",
/*16 */ "fop10", "fop11","fop12","fop13","fop14","fop15","fop16","fop17",
/*24 */ "fop18", "fop19","fop1a","fop1b","fop1c","fop1d","fop1e","fop1f",
/*32 */ "cvt.s", "cvt.d","fop22","fop23","cvt.w","cvt.l","fop26","fop27",
/*40 */ "fop28", "fop29","fop2a","fop2b","fop2c","fop2d","fop2e","fop2f",
/*48 */ "c.f", "c.un","c.eq","c.ueq","c.olt","c.ult",
"c.ole", "c.ule",
/*56 */ "c.sf", "c.ngle","c.seq","c.ngl","c.lt","c.nge",
"c.le", "c.ngt"
};

static const char * const r4k_str_fmt_name[16] =
{
"s", "d", "e", "fmt3",
"w", "l", "fmt6", "fmt7",
"fmt8", "fmt9", "fmta", "fmtb",
"fmtc", "fmtd", "fmte", "fmtf"
};


static const char * const r4k_str_reg_name[32] =
{
"$zero", "$at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"t8", "t9", "k0", "k1", "$gp", "$sp", "s8", "$ra"
};

static const char * const r4k_str_c0_opname[64] =
{
"c0op00","tlbr", "tlbwi", "c0op03","c0op04","c0op05","tlbwr", "c0op07",
"tlbp", "c0op11","c0op12","c0op13","c0op14","c0op15","c0op16","c0op17",
"rfe", "c0op21","c0op22","c0op23","c0op24","c0op25","c0op26","c0op27",
"eret", "c0op31","c0op32","c0op33","c0op34","c0op35","c0op36","c0op37",
"c0op40","c0op41","c0op42","c0op43","c0op44","c0op45","c0op46","c0op47",
"c0op50","c0op51","c0op52","c0op53","c0op54","c0op55","c0op56","c0op57",
"c0op60","c0op61","c0op62","c0op63","c0op64","c0op65","c0op66","c0op67",
"c0op70","c0op71","c0op72","c0op73","c0op74","c0op75","c0op77","c0op77",
};

static const char * const r4k_str_c0_reg[32] =
{
"C0_INX", "C0_RAND", "C0_ENTRYLO0", "C0_ENTRYLO1",
"C0_CONTEXT", "C0_PAGEMASK", "C0_WIRED", "cp0r7",
"C0_BADVADDR", "C0_COUNT", "C0_ENTRYHI", "C0_COMPARE",
"C0_SR", "C0_CAUSE", "C0_EPC", "C0_PRID",
"C0_CONFIG", "C0_LLADDR", "C0_WATCHLO", "C0_WATCHHI",
"xcontext", "cp0r21", "cp0r22", "debug",
"depc", "perfcnt", "C0_ECC", "C0_CACHE_ERR",
"C0_TAGLO", "C0_TAGHI", "C0_ERROR_EPC", "desave"
};



/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Local functions - lookup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

/* Look up a symbol */
static char *
lookup_sym ( struct r4k_dis_t * state,
uint32_t address )
{
if( state->lookup_sym )
return state->lookup_sym( address, state->lookup_sym_d );
return NULL;
}

/* Look up an upper 16-bits relocation */
static char *
lookup_rel_hi16 ( struct r4k_dis_t * state,
uint32_t address )
{
if( state->lookup_rel_hi16 )
return state->lookup_rel_hi16( address, state->lookup_rel_hi16_d );
return NULL;
}

/* Look up a lower 16-bits relocation */
static char *
lookup_rel_lo16 ( struct r4k_dis_t * state,
uint32_t address )
{
if( state->lookup_rel_lo16 )
return state->lookup_rel_lo16( address, state->lookup_rel_lo16_d );
return NULL;
}



/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Local functions - disassembler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

/* Print text into the destination buffer */
static int
db_printf ( struct r4k_dis_t * state,
char * fmt,
... )
{
int l;
va_list ap;
char buffer[1024];
/* Prepare user provided */
va_start( ap, fmt );
l = vsnprintf( buffer, sizeof(buffer), fmt, ap );
va_end( ap );
/* Add it to our string */
state->dest += sprintf(
state->dest,
"%s",
buffer
);
state->length += l;
return l;
}


/* Print an address to a string. If there's a symbol, the name will be printed */
static int
print_addr ( struct r4k_dis_t * state,
uint32_t address )
{
int len;
char * sym;
/* Try to lookup symbol */
if( (sym = lookup_sym(state, address)) )
{
len = db_printf( state, "%s", sym );
}
else
{
len = db_printf( state, "0x%08X", address );
}
return len;
}


/* Disassemble an instruction */
static db_addr_t
db_disasm_insn ( struct r4k_dis_t * state,
int insn,
db_addr_t loc,
bool altfmt )
{
char * rel;
InstFmt i;

i.word = insn;

switch (i.JType.op) {
case OP_SPECIAL:
if (i.word == 0) {
db_printf(state, "nop");
break;
}
/* XXX
* "addu" is a "move" only in 32-bit mode. What's the correct
* answer - never decode addu/daddu as "move"?
*/
if (i.RType.func == OP_ADDU && i.RType.rt == 0) {
db_printf(state, "%-16s%s,%s",
"move",
r4k_str_reg_name[i.RType.rd],
r4k_str_reg_name[i.RType.rs]);
break;
}
db_printf(state, "%-16s", r4k_str_spec_name[i.RType.func]);
switch (i.RType.func) {
case OP_SLL:
case OP_SRL:
case OP_SRA:
case OP_DSLL:

case OP_DSRL:
case OP_DSRA:
case OP_DSLL32:
case OP_DSRL32:
case OP_DSRA32:
db_printf(state, "%s,%s,%d",
r4k_str_reg_name[i.RType.rd],
r4k_str_reg_name[i.RType.rt],
i.RType.shamt);
break;

case OP_SLLV:
case OP_SRLV:
case OP_SRAV:
case OP_DSLLV:
case OP_DSRLV:
case OP_DSRAV:
db_printf(state, "%s,%s,%s",
r4k_str_reg_name[i.RType.rd],
r4k_str_reg_name[i.RType.rt],
r4k_str_reg_name[i.RType.rs]);
break;

case OP_MFHI:
case OP_MFLO:
db_printf(state, "%s", r4k_str_reg_name[i.RType.rd]);
break;

case OP_JR:
case OP_JALR:
db_printf(state, "%s", r4k_str_reg_name[i.RType.rs]);
break;
case OP_MTLO:
case OP_MTHI:
db_printf(state, "%s", r4k_str_reg_name[i.RType.rs]);
break;

case OP_MULT:
case OP_MULTU:
case OP_DMULT:
case OP_DMULTU:
db_printf(state, "%s,%s",
r4k_str_reg_name[i.RType.rs],
r4k_str_reg_name[i.RType.rt]);
break;
case OP_DIV:
case OP_DIVU:
case OP_DDIV:
case OP_DDIVU:
db_printf(state, "$zero,%s,%s",
r4k_str_reg_name[i.RType.rs],
r4k_str_reg_name[i.RType.rt]);
break;


case OP_SYSCALL:
case OP_SYNC:
break;

case OP_BREAK:
db_printf(state, "%d", (i.RType.rs << 5) | i.RType.rt);
break;

default:
db_printf(state, "%s,%s,%s",
r4k_str_reg_name[i.RType.rd],
r4k_str_reg_name[i.RType.rs],
r4k_str_reg_name[i.RType.rt]);
}
break;

case OP_SPECIAL2:
if (i.RType.func == OP_MUL)
db_printf(state, "%s\t%s,%s,%s",
r4k_str_spec2_name[i.RType.func & 0x3],
r4k_str_reg_name[i.RType.rd],
r4k_str_reg_name[i.RType.rs],
r4k_str_reg_name[i.RType.rt]);
else
db_printf(state, "%s\t%s,%s",
r4k_str_spec2_name[i.RType.func & 0x3],
r4k_str_reg_name[i.RType.rs],
r4k_str_reg_name[i.RType.rt]);
break;

case OP_BCOND:
db_printf(state, "%-16s%s,", r4k_str_bcond_name[i.IType.rt],
r4k_str_reg_name[i.IType.rs]);
goto pr_displ;

case OP_BLEZ:
case OP_BLEZL:
case OP_BGTZ:
case OP_BGTZL:
db_printf(state, "%-16s%s,", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rs]);
goto pr_displ;

case OP_BEQ:
case OP_BEQL:
if (i.IType.rs == 0 && i.IType.rt == 0) {
db_printf(state, "%-16s", "b");
goto pr_displ;
}
/* FALLTHROUGH */
case OP_BNE:
case OP_BNEL:
db_printf(state, "%-16s%s,%s,", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rs],
r4k_str_reg_name[i.IType.rt]);
pr_displ:
print_addr( state, loc + 4 + ((short)i.IType.imm << 2) );
break;

case OP_COP0:
switch (i.RType.rs) {
case OP_BCx:
case OP_BCy:

db_printf(state, "bc0%c\t",
"ft"[i.RType.rt & COPz_BC_TF_MASK]);
goto pr_displ;

case OP_MT:
db_printf(state, "%-16s%s,%s",
"mtc0",
r4k_str_reg_name[i.RType.rt],
r4k_str_c0_reg[i.RType.rd]);
break;

case OP_DMT:
db_printf(state, "%-16s%s,%s",
"dmtc0",
r4k_str_reg_name[i.RType.rt],
r4k_str_c0_reg[i.RType.rd]);
break;

case OP_MF:
db_printf(state, "%-16s%s,%s", "mfc0",
r4k_str_reg_name[i.RType.rt],
r4k_str_c0_reg[i.RType.rd]);
break;

case OP_DMF:
db_printf(state, "%-16s%s,%s","dmfc0",
r4k_str_reg_name[i.RType.rt],
r4k_str_c0_reg[i.RType.rd]);
break;

default:
db_printf(state, "%s", r4k_str_c0_opname[i.FRType.func]);
}
break;

case OP_COP1:
switch (i.RType.rs) {
case OP_BCx:
case OP_BCy:
db_printf(state, "bc1%c%s\t\t",
"ft"[i.RType.rt & COPz_BC_TF_MASK],
(insn >> 16 & 0x1F) == 2 || (insn >> 16 & 0x1F) == 3 ? "l" : "");
goto pr_displ;

case OP_MT:
db_printf(state, "mtc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_MF:
db_printf(state, "mfc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_CT:
db_printf(state, "ctc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_CF:
db_printf(state, "cfc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_DMT:
db_printf(state, "dmtc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_DMF:
db_printf(state, "dmfc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_MTH:
db_printf(state, "mthc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

case OP_MFH:
db_printf(state, "mfhc1\t\t%s,$f%d",
r4k_str_reg_name[i.RType.rt],
i.RType.rd);
break;

default:
if( i.FRType.func == 0x21 || i.FRType.func == 0x20 || i.FRType.func == 0x24 || i.FRType.func == 0x25 ||
i.FRType.func == 7 || i.FRType.func == 6 || i.FRType.func == 0xd ||
i.FRType.func == 4 || i.FRType.func == 5 || i.FRType.func == 9 )
{/*NEG.fmt fd, fs*/
db_printf(state, "%s.%s\t\t$f%d,$f%d",
r4k_str_cop1_name[i.FRType.func],
r4k_str_fmt_name[i.FRType.fmt],
i.FRType.fd, i.FRType.fs);
}
else if( i.FRType.func != 1 && i.FRType.func != 2 && (insn & 0x3F) && !(insn >> 6 & 0x1F) ) /* C */
{
db_printf(state, "%s.%s\t\t$f%d,$f%d",
r4k_str_cop1_name[i.FRType.func],
r4k_str_fmt_name[i.FRType.fmt],
i.FRType.fs, i.FRType.ft);
}
else
{
db_printf(state, "%s.%s\t\t$f%d,$f%d,$f%d",
r4k_str_cop1_name[i.FRType.func],
r4k_str_fmt_name[i.FRType.fmt],
i.FRType.fd, i.FRType.fs, i.FRType.ft);
}
}
break;

case OP_J:
case OP_JAL:
db_printf(state, "%-16s", r4k_str_op_name[i.JType.op]);
print_addr(state, (loc & 0xF0000000) | (i.JType.target << 2));
break;
case OP_LDC1:
case OP_LWC1:
case OP_SWC1:
case OP_SDC1:
db_printf(state, "%-16s$f%d,", r4k_str_op_name[i.IType.op],
i.IType.rt);
goto loadstore;

case OP_LB:
case OP_LH:
case OP_LW:
case OP_LWL:
case OP_LWR:
case OP_LD:
case OP_LBU:
case OP_LHU:
case OP_LWU:
case OP_SB:
case OP_SH:
case OP_SW:
case OP_SWL:
case OP_SWR:
case OP_SD:
db_printf(state, "%-16s%s,", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt]);
loadstore:
/* Part of a relocation? */
if( (rel = lookup_rel_lo16(state, loc)) )
{
/* Yes. */
db_printf(state,
"%%lo(%s)(%s)",
rel,
r4k_str_reg_name[i.IType.rs]
);
break;
}
db_printf(state, "%d(%s)", (short)i.IType.imm,
r4k_str_reg_name[i.IType.rs]);
break;

case OP_ORI:
case OP_XORI:
if( i.IType.op == OP_ORI )
{
/* Part of a relocation? */
if( (rel = lookup_rel_lo16(state, loc)) )
{
/* Yes. */
db_printf(state,
"%-16s%s,%s,%%lo(%s)",
r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
r4k_str_reg_name[i.IType.rs],
rel
);
break;
}
else
{
db_printf(state, "%-16s%s,%s,0x%x", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
r4k_str_reg_name[i.IType.rs],
i.IType.imm);
break;
}
}
else
if (i.IType.rs == 0) {
db_printf(state, "%-16s%s,0x%x",
"li",
r4k_str_reg_name[i.IType.rt],
i.IType.imm);
break;
}
/* FALLTHROUGH */
case OP_ANDI:
db_printf(state, "%-16s%s,%s,0x%x", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
r4k_str_reg_name[i.IType.rs],
i.IType.imm);
break;

case OP_LUI:
{
/* Part of a relocation? */
if( (rel = lookup_rel_hi16(state, loc)) )
{
/* Yes. */
db_printf(state,
"%-16s%s,%%hi(%s)",
r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
rel
);
}
else
{
db_printf(state, "%-16s%s,0x%x", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
i.IType.imm);
}
}
break;

case OP_CACHE:
db_printf(state, "%-16s0x%x,0x%x(%s)",
r4k_str_op_name[i.IType.op],
i.IType.rt,
i.IType.imm,
r4k_str_reg_name[i.IType.rs]);
break;

case OP_ADDI:
case OP_DADDI:
case OP_ADDIU:
case OP_DADDIU:
{
/* Part of a relocation? */
if( (rel = lookup_rel_lo16(state, loc)) )
{
/* Yes. */
db_printf(state,
"%-16s%s,%s,%%lo(%s)",
r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
r4k_str_reg_name[i.IType.rs],
rel
);
break;
}
if (i.IType.rs == 0) {
db_printf(state, "%-16s%s,%d", "li",
r4k_str_reg_name[i.IType.rt],
(short)i.IType.imm);
break;
}
/* FALLTHROUGH */
default:
db_printf(state, "%-16s%s,%s,%d", r4k_str_op_name[i.IType.op],
r4k_str_reg_name[i.IType.rt],
r4k_str_reg_name[i.IType.rs],
(short)i.IType.imm);
} }
/*db_printf(state, "\n");*/
return (loc + 4);
}



/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

/* Disassemble an instruction with state */
static int
r4k_disassemble ( struct r4k_dis_t * state,
uint32_t instruction,
uint32_t location,
char * dest )
{
state->dest = dest;
db_disasm_insn( state, instruction, location, 0 );
return state->length;
}



/* Disassemble an instruction but split the opcode/operands into two char *'s */
static int
r4k_disassemble_split ( struct r4k_dis_t * state,
uint32_t instruction,
uint32_t location,
char ** opcode,
char ** operands )
{
int v, i;
char buff[128], * dupd;
v = r4k_disassemble(
state,
instruction,
location,
buff
);
dupd = strdup( buff );
*opcode = &dupd[0];
for( i = 0; buff[i] && buff[i] != ' '; i++ );
dupd[i] = '\0';
for( ; buff[i] && buff[i] == ' '; i++ );
*operands = &dupd[i];
return v;
}



/* Disassemble an instruction with a blank state but split op/operands */
static int
r4k_disassemble_split_quick ( uint32_t instruction,
uint32_t location,
char ** opcode,
char ** operands )
{
struct r4k_dis_t state;
/* Init state */
memset( &state, 0, sizeof(state) );
/* Perform */
return r4k_disassemble_split(
&state,
instruction,
location,
opcode,
operands
);
}


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[ DECODE_OP ]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[//

void r4300_decode_op ( uint32 instr, char * opcode, char * arguments, int counter )
{
char * _op, * _args;
_op = NULL;
_args = NULL;
r4k_disassemble_split_quick(
instr,
counter,
&_op,
&_args
);
strcpy( opcode, _op );
strcpy( arguments, _args );
free( _op );
}


+ 61
- 0
Frameworks/lazyusf/lazyusf/debugger/dbg_decoder.h View File

@@ -0,0 +1,61 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - dbg_decoder.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2010 Marshall B. Rogers <mbr@64.vg> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef __DECODER_H__
#define __DECODER_H__

#include "dbg_types.h"

#if defined(WIN32)
typedef unsigned int uint32_t;
typedef unsigned char bool;
#define false 0
#define true 1
#else
#include <stdint.h>
#include <stdbool.h>
#endif

/* Disassembler lookup handler */
typedef char * (*r4k_lookup_func)(uint32_t, void *);

/* Disassembler state */
typedef
struct r4k_dis_t
{
r4k_lookup_func lookup_sym;
void * lookup_sym_d;
r4k_lookup_func lookup_rel_hi16;
void * lookup_rel_hi16_d;
r4k_lookup_func lookup_rel_lo16;
void * lookup_rel_lo16_d;
/* Private */
char * dest;
int length;
}
R4kDis;

extern void r4300_decode_op ( uint32, char *, char *, int );


#endif /* __DECODER_H__ */


+ 1481
- 0
Frameworks/lazyusf/lazyusf/debugger/dbg_decoder_local.h
File diff suppressed because it is too large
View File


+ 31
- 0
Frameworks/lazyusf/lazyusf/debugger/dbg_types.h View File

@@ -0,0 +1,31 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - dbg_types.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2002 davFr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef __TYPES_H__
#define __TYPES_H__

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;

#endif /* __TYPES_H__ */


+ 1
- 1
Frameworks/lazyusf/lazyusf/interpreter_cpu.c View File

@@ -727,7 +727,7 @@ void ExecuteInterpreterOpCode (usf_state_t * state) {
}
#endif
COUNT_REGISTER += 2;
COUNT_REGISTER += state->ROM_PARAMS.countperop;
state->Timers->Timer -= 2;
RANDOM_REGISTER -= 1;


Frameworks/lazyusf2/lazyusf2/lazyusf-Info.plist → Frameworks/lazyusf/lazyusf/lazyusf-Info.plist View File


+ 1
- 2
Frameworks/lazyusf/lazyusf/memory.c View File

@@ -711,8 +711,7 @@ int32_t r4300i_SW_NonMemory ( usf_state_t * state, uint32_t PAddr, uint32_t Valu
CheckInterrupts(state);
break;
case 0x04500010:
AI_DACRATE_REG = Value;
//if (AiDacrateChanged != NULL) { AiDacrateChanged(SYSTEM_NTSC); }
AiDacrateChanged(state, Value);
break;
case 0x04500014: AI_BITRATE_REG = Value; break;
default:


+ 57
- 0
Frameworks/lazyusf/lazyusf/osal/preproc.h View File

@@ -0,0 +1,57 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal/preproc.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* this header file is for system-dependent #defines, #includes, and typedefs */

#if !defined (OSAL_PREPROC_H)
#define OSAL_PREPROC_H

#if defined(WIN32) && !defined(__MINGW32__)

/* macros */
#define OSAL_BREAKPOINT_INTERRUPT __asm{ int 3 };
#define ALIGN(BYTES,DATA) __declspec(align(BYTES)) DATA
#define osal_inline __inline

/* string functions */
#define osal_insensitive_strcmp(x, y) _stricmp(x, y)
#define snprintf _snprintf
#define strdup _strdup

/* for isnan() */
#include <float.h>
#define isnan _isnan

#else /* Not WIN32 */

/* macros */
#define OSAL_BREAKPOINT_INTERRUPT __asm__(" int $3; ");
#define ALIGN(BYTES,DATA) DATA __attribute__((aligned(BYTES)))
#define osal_inline inline

/* string functions */
#define osal_insensitive_strcmp(x, y) strcasecmp(x, y)

#endif


#endif /* OSAL_PREPROC_H */


+ 369
- 0
Frameworks/lazyusf/lazyusf/rsp_hle/LICENSES View File

@@ -0,0 +1,369 @@
Mupen64Plus-rsp-hle LICENSE
---------------------------

Mupen64Plus-rsp-hle is licensed under the GNU General Public License version 2.

The authors of Mupen64Plus-rsp-hle are:
* Richard Goedeken (Richard42)
* Bobby Smiles
* John Chadwick (NMN)
* James Hood (Ebenblues)
* Scott Gorman (okaygo)
* Scott Knauert (Tillin9)
* Jesse Dean (DarkJezter)
* Louai Al-Khanji (slougi)
* Bob Forder (orbitaldecay)
* Jason Espinosa (hasone)
* HyperHacker
* and others.

Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally written by:
* Hacktarux
* Dave2001
* Zilmar
* Gregor Anich (Blight)
* Juha Luotio (JttL)
* and others.

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.


GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS


Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.


+ 1032
- 0
Frameworks/lazyusf/lazyusf/rsp_hle/alist.c
File diff suppressed because it is too large
View File


+ 174
- 0
Frameworks/lazyusf/lazyusf/rsp_hle/alist.h View File

@@ -0,0 +1,174 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef ALIST_INTERNAL_H
#define ALIST_INTERNAL_H

#include <our-stdbool.h>
#include <stdint.h>
#include <stddef.h>

struct hle_t;

typedef void (*acmd_callback_t)(struct hle_t* hle, uint32_t w1, uint32_t w2);

#ifdef DEBUG_INFO
void alist_process(struct hle_t* hle, const acmd_callback_t abi[], unsigned int abi_size, const char* abi_names[]);
#else
void alist_process(struct hle_t* hle, const acmd_callback_t abi[], unsigned int abi_size);
#endif
uint32_t alist_get_address(struct hle_t* hle, uint32_t so, const uint32_t *segments, size_t n);
void alist_set_address(struct hle_t* hle, uint32_t so, uint32_t *segments, size_t n);
void alist_clear(struct hle_t* hle, uint16_t dmem, uint16_t count);
void alist_load(struct hle_t* hle, uint16_t dmem, uint32_t address, uint16_t count);
void alist_save(struct hle_t* hle, uint16_t dmem, uint32_t address, uint16_t count);
void alist_move(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count);
void alist_copy_every_other_sample(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count);
void alist_repeat64(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint8_t count);
void alist_copy_blocks(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t block_size, uint8_t count);
void alist_interleave(struct hle_t* hle, uint16_t dmemo, uint16_t left, uint16_t right, uint16_t count);

void alist_envmix_exp(
struct hle_t* hle,
bool init,
bool aux,
uint16_t dmem_dl, uint16_t dmem_dr,
uint16_t dmem_wl, uint16_t dmem_wr,
uint16_t dmemi, uint16_t count,
int16_t dry, int16_t wet,
const int16_t *vol,
const int16_t *target,
const int32_t *rate,
uint32_t address);

void alist_envmix_ge(
struct hle_t* hle,
bool init,
bool aux,
uint16_t dmem_dl, uint16_t dmem_dr,
uint16_t dmem_wl, uint16_t dmem_wr,
uint16_t dmemi, uint16_t count,
int16_t dry, int16_t wet,
const int16_t *vol,
const int16_t *target,
const int32_t *rate,
uint32_t address);

void alist_envmix_lin(
struct hle_t* hle,
bool init,
uint16_t dmem_dl, uint16_t dmem_dr,
uint16_t dmem_wl, uint16_t dmem_wr,
uint16_t dmemi, uint16_t count,
int16_t dry, int16_t wet,
const int16_t *vol,
const int16_t *target,
const int32_t *rate,
uint32_t address);

void alist_envmix_nead(
struct hle_t* hle,
bool swap_wet_LR,
uint16_t dmem_dl,
uint16_t dmem_dr,
uint16_t dmem_wl,
uint16_t dmem_wr,
uint16_t dmemi,
unsigned count,
uint16_t *env_values,
uint16_t *env_steps,
const int16_t *xors);

void alist_mix(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count, int16_t gain);
void alist_multQ44(struct hle_t* hle, uint16_t dmem, uint16_t count, int8_t gain);
void alist_add(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count);

void alist_adpcm(
struct hle_t* hle,
bool init,
bool loop,
bool two_bit_per_sample,
uint16_t dmemo,
uint16_t dmemi,
uint16_t count,
const int16_t* codebook,
uint32_t loop_address,
uint32_t last_frame_address);

void alist_resample(
struct hle_t* hle,
bool init,
bool flag2,
uint16_t dmemo, uint16_t dmemi, uint16_t count,
uint32_t pitch, uint32_t address);

void alist_resample_zoh(
struct hle_t* hle,
uint16_t dmemo,
uint16_t dmemi,
uint16_t count,
uint32_t pitch,
uint32_t pitch_accu);

void alist_filter(
struct hle_t* hle,
uint16_t dmem,
uint16_t count,
uint32_t address,
const uint32_t* lut_address);

void alist_polef(
struct hle_t* hle,
bool init,
uint16_t dmemo,
uint16_t dmemi,
uint16_t count,
uint16_t gain,
int16_t* table,
uint32_t address);

void alist_iirf(
struct hle_t* hle,
bool init,
uint16_t dmemo,
uint16_t dmemi,
uint16_t count,
int16_t* table,
uint32_t address);

/*
* Audio flags
*/

#define A_INIT 0x01
#define A_CONTINUE 0x00
#define A_LOOP 0x02
#define A_OUT 0x02
#define A_LEFT 0x02
#define A_RIGHT 0x00
#define A_VOL 0x04
#define A_RATE 0x00
#define A_AUX 0x08
#define A_NOAUX 0x00
#define A_MAIN 0x00
#define A_MIX 0x10

#endif

+ 346
- 0
Frameworks/lazyusf/lazyusf/rsp_hle/alist_audio.c View File

@@ -0,0 +1,346 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist_audio.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include <stdbool.h>
#include <stdint.h>
#include <string.h>

#include "alist.h"
#include "common.h"
#include "hle_internal.h"
#include "memory.h"
#include "ucodes.h"

enum { DMEM_BASE = 0x5c0 };

/* helper functions */
static uint32_t get_address(struct hle_t* hle, uint32_t so)
{
return alist_get_address(hle, so, hle->alist_audio.segments, N_SEGMENTS);
}

static void set_address(struct hle_t* hle, uint32_t so)
{
alist_set_address(hle, so, hle->alist_audio.segments, N_SEGMENTS);
}

static void clear_segments(struct hle_t* hle)
{
memset(hle->alist_audio.segments, 0, N_SEGMENTS*sizeof(hle->alist_audio.segments[0]));
}

/* audio commands definition */
static void SPNOOP(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUSED(w2))
{
}

static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint16_t dmem = w1 + DMEM_BASE;
uint16_t count = w2;

if (count == 0)
return;

alist_clear(hle, dmem, align(count, 16));
}

static void ENVMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint8_t flags = (w1 >> 16);
uint32_t address = get_address(hle, w2);

alist_envmix_exp(
hle,
flags & A_INIT,
flags & A_AUX,
hle->alist_audio.out, hle->alist_audio.dry_right,
hle->alist_audio.wet_left, hle->alist_audio.wet_right,
hle->alist_audio.in, hle->alist_audio.count,
hle->alist_audio.dry, hle->alist_audio.wet,
hle->alist_audio.vol,
hle->alist_audio.target,
hle->alist_audio.rate,
address);
}

static void ENVMIXER_GE(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint8_t flags = (w1 >> 16);
uint32_t address = get_address(hle, w2);

alist_envmix_ge(
hle,
flags & A_INIT,
flags & A_AUX,
hle->alist_audio.out, hle->alist_audio.dry_right,
hle->alist_audio.wet_left, hle->alist_audio.wet_right,
hle->alist_audio.in, hle->alist_audio.count,
hle->alist_audio.dry, hle->alist_audio.wet,
hle->alist_audio.vol,
hle->alist_audio.target,
hle->alist_audio.rate,
address);
}

static void RESAMPLE(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint8_t flags = (w1 >> 16);
uint16_t pitch = w1;
uint32_t address = get_address(hle, w2);

alist_resample(
hle,
flags & 0x1,
flags & 0x2,
hle->alist_audio.out,
hle->alist_audio.in,
align(hle->alist_audio.count, 16),
pitch << 1,
address);
}

static void SETVOL(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint8_t flags = (w1 >> 16);

if (flags & A_AUX) {
hle->alist_audio.dry = w1;
hle->alist_audio.wet = w2;
}
else {
unsigned lr = (flags & A_LEFT) ? 0 : 1;

if (flags & A_VOL)
hle->alist_audio.vol[lr] = w1;
else {
hle->alist_audio.target[lr] = w1;
hle->alist_audio.rate[lr] = w2;
}
}
}

static void SETLOOP(struct hle_t* hle, uint32_t UNUSED(w1), uint32_t w2)
{
hle->alist_audio.loop = get_address(hle, w2);
}