Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions Classes/Audio/OESndOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ static __forceinline s32 MulShr32(s32 srcval, s32 mulval)
return (s64)srcval * mulval >> 32;
}

__forceinline s32 clamp_mix(s32 x)
{
return std::clamp(x, -0x8000, 0x7fff);
}

__forceinline StereoOut32 clamp_mix(StereoOut32 sample)
{
return StereoOut32(clamp_mix(sample.Left), clamp_mix(sample.Right));
}

static void __forceinline XA_decode_block(s16* buffer, const s16* block, s32& prev1, s32& prev2)
{
const s32 header = *block;
Expand Down Expand Up @@ -115,7 +105,7 @@ static void __forceinline IncrementNextA(V_Core& thiscore, uint voiceidx)
// decoded pcm data, used to cache the decoded data so that it needn't be decoded
// multiple times. Cache chunks are decoded when the mixer requests the blocks, and
// invalided when DMA transfers and memory writes are performed.
PcmCacheEntry* pcm_cache_data = nullptr;
PcmCacheEntry pcm_cache_data[pcm_BlockCount];

int g_counter_cache_hits = 0;
int g_counter_cache_misses = 0;
Expand Down Expand Up @@ -331,7 +321,7 @@ static __forceinline void CalculateADSR(V_Core& thiscore, uint voiceidx)
return;
}

if (!vc.ADSR.Calculate())
if (!vc.ADSR.Calculate(voiceidx))
{
if (IsDevBuild)
{
Expand All @@ -347,10 +337,10 @@ static __forceinline void CalculateADSR(V_Core& thiscore, uint voiceidx)
__forceinline static s32 GaussianInterpolate(s32 pv4, s32 pv3, s32 pv2, s32 pv1, s32 i)
{
s32 out = 0;
out = (interpTable[0x0FF - i] * pv4) >> 15;
out += (interpTable[0x1FF - i] * pv3) >> 15;
out += (interpTable[0x100 + i] * pv2) >> 15;
out += (interpTable[0x000 + i] * pv1) >> 15;
out = (interpTable[i][0] * pv4) >> 15;
out += (interpTable[i][1] * pv3) >> 15;
out += (interpTable[i][2] * pv2) >> 15;
out += (interpTable[i][3] * pv1) >> 15;

return out;
}
Expand Down Expand Up @@ -578,14 +568,6 @@ StereoOut32 V_Core::Mix(const VoiceMixSet& inVoices, const StereoOut32& Input, c
//
// On the other hand, updating the buffer is cheap and easy, so might as well. ;)

Reverb_AdvanceBuffer(); // Updates the reverb work area as well, if needed.

// ToDo:
// Bad EndA causes memory corruption. Bad for us, unknown on PS2!
// According to no$psx, effects always run but don't always write back, so the FxEnable check may be wrong
if (!FxEnable || EffectsEndA >= 0x100000)
return TD;

StereoOut32 TW;

// Mix Input, Voice, and External data:
Expand Down Expand Up @@ -689,6 +671,7 @@ __forceinline
// output by design.
// Good thing though that this code gets the volume exactly right, as per tests :)
Out = clamp_mix(Out);
SndBuffer::Write(StereoOut16(Out));

Host::WriteToSoundBuffer(StereoOut16(Out));

Expand Down
52 changes: 45 additions & 7 deletions Classes/Video/OEHostDisplay.h → Classes/DiscordStubs.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022, OpenEmu Team
// Copyright (c) 2024, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
Expand All @@ -22,13 +22,51 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#ifndef OEHostDisplay_h
#define OEHostDisplay_h
#include "discord_rpc.h"

namespace Host {
int PresentFrameBuffer();
} // namespace Host
void Discord_Initialize(const char* applicationId,
DiscordEventHandlers* handlers,
int autoRegister,
const char* optionalSteamId)
{

}

void Discord_Shutdown(void)
{

}

/* checks for incoming messages, dispatches callbacks */
void Discord_RunCallbacks(void)
{

}

#endif /* OEHostDisplay_h */
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
#ifdef DISCORD_DISABLE_IO_THREAD
void Discord_UpdateConnection(void)
{

}
#endif

void Discord_UpdatePresence(const DiscordRichPresence* presence)
{

}

void Discord_ClearPresence(void)
{

}

void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply)
{

}

void Discord_UpdateHandlers(DiscordEventHandlers* handlers)
{

}
54 changes: 27 additions & 27 deletions Classes/Input/keymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,38 @@
#ifndef keymap_h
#define keymap_h

#include "PAD/Host/Global.h"
#include "SIO/Pad/PadDualshock2.h"

typedef struct
{
gamePadValues ps2key;
PadDualshock2::Inputs ps2key;
}keymap;

keymap ps2keymap[25]={
{PAD_UP}, // OEPS2ButtonUp,
{PAD_DOWN}, // OEPS2ButtonDown,
{PAD_LEFT}, // OEPS2ButtonLeft,
{PAD_RIGHT}, // OEPS2ButtonRight,
{PAD_TRIANGLE}, // OEPS2ButtonTriangle,
{PAD_CIRCLE}, // OEPS2ButtonCircle,
{PAD_CROSS}, // OEPS2ButtonCross,
{PAD_SQUARE}, // OEPS2ButtonSquare,
{PAD_L1}, // OEPS2ButtonL1,
{PAD_L2}, // OEPS2ButtonL2,
{PAD_L3}, // OEPS2ButtonL3,
{PAD_R1}, // OEPS2ButtonR1,
{PAD_R2}, // OEPS2ButtonR2,
{PAD_R3}, // OEPS2ButtonR3,
{PAD_START}, // OEPS2ButtonStart,
{PAD_SELECT}, // OEPS2ButtonSelect,
{}, // OEPS2ButtonAnalogMode,
{PAD_L_UP}, // OEPS2LeftAnalogUp,
{PAD_L_DOWN}, // OEPS2LeftAnalogDown,
{PAD_L_LEFT}, // OEPS2LeftAnalogLeft,
{PAD_L_RIGHT}, // OEPS2LeftAnalogRight,
{PAD_R_UP}, // OEPS2RightAnalogUp,
{PAD_R_DOWN}, // OEPS2RightAnalogDown,
{PAD_R_LEFT}, // OEPS2RightAnalogLeft,
{PAD_R_RIGHT}, // OEPS2RightAnalogRight
{PadDualshock2::PAD_UP}, // OEPS2ButtonUp,
{PadDualshock2::PAD_DOWN}, // OEPS2ButtonDown,
{PadDualshock2::PAD_LEFT}, // OEPS2ButtonLeft,
{PadDualshock2::PAD_RIGHT}, // OEPS2ButtonRight,
{PadDualshock2::PAD_TRIANGLE}, // OEPS2ButtonTriangle,
{PadDualshock2::PAD_CIRCLE}, // OEPS2ButtonCircle,
{PadDualshock2::PAD_CROSS}, // OEPS2ButtonCross,
{PadDualshock2::PAD_SQUARE}, // OEPS2ButtonSquare,
{PadDualshock2::PAD_L1}, // OEPS2ButtonL1,
{PadDualshock2::PAD_L2}, // OEPS2ButtonL2,
{PadDualshock2::PAD_L3}, // OEPS2ButtonL3,
{PadDualshock2::PAD_R1}, // OEPS2ButtonR1,
{PadDualshock2::PAD_R2}, // OEPS2ButtonR2,
{PadDualshock2::PAD_R3}, // OEPS2ButtonR3,
{PadDualshock2::PAD_START}, // OEPS2ButtonStart,
{PadDualshock2::PAD_SELECT}, // OEPS2ButtonSelect,
{PadDualshock2::PAD_ANALOG}, // OEPS2ButtonAnalogMode,
{PadDualshock2::PAD_L_UP}, // OEPS2LeftAnalogUp,
{PadDualshock2::PAD_L_DOWN}, // OEPS2LeftAnalogDown,
{PadDualshock2::PAD_L_LEFT}, // OEPS2LeftAnalogLeft,
{PadDualshock2::PAD_L_RIGHT}, // OEPS2LeftAnalogRight,
{PadDualshock2::PAD_R_UP}, // OEPS2RightAnalogUp,
{PadDualshock2::PAD_R_DOWN}, // OEPS2RightAnalogDown,
{PadDualshock2::PAD_R_LEFT}, // OEPS2RightAnalogLeft,
{PadDualshock2::PAD_R_RIGHT}, // OEPS2RightAnalogRight
};
#endif /* keymap_h */
Loading