mirror of https://github.com/PCSX2/pcsx2.git
Fix a few Linux things.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1816 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
c1f8444fe1
commit
f72c913c4b
|
@ -19,8 +19,6 @@
|
|||
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --cflags`" />
|
||||
<Add option="-DPCSX2_DEBUG" />
|
||||
<Add option="-DPCSX2_DEVBUILD" />
|
||||
<Add directory="../../include/Utilities" />
|
||||
<Add directory="../../include" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
|
@ -63,15 +61,27 @@
|
|||
<Add option="-march=pentium4" />
|
||||
<Add option="-march=i686" />
|
||||
<Add option="-march=i586" />
|
||||
<Add directory="../../include/Utilities" />
|
||||
<Add directory="../../include" />
|
||||
<Add directory="../../../3rdparty" />
|
||||
</Compiler>
|
||||
<Unit filename="../../../3rdparty/google/dense_hash_map" />
|
||||
<Unit filename="../../../3rdparty/google/dense_hash_set" />
|
||||
<Unit filename="../../../3rdparty/google/sparse_hash_map" />
|
||||
<Unit filename="../../../3rdparty/google/sparse_hash_set" />
|
||||
<Unit filename="../../../3rdparty/google/sparsehash/densehashtable.h" />
|
||||
<Unit filename="../../../3rdparty/google/sparsehash/sparseconfig.h" />
|
||||
<Unit filename="../../../3rdparty/google/sparsehash/sparsehashtable.h" />
|
||||
<Unit filename="../../../3rdparty/google/sparsetable" />
|
||||
<Unit filename="../../../3rdparty/google/type_traits.h" />
|
||||
<Unit filename="../../include/Utilities/Console.h" />
|
||||
<Unit filename="../../include/Utilities/Dependencies.h" />
|
||||
<Unit filename="../../include/Utilities/Exceptions.h" />
|
||||
<Unit filename="../../include/Utilities/General.h" />
|
||||
<Unit filename="../../include/Utilities/HashMap.h" />
|
||||
<Unit filename="../../include/Utilities/MemcpyFast.h" />
|
||||
<Unit filename="../../include/Utilities/Path.h" />
|
||||
<Unit filename="../../include/Utilities/RedtapeWindows.h" />
|
||||
<Unit filename="../../include/Utilities/HashMap.h" />
|
||||
<Unit filename="../../include/Utilities/MemcpyFast.h" />
|
||||
<Unit filename="../../include/Utilities/Path.h" />
|
||||
<Unit filename="../../include/Utilities/RedtapeWindows.h" />
|
||||
<Unit filename="../../include/Utilities/SafeArray.h" />
|
||||
<Unit filename="../../include/Utilities/ScopedPtr.h" />
|
||||
<Unit filename="../../include/Utilities/StringHelpers.h" />
|
||||
|
@ -83,12 +93,12 @@
|
|||
<Unit filename="../../src/Utilities/AlignedMalloc.cpp" />
|
||||
<Unit filename="../../src/Utilities/Console.cpp" />
|
||||
<Unit filename="../../src/Utilities/Exceptions.cpp" />
|
||||
<Unit filename="../../src/Utilities/HashTools.cpp" />
|
||||
<Unit filename="../../src/Utilities/Linux/LnxHostSys.cpp" />
|
||||
<Unit filename="../../src/Utilities/HashTools.cpp" />
|
||||
<Unit filename="../../src/Utilities/Linux/LnxHostSys.cpp" />
|
||||
<Unit filename="../../src/Utilities/Linux/LnxMisc.cpp" />
|
||||
<Unit filename="../../src/Utilities/Linux/LnxThreads.cpp" />
|
||||
<Unit filename="../../src/Utilities/PathUtils.cpp" />
|
||||
<Unit filename="../../src/Utilities/StringHelpers.cpp" />
|
||||
<Unit filename="../../src/Utilities/PathUtils.cpp" />
|
||||
<Unit filename="../../src/Utilities/StringHelpers.cpp" />
|
||||
<Unit filename="../../src/Utilities/ThreadTools.cpp" />
|
||||
<Unit filename="../../src/Utilities/vssprintf.cpp" />
|
||||
<Unit filename="../../src/Utilities/x86/MemcpyFast.S" />
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<Workspace title="pcsx2_suite_2008 workspace">
|
||||
<Project filename="pcsx2/Linux/pcsx2.cbp" active="1">
|
||||
<Depends filename="common/build/x86emitter/x86emitter.cbp" />
|
||||
<Depends filename="common/build/Utilities/Utilities.cbp" />
|
||||
<Depends filename="3rdparty/zlib/zlib.cbp" />
|
||||
<Depends filename="tools/bin2cpp/bin2cpp.cbp" />
|
||||
</Project>
|
||||
<Project filename="pcsx2/Linux/pcsx2.cbp" />
|
||||
<Project filename="common/build/x86emitter/x86emitter.cbp" />
|
||||
<Project filename="common/build/Utilities/Utilities.cbp" />
|
||||
<Project filename="3rdparty/SoundTouch/SoundTouch.cbp" />
|
||||
|
@ -22,6 +17,6 @@
|
|||
<Project filename="plugins/onepad/Linux/OnePad.cbp" />
|
||||
<Project filename="plugins/zerogs/opengl/Linux/ZeroGS.cbp" />
|
||||
<Project filename="tools/bin2cpp/bin2cpp.cbp" />
|
||||
<Project filename="plugins/spu2-x/src/Linux/SPU2-X.cbp" />
|
||||
<Project filename="plugins/spu2-x/src/Linux/SPU2-X.cbp" active="1" />
|
||||
</Workspace>
|
||||
</CodeBlocks_workspace_file>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -16,6 +16,7 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "GS.h"
|
||||
#include <list>
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
void SaveGSState(const wxString& file)
|
||||
|
@ -134,7 +135,7 @@ void RunGSState( gzLoadingState& f )
|
|||
*(u32*)(PS2MEM_GS+0x1000) = (*(u32*)(PS2MEM_GS+0x1000) & ~(1<<13)) | newfield;
|
||||
|
||||
GSvsync(newfield);
|
||||
|
||||
|
||||
// fixme : Process pending app messages here.
|
||||
//SysUpdate();
|
||||
|
||||
|
@ -150,4 +151,4 @@ void RunGSState( gzLoadingState& f )
|
|||
it = packets.begin();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1130,9 +1130,6 @@ void __forceinline finishmpeg2sliceIDEC(decoder_t* &decoder)
|
|||
waitForSCD();
|
||||
}
|
||||
|
||||
// This fixes Mana Khemia if uncommented, but needs testing.
|
||||
// Breaks Figital Devil Saga.
|
||||
//#define ALWAYS_RESUME_BEFORE_EXITING
|
||||
void mpeg2sliceIDEC(void* pdone)
|
||||
{
|
||||
u32 read;
|
||||
|
|
|
@ -164,9 +164,9 @@
|
|||
<Unit filename="../FPU.cpp" />
|
||||
<Unit filename="../FiFo.cpp" />
|
||||
<Unit filename="../GS.cpp" />
|
||||
<Unit filename="../GS.h" />
|
||||
<Unit filename="../GSstate.cpp" />
|
||||
<Unit filename="../Gif.cpp" />
|
||||
<Unit filename="../GS.h" />
|
||||
<Unit filename="../GSState.cpp" />
|
||||
<Unit filename="../Gif.cpp" />
|
||||
<Unit filename="../HostGui.h" />
|
||||
<Unit filename="../Hw.cpp" />
|
||||
<Unit filename="../Hw.h" />
|
||||
|
@ -268,8 +268,8 @@
|
|||
<Unit filename="../gui/AppAssert.cpp" />
|
||||
<Unit filename="../gui/AppConfig.cpp" />
|
||||
<Unit filename="../gui/AppConfig.h" />
|
||||
<Unit filename="../gui/AppMain.cpp" />
|
||||
<Unit filename="../gui/AppRes.cpp" />
|
||||
<Unit filename="../gui/AppMain.cpp" />
|
||||
<Unit filename="../gui/AppRes.cpp" />
|
||||
<Unit filename="../gui/CheckedStaticBox.cpp" />
|
||||
<Unit filename="../gui/CheckedStaticBox.h" />
|
||||
<Unit filename="../gui/ConsoleLogger.cpp" />
|
||||
|
|
|
@ -14,17 +14,19 @@
|
|||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
void SaveConf();
|
||||
void LoadConf();
|
||||
extern void SaveConf();
|
||||
extern void LoadConf();
|
||||
extern string s_strIniPath;
|
||||
extern GtkWidget *MsgDlg;
|
||||
exter void OnMsg_Ok();
|
||||
|
||||
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
|
||||
* Developed and maintained by the Pcsx2 Development Team.
|
||||
*
|
||||
*
|
||||
* Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
|
||||
*
|
||||
* SPU2-X is free software: you can redistribute it and/or modify it under the terms
|
||||
|
@ -34,7 +34,7 @@ protected:
|
|||
snd_pcm_t *handle;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_async_handler_t *pcm_callback;
|
||||
|
||||
|
||||
uint period_time;
|
||||
uint buffer_time;
|
||||
|
||||
|
@ -70,7 +70,7 @@ protected:
|
|||
|
||||
// Not sure if we just need an assert, or something like this:
|
||||
//if( data->handle != snd_async_handler_get_pcm(pcm_callback) ) return;
|
||||
|
||||
|
||||
data->_InternalCallback();
|
||||
}
|
||||
|
||||
|
@ -87,60 +87,60 @@ public:
|
|||
handle = NULL;
|
||||
pcm_callback = NULL;
|
||||
pspeed = SAMPLE_RATE;
|
||||
|
||||
|
||||
// buffer time and period time are in microseconds...
|
||||
// (don't simplify the equation below -- it'll just cause integer rounding errors.
|
||||
period_time = (SndOutPacketSize*1000) / (SampleRate / 1000);
|
||||
buffer_time = period_time * NumBuffers;
|
||||
|
||||
int err;
|
||||
|
||||
|
||||
err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
ERROR_LOG("Audio open error: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_nonblock(handle, 0);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
ERROR_LOG("Can't set blocking mode: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
snd_pcm_hw_params_alloca(&hwparams);
|
||||
snd_pcm_sw_params_alloca(&swparams);
|
||||
|
||||
|
||||
err = snd_pcm_hw_params_any(handle, hwparams);
|
||||
if (err < 0)
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Broken configuration for this PCM: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
|
||||
if (err < 0)
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Access type not available: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = snd_pcm_hw_params_set_format(handle, hwparams, format);
|
||||
if (err < 0)
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Sample format not available: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_hw_params_set_channels(handle, hwparams, pchannels);
|
||||
if (err < 0)
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Channels count not available: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0);
|
||||
if (err < 0)
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Rate not available: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
|
@ -151,31 +151,31 @@ public:
|
|||
ERROR_LOG("Buffer time error: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Period time error: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_hw_params(handle, hwparams);
|
||||
if (err < 0)
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG("Unable to install hw params: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
snd_pcm_status_alloca(&status);
|
||||
err = snd_pcm_status(handle, status);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
ERROR_LOG("Unable to get status: %s\n", snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Bind our asynchronous callback magic:
|
||||
|
||||
|
||||
snd_async_add_pcm_handler( &pcm_callback, handle, ExternalCallback, this );
|
||||
|
||||
snd_pcm_start( handle );
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
}
|
||||
|
||||
virtual bool Is51Out() const { return false; }
|
||||
|
||||
|
||||
s32 Test() const
|
||||
{
|
||||
return 0;
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
if(handle == NULL) return 0;
|
||||
|
||||
// Returns the amount of free buffer space, in samples.
|
||||
uint l = snd_pcm_avail_update(handle);
|
||||
uint l = snd_pcm_avail_update(handle);
|
||||
if( l < 0 ) return 0;
|
||||
return (l / 1000) * (SampleRate / 1000);
|
||||
}
|
||||
|
@ -234,4 +234,4 @@ public:
|
|||
}
|
||||
} static Alsa;
|
||||
|
||||
SndOutModule *AlsaOut = &Alsa;
|
||||
SndOutModule *AlsaOut = &Alsa;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
|
||||
* Developed and maintained by the Pcsx2 Development Team.
|
||||
*
|
||||
*
|
||||
* Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
|
||||
*
|
||||
* SPU2-X is free software: you can redistribute it and/or modify it under the terms
|
||||
|
@ -97,8 +97,12 @@ void WriteSettings()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void configure()
|
||||
{
|
||||
ReadSettings();
|
||||
}
|
||||
|
||||
void SysMessage(char const*, ...)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/SPU2-X" prefix_auto="1" extension_auto="1" />
|
||||
<Option output="../../../../bin/plugins/SPU2-X.so" prefix_auto="0" extension_auto="0" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
|
@ -17,9 +17,9 @@
|
|||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/SPU2-X" prefix_auto="1" extension_auto="1" />
|
||||
<Option output="../../../../bin/plugins/SPU2-X.so" prefix_auto="0" extension_auto="0" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
|
@ -35,17 +35,43 @@
|
|||
<Add option="`pkg-config gtk+-2.0 --cflags`" />
|
||||
<Add option="-fPIC" />
|
||||
<Add option="-m32" />
|
||||
<Add option="-liconv" />
|
||||
<Add option="-msse2" />
|
||||
<Add directory="../Linux" />
|
||||
<Add directory="../../src" />
|
||||
<Add directory="../3rdparty" />
|
||||
<Add directory="../3rdparty/liba52" />
|
||||
<Add directory="../../../../common/include" />
|
||||
<Add directory="../../../../3rdparty/SoundTouch" />
|
||||
<Add directory="../../../../3rdparty" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="`pkg-config gtk+-2.0 --libs`" />
|
||||
<Add option="-shared" />
|
||||
<Add library="asound" />
|
||||
<Add library="stdc++" />
|
||||
</Linker>
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/AAFilter.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/AAFilter.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/BPMDetect.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/FIFOSampleBuffer.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/FIFOSampleBuffer.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/FIFOSamplePipe.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/FIRFilter.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/FIRFilter.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/RateTransposer.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/RateTransposer.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/STTypes.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/SoundTouch.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/SoundTouch.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/TDStretch.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/TDStretch.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/WavFile.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/WavFile.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/cpu_detect.h" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/mmx_optimized.cpp" />
|
||||
<Unit filename="../../../../3rdparty/SoundTouch/sse_optimized.cpp" />
|
||||
<Unit filename="../3rdparty/liba52/a52.h" />
|
||||
<Unit filename="../3rdparty/liba52/a52_internal.h" />
|
||||
<Unit filename="../3rdparty/liba52/attributes.h" />
|
||||
|
@ -89,7 +115,6 @@
|
|||
<Unit filename="ConfigSoundTouch.cpp" />
|
||||
<Unit filename="Dialogs.cpp" />
|
||||
<Unit filename="Dialogs.h" />
|
||||
<Unit filename="Linux.cpp" />
|
||||
<Unit filename="Linux.h" />
|
||||
<Unit filename="../Lowpass.cpp" />
|
||||
<Unit filename="../Lowpass.h" />
|
||||
|
@ -109,6 +134,7 @@
|
|||
<Unit filename="../Timestretcher.cpp" />
|
||||
<Unit filename="../Wavedump_wav.cpp" />
|
||||
<Unit filename="../defs.h" />
|
||||
<Unit filename="../iconvert.cpp" />
|
||||
<Unit filename="../regs.h" />
|
||||
<Unit filename="../spdif.h" />
|
||||
<Unit filename="../utf8.cpp" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
|
||||
* Developed and maintained by the Pcsx2 Development Team.
|
||||
*
|
||||
*
|
||||
* Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
|
||||
*
|
||||
* SPU2-X is free software: you can redistribute it and/or modify it under the terms
|
||||
|
@ -67,8 +67,7 @@ void SetIrqCall()
|
|||
has_to_call_irq=true;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
void SysMessage(const char *fmt, ...)
|
||||
void SysMessage(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char tmp[512];
|
||||
|
@ -80,9 +79,6 @@ void SysMessage(const char *fmt, ...)
|
|||
swprintf_s(wtmp, L"%S", tmp);
|
||||
MessageBox(0, wtmp, L"SPU2-X System Message", 0);
|
||||
}
|
||||
#else
|
||||
extern void SysMessage(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
__forceinline s16 * __fastcall GetMemPtr(u32 addr)
|
||||
{
|
||||
|
@ -135,9 +131,9 @@ V_Core::V_Core()
|
|||
void V_Core::Reset()
|
||||
{
|
||||
memset( this, 0, sizeof(V_Core) );
|
||||
|
||||
|
||||
const int c = (this == Cores) ? 0 : 1;
|
||||
|
||||
|
||||
Regs.STATX=0;
|
||||
Regs.ATTR=0;
|
||||
ExtVol = V_VolumeLR::Max;
|
||||
|
@ -158,7 +154,7 @@ void V_Core::Reset()
|
|||
DryGate.SndR = -1;
|
||||
WetGate.SndL = -1;
|
||||
WetGate.SndR = -1;
|
||||
|
||||
|
||||
Regs.MMIX = 0xFFCF;
|
||||
Regs.VMIXL = 0xFFFFFF;
|
||||
Regs.VMIXR = 0xFFFFFF;
|
||||
|
@ -169,16 +165,16 @@ void V_Core::Reset()
|
|||
FxEnable=0;
|
||||
IRQA=0xFFFF0;
|
||||
IRQEnable=1;
|
||||
|
||||
|
||||
for( uint v=0; v<NumVoices; ++v )
|
||||
{
|
||||
VoiceGates[v].DryL = -1;
|
||||
VoiceGates[v].DryR = -1;
|
||||
VoiceGates[v].WetL = -1;
|
||||
VoiceGates[v].WetR = -1;
|
||||
|
||||
|
||||
Voices[v].Volume = V_VolumeSlideLR::Max;
|
||||
|
||||
|
||||
Voices[v].ADSR.Value = 0;
|
||||
Voices[v].ADSR.Phase = 0;
|
||||
Voices[v].Pitch = 0x3FFF;
|
||||
|
@ -188,7 +184,7 @@ void V_Core::Reset()
|
|||
}
|
||||
DMAICounter = 0;
|
||||
AdmaInProgress = 0;
|
||||
|
||||
|
||||
Regs.STATX = 0x80;
|
||||
}
|
||||
|
||||
|
@ -208,7 +204,7 @@ s32 V_Core::EffectsBufferIndexer( s32 offset ) const
|
|||
pos = EffectsEndA+1 - (offset % EffectsBufferSize );
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
void V_Core::UpdateFeedbackBuffersA()
|
||||
{
|
||||
|
@ -226,7 +222,7 @@ void V_Core::UpdateEffectsBufferSize()
|
|||
{
|
||||
const s32 newbufsize = EffectsEndA - EffectsStartA + 1;
|
||||
if( !RevBuffers.NeedsUpdated && newbufsize == EffectsBufferSize ) return;
|
||||
|
||||
|
||||
RevBuffers.NeedsUpdated = false;
|
||||
EffectsBufferSize = newbufsize;
|
||||
|
||||
|
@ -245,17 +241,17 @@ void V_Core::UpdateEffectsBufferSize()
|
|||
|
||||
UpdateFeedbackBuffersA();
|
||||
UpdateFeedbackBuffersB();
|
||||
|
||||
|
||||
RevBuffers.IIR_DEST_A0 = EffectsBufferIndexer( Revb.IIR_DEST_A0 );
|
||||
RevBuffers.IIR_DEST_A1 = EffectsBufferIndexer( Revb.IIR_DEST_A1 );
|
||||
RevBuffers.IIR_DEST_B0 = EffectsBufferIndexer( Revb.IIR_DEST_B0 );
|
||||
RevBuffers.IIR_DEST_B1 = EffectsBufferIndexer( Revb.IIR_DEST_B1 );
|
||||
|
||||
|
||||
RevBuffers.IIR_SRC_A0 = EffectsBufferIndexer( Revb.IIR_SRC_A0 );
|
||||
RevBuffers.IIR_SRC_A1 = EffectsBufferIndexer( Revb.IIR_SRC_A1 );
|
||||
RevBuffers.IIR_SRC_B0 = EffectsBufferIndexer( Revb.IIR_SRC_B0 );
|
||||
RevBuffers.IIR_SRC_B1 = EffectsBufferIndexer( Revb.IIR_SRC_B1 );
|
||||
|
||||
|
||||
RevBuffers.MIX_DEST_A0 = EffectsBufferIndexer( Revb.MIX_DEST_A0 );
|
||||
RevBuffers.MIX_DEST_A1 = EffectsBufferIndexer( Revb.MIX_DEST_A1 );
|
||||
RevBuffers.MIX_DEST_B0 = EffectsBufferIndexer( Revb.MIX_DEST_B0 );
|
||||
|
@ -412,7 +408,7 @@ __forceinline void TimeUpdate(u32 cClocks)
|
|||
}
|
||||
|
||||
//Update DMA4 interrupt delay counter
|
||||
if(Cores[0].DMAICounter>0)
|
||||
if(Cores[0].DMAICounter>0)
|
||||
{
|
||||
Cores[0].DMAICounter-=TickInterval;
|
||||
if(Cores[0].DMAICounter<=0)
|
||||
|
@ -427,7 +423,7 @@ __forceinline void TimeUpdate(u32 cClocks)
|
|||
}
|
||||
|
||||
//Update DMA7 interrupt delay counter
|
||||
if(Cores[1].DMAICounter>0)
|
||||
if(Cores[1].DMAICounter>0)
|
||||
{
|
||||
Cores[1].DMAICounter-=TickInterval;
|
||||
if(Cores[1].DMAICounter<=0)
|
||||
|
@ -506,7 +502,7 @@ void V_VolumeSlide::RegSet( u16 src )
|
|||
Value = GetVol32( src );
|
||||
}
|
||||
|
||||
void SPU_ps1_write(u32 mem, u16 value)
|
||||
void SPU_ps1_write(u32 mem, u16 value)
|
||||
{
|
||||
bool show=true;
|
||||
|
||||
|
@ -530,7 +526,7 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
Cores[0].Voices[voice].Volume.Right.RegSet( value << 1 );
|
||||
Cores[0].Voices[voice].Volume.Right.Reg_VOL = value;
|
||||
break;
|
||||
|
||||
|
||||
case 2: Cores[0].Voices[voice].Pitch = value; break;
|
||||
case 3: Cores[0].Voices[voice].StartA = (u32)value<<8; break;
|
||||
|
||||
|
@ -549,7 +545,7 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
Cores[0].Voices[voice].ADSR.ReleaseRate = (value & 0x1F);
|
||||
Cores[0].Voices[voice].ADSR.Reg_ADSR2 = value;
|
||||
break;
|
||||
|
||||
|
||||
case 6:
|
||||
Cores[0].Voices[voice].ADSR.Value = ((s32)value<<16) | value;
|
||||
ConLog( "* SPU2: Mysterious ADSR Volume Set to 0x%x", value );
|
||||
|
@ -598,7 +594,7 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
case 0x1d90:// Channel FM (pitch lfo) mode (0-15)
|
||||
SPU2_FastWrite(REG_S_PMON,value);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1d92:// Channel FM (pitch lfo) mode (16-23)
|
||||
SPU2_FastWrite(REG_S_PMON+2,value);
|
||||
break;
|
||||
|
@ -607,7 +603,7 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
case 0x1d94:// Channel Noise mode (0-15)
|
||||
SPU2_FastWrite(REG_S_NON,value);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1d96:// Channel Noise mode (16-23)
|
||||
SPU2_FastWrite(REG_S_NON+2,value);
|
||||
break;
|
||||
|
@ -616,17 +612,17 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
SPU2_FastWrite(REG_S_VMIXEL,value);
|
||||
SPU2_FastWrite(REG_S_VMIXER,value);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1d9a:// Channel Reverb mode (16-23)
|
||||
SPU2_FastWrite(REG_S_VMIXEL+2,value);
|
||||
SPU2_FastWrite(REG_S_VMIXER+2,value);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1d9c:// Channel Reverb mode (0-15)
|
||||
SPU2_FastWrite(REG_S_VMIXL,value);
|
||||
SPU2_FastWrite(REG_S_VMIXR,value);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1d9e:// Channel Reverb mode (16-23)
|
||||
SPU2_FastWrite(REG_S_VMIXL+2,value);
|
||||
SPU2_FastWrite(REG_S_VMIXR+2,value);
|
||||
|
@ -640,7 +636,7 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
SPU2_FastWrite(REG_A_ESA+2,val>>16);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 0x1da4:
|
||||
Cores[0].IRQA=(u32)value<<8;
|
||||
break;
|
||||
|
@ -668,7 +664,7 @@ void SPU_ps1_write(u32 mem, u16 value)
|
|||
spu2Ru16(mem)=value;
|
||||
}
|
||||
|
||||
u16 SPU_ps1_read(u32 mem)
|
||||
u16 SPU_ps1_read(u32 mem)
|
||||
{
|
||||
bool show=true;
|
||||
u16 value = spu2Ru16(mem);
|
||||
|
@ -687,13 +683,13 @@ u16 SPU_ps1_read(u32 mem)
|
|||
//value=Cores[0].Voices[voice].VolumeL.Value;
|
||||
value = Cores[0].Voices[voice].Volume.Left.Reg_VOL;
|
||||
break;
|
||||
|
||||
|
||||
case 1: //VOLR (Volume R)
|
||||
//value=Cores[0].Voices[voice].VolumeR.Mode;
|
||||
//value=Cores[0].Voices[voice].VolumeR.Value;
|
||||
value = Cores[0].Voices[voice].Volume.Right.Reg_VOL;
|
||||
break;
|
||||
|
||||
|
||||
case 2: value = Cores[0].Voices[voice].Pitch; break;
|
||||
case 3: value = Cores[0].Voices[voice].StartA; break;
|
||||
case 4: value = Cores[0].Voices[voice].ADSR.Reg_ADSR1; break;
|
||||
|
@ -802,13 +798,13 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
if (mem & 0x400) { omem^=0x400; core=1; }
|
||||
|
||||
if (omem < 0x0180) // Voice Params
|
||||
{
|
||||
{
|
||||
const u32 voice = (omem & 0x1F0) >> 4;
|
||||
const u32 param = (omem & 0xF) >> 1;
|
||||
V_Voice& thisvoice = Cores[core].Voices[voice];
|
||||
|
||||
switch (param)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case 0: //VOLL (Volume L)
|
||||
case 1: //VOLR (Volume R)
|
||||
{
|
||||
|
@ -852,7 +848,7 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
thisvoice.ADSR.Value = (value << 16) | value;
|
||||
ConLog( "* SPU2: Mysterious ADSR Volume Set to 0x%x", value );
|
||||
break;
|
||||
|
||||
|
||||
case 6: thisvoice.Volume.Left.RegSet( value ); break;
|
||||
case 7: thisvoice.Volume.Right.RegSet( value ); break;
|
||||
|
||||
|
@ -868,22 +864,22 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
switch (address)
|
||||
{
|
||||
case 0: // SSA (Waveform Start Addr) (hiword, 4 bits only)
|
||||
thisvoice.StartA = ((value & 0x0F) << 16) | (thisvoice.StartA & 0xFFF8);
|
||||
thisvoice.StartA = ((value & 0x0F) << 16) | (thisvoice.StartA & 0xFFF8);
|
||||
if( IsDevBuild )
|
||||
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
||||
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
||||
break;
|
||||
|
||||
|
||||
case 1: // SSA (loword)
|
||||
thisvoice.StartA = (thisvoice.StartA & 0x0F0000) | (value & 0xFFF8);
|
||||
thisvoice.StartA = (thisvoice.StartA & 0x0F0000) | (value & 0xFFF8);
|
||||
if( IsDevBuild )
|
||||
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
||||
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
case 2:
|
||||
thisvoice.LoopStartA = ((value & 0x0F) << 16) | (thisvoice.LoopStartA & 0xFFF8);
|
||||
thisvoice.LoopMode = 3;
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
thisvoice.LoopStartA = (thisvoice.LoopStartA & 0x0F0000) | (value & 0xFFF8);
|
||||
thisvoice.LoopMode = 3;
|
||||
|
@ -892,13 +888,13 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
case 4:
|
||||
thisvoice.NextA = ((value & 0x0F) << 16) | (thisvoice.NextA & 0xFFF8);
|
||||
break;
|
||||
|
||||
|
||||
case 5:
|
||||
thisvoice.NextA = (thisvoice.NextA & 0x0F0000) | (value & 0xFFF8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if((mem>=0x07C0) && (mem<0x07CE))
|
||||
else if((mem>=0x07C0) && (mem<0x07CE))
|
||||
{
|
||||
*(regtable[mem>>1]) = value;
|
||||
UpdateSpdifMode();
|
||||
|
@ -1040,10 +1036,10 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
break;
|
||||
|
||||
case REG_P_MMIX:
|
||||
|
||||
|
||||
// Each MMIX gate is assigned either 0 or 0xffffffff depending on the status
|
||||
// of the MMIX bits. I use -1 below as a shorthand for 0xffffffff. :)
|
||||
|
||||
|
||||
vx = value;
|
||||
if (core == 0) vx&=0xFF0;
|
||||
thiscore.WetGate.ExtR = (vx & 0x001) ? -1 : 0;
|
||||
|
@ -1081,7 +1077,7 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
thiscore.Regs.ENDX&=0x00FF0000;
|
||||
break;
|
||||
|
||||
case (REG_S_ENDX + 2):
|
||||
case (REG_S_ENDX + 2):
|
||||
thiscore.Regs.ENDX&=0xFFFF;
|
||||
break;
|
||||
|
||||
|
@ -1109,16 +1105,16 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
thiscore.UpdateEffectsBufferSize();
|
||||
thiscore.ReverbX = 0;
|
||||
break;
|
||||
|
||||
|
||||
// Master Volume Address Write!
|
||||
|
||||
|
||||
case REG_P_MVOLL:
|
||||
case REG_P_MVOLR:
|
||||
{
|
||||
V_VolumeSlide& thisvol = (omem==REG_P_MVOLL) ? thiscore.MasterVol.Left : thiscore.MasterVol.Right;
|
||||
|
||||
if( value & 0x8000 ) // +Lin/-Lin/+Exp/-Exp
|
||||
{
|
||||
{
|
||||
thisvol.Mode = (value & 0xE000) / 0x2000;
|
||||
thisvol.Increment = (value & 0x7F); // | ((value & 0x800)/0x10);
|
||||
}
|
||||
|
@ -1143,7 +1139,7 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
case REG_P_EVOLR:
|
||||
thiscore.FxVol.Right = GetVol32( value );
|
||||
break;
|
||||
|
||||
|
||||
case REG_P_AVOLL:
|
||||
thiscore.ExtVol.Left = GetVol32( value );
|
||||
break;
|
||||
|
@ -1151,7 +1147,7 @@ __forceinline void SPU2_FastWrite( u32 rmem, u16 value )
|
|||
case REG_P_AVOLR:
|
||||
thiscore.ExtVol.Right = GetVol32( value );
|
||||
break;
|
||||
|
||||
|
||||
case REG_P_BVOLL:
|
||||
thiscore.InpVol.Left = GetVol32( value );
|
||||
break;
|
||||
|
@ -1186,7 +1182,7 @@ void StartVoices(int core, u32 value)
|
|||
if( value == 0 ) return;
|
||||
|
||||
Cores[core].Regs.ENDX &= ~value;
|
||||
|
||||
|
||||
for( u8 vc=0; vc<V_Core::NumVoices; vc++ )
|
||||
{
|
||||
if ((value>>vc) & 1)
|
||||
|
|
|
@ -0,0 +1,261 @@
|
|||
/*
|
||||
* Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
//#ifdef HAVE_ICONV
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <iconv.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Convert data from one encoding to another. Return:
|
||||
*
|
||||
* -2 : memory allocation failed
|
||||
* -1 : unknown encoding
|
||||
* 0 : data was converted exactly
|
||||
* 1 : data was converted inexactly
|
||||
* 2 : data was invalid (but still converted)
|
||||
*
|
||||
* We convert in two steps, via UTF-8, as this is the only
|
||||
* reliable way of distinguishing between invalid input
|
||||
* and valid input which iconv refuses to transliterate.
|
||||
* We convert from UTF-8 twice, because we have no way of
|
||||
* knowing whether the conversion was exact if iconv returns
|
||||
* E2BIG (due to a bug in the specification of iconv).
|
||||
* An alternative approach is to assume that the output of
|
||||
* iconv is never more than 4 times as long as the input,
|
||||
* but I prefer to avoid that assumption if possible.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int iconvert(const char *fromcode, const char *tocode,
|
||||
const char *from, size_t fromlen,
|
||||
char **to, size_t *tolen)
|
||||
{
|
||||
int ret = 0;
|
||||
iconv_t cd1, cd2;
|
||||
char *ib;
|
||||
char *ob;
|
||||
char *utfbuf = 0, *outbuf, *newbuf;
|
||||
size_t utflen, outlen, ibl, obl, k;
|
||||
char tbuf[2048];
|
||||
|
||||
cd1 = iconv_open("UTF-8", fromcode);
|
||||
if (cd1 == (iconv_t)(-1))
|
||||
return -1;
|
||||
|
||||
cd2 = (iconv_t)(-1);
|
||||
/* Don't use strcasecmp() as it's locale-dependent. */
|
||||
if (!strchr("Uu", tocode[0]) ||
|
||||
!strchr("Tt", tocode[1]) ||
|
||||
!strchr("Ff", tocode[2]) ||
|
||||
tocode[3] != '-' ||
|
||||
tocode[4] != '8' ||
|
||||
tocode[5] != '\0')
|
||||
{
|
||||
char *tocode1;
|
||||
|
||||
/*
|
||||
* Try using this non-standard feature of glibc and libiconv.
|
||||
* This is deliberately not a config option as people often
|
||||
* change their iconv library without rebuilding applications.
|
||||
*/
|
||||
tocode1 = (char *)malloc(strlen(tocode) + 11);
|
||||
if (!tocode1)
|
||||
goto fail;
|
||||
|
||||
strcpy(tocode1, tocode);
|
||||
strcat(tocode1, "//TRANSLIT");
|
||||
cd2 = iconv_open(tocode1, "UTF-8");
|
||||
free(tocode1);
|
||||
|
||||
if (cd2 == (iconv_t)(-1))
|
||||
cd2 = iconv_open(tocode, fromcode);
|
||||
|
||||
if (cd2 == (iconv_t)(-1))
|
||||
{
|
||||
iconv_close(cd1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
utflen = 1; /*fromlen * 2 + 1; XXX */
|
||||
utfbuf = (char *)malloc(utflen);
|
||||
if (!utfbuf)
|
||||
goto fail;
|
||||
|
||||
/* Convert to UTF-8 */
|
||||
ib = (char *)from;
|
||||
ibl = fromlen;
|
||||
ob = utfbuf;
|
||||
obl = utflen;
|
||||
for (;;)
|
||||
{
|
||||
k = iconv(cd1, &ib, &ibl, &ob, &obl);
|
||||
assert((!k && !ibl) ||
|
||||
(k == (size_t)(-1) && errno == E2BIG && ibl && obl < 6) ||
|
||||
(k == (size_t)(-1) &&
|
||||
(errno == EILSEQ || errno == EINVAL) && ibl));
|
||||
if (!ibl)
|
||||
break;
|
||||
if (obl < 6)
|
||||
{
|
||||
/* Enlarge the buffer */
|
||||
utflen *= 2;
|
||||
newbuf = (char *)realloc(utfbuf, utflen);
|
||||
if (!newbuf)
|
||||
goto fail;
|
||||
ob = (ob - utfbuf) + newbuf;
|
||||
obl = utflen - (ob - newbuf);
|
||||
utfbuf = newbuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Invalid input */
|
||||
ib++, ibl--;
|
||||
*ob++ = '#', obl--;
|
||||
ret = 2;
|
||||
iconv(cd1, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (cd2 == (iconv_t)(-1))
|
||||
{
|
||||
/* The target encoding was UTF-8 */
|
||||
if (tolen)
|
||||
*tolen = ob - utfbuf;
|
||||
if (!to)
|
||||
{
|
||||
free(utfbuf);
|
||||
iconv_close(cd1);
|
||||
return ret;
|
||||
}
|
||||
newbuf = (char *)realloc(utfbuf, (ob - utfbuf) + 1);
|
||||
if (!newbuf)
|
||||
goto fail;
|
||||
ob = (ob - utfbuf) + newbuf;
|
||||
*ob = '\0';
|
||||
*to = newbuf;
|
||||
iconv_close(cd1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Truncate the buffer to be tidy */
|
||||
utflen = ob - utfbuf;
|
||||
newbuf = (char *)realloc(utfbuf, utflen);
|
||||
if (!newbuf)
|
||||
goto fail;
|
||||
utfbuf = newbuf;
|
||||
|
||||
/* Convert from UTF-8 to discover how long the output is */
|
||||
outlen = 0;
|
||||
ib = utfbuf;
|
||||
ibl = utflen;
|
||||
while (ibl)
|
||||
{
|
||||
ob = tbuf;
|
||||
obl = sizeof(tbuf);
|
||||
k = iconv(cd2, &ib, &ibl, &ob, &obl);
|
||||
assert((k != (size_t)(-1) && !ibl) ||
|
||||
(k == (size_t)(-1) && errno == E2BIG && ibl) ||
|
||||
(k == (size_t)(-1) && errno == EILSEQ && ibl));
|
||||
if (ibl && !(k == (size_t)(-1) && errno == E2BIG))
|
||||
{
|
||||
/* Replace one character */
|
||||
char *tb = "?";
|
||||
size_t tbl = 1;
|
||||
|
||||
outlen += ob - tbuf;
|
||||
ob = tbuf;
|
||||
obl = sizeof(tbuf);
|
||||
k = iconv(cd2, &tb, &tbl, &ob, &obl);
|
||||
assert((!k && !tbl) ||
|
||||
(k == (size_t)(-1) && errno == EILSEQ && tbl));
|
||||
for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--)
|
||||
;
|
||||
}
|
||||
outlen += ob - tbuf;
|
||||
}
|
||||
ob = tbuf;
|
||||
obl = sizeof(tbuf);
|
||||
k = iconv(cd2, 0, 0, &ob, &obl);
|
||||
assert(!k);
|
||||
outlen += ob - tbuf;
|
||||
|
||||
/* Convert from UTF-8 for real */
|
||||
outbuf = (char *)malloc(outlen + 1);
|
||||
if (!outbuf)
|
||||
goto fail;
|
||||
ib = utfbuf;
|
||||
ibl = utflen;
|
||||
ob = outbuf;
|
||||
obl = outlen;
|
||||
while (ibl)
|
||||
{
|
||||
k = iconv(cd2, &ib, &ibl, &ob, &obl);
|
||||
assert((k != (size_t)(-1) && !ibl) ||
|
||||
(k == (size_t)(-1) && errno == EILSEQ && ibl));
|
||||
if (k && !ret)
|
||||
ret = 1;
|
||||
if (ibl && !(k == (size_t)(-1) && errno == E2BIG))
|
||||
{
|
||||
/* Replace one character */
|
||||
char *tb = "?";
|
||||
size_t tbl = 1;
|
||||
|
||||
k = iconv(cd2, &tb, &tbl, &ob, &obl);
|
||||
assert((!k && !tbl) ||
|
||||
(k == (size_t)(-1) && errno == EILSEQ && tbl));
|
||||
for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--)
|
||||
;
|
||||
}
|
||||
}
|
||||
k = iconv(cd2, 0, 0, &ob, &obl);
|
||||
assert(!k);
|
||||
assert(!obl);
|
||||
*ob = '\0';
|
||||
|
||||
free(utfbuf);
|
||||
iconv_close(cd1);
|
||||
iconv_close(cd2);
|
||||
if (tolen)
|
||||
*tolen = outlen;
|
||||
if (!to)
|
||||
{
|
||||
free(outbuf);
|
||||
return ret;
|
||||
}
|
||||
*to = outbuf;
|
||||
return ret;
|
||||
|
||||
fail:
|
||||
free(utfbuf);
|
||||
iconv_close(cd1);
|
||||
if (cd2 != (iconv_t)(-1))
|
||||
iconv_close(cd2);
|
||||
return -2;
|
||||
}
|
||||
|
||||
//#endif /* HAVE_ICONV */
|
||||
|
||||
/* arch-tag: e0ffb4f6-e337-4d5f-af90-d49e2b14041e
|
||||
(do not change this comment) */
|
|
@ -6,12 +6,12 @@
|
|||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
@ -53,7 +53,7 @@ static unsigned char *make_utf8_string(const wchar_t *unicode)
|
|||
size += 3;
|
||||
}
|
||||
c = unicode[index++];
|
||||
}
|
||||
}
|
||||
|
||||
out = (unsigned char*)malloc(size + 1);
|
||||
if (out == NULL)
|
||||
|
@ -98,7 +98,7 @@ static wchar_t *make_unicode_string(const unsigned char *utf8)
|
|||
}
|
||||
size += 1;
|
||||
c = utf8[index++];
|
||||
}
|
||||
}
|
||||
|
||||
out = (wchar_t*)malloc((size + 1) * sizeof(wchar_t));
|
||||
if (out == NULL)
|
||||
|
@ -143,13 +143,13 @@ int utf8_encode(const char *from, char **to)
|
|||
}
|
||||
|
||||
unicode = (wchar_t*)calloc(wchars + 1, sizeof(unsigned short));
|
||||
if(unicode == NULL)
|
||||
if(unicode == NULL)
|
||||
{
|
||||
fprintf(stderr, "Out of memory processing string to UTF8\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from,
|
||||
err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from,
|
||||
strlen(from), unicode, wchars);
|
||||
if(err != wchars)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ int utf8_encode(const char *from, char **to)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* On NT-based windows systems, we could use WideCharToMultiByte(), but
|
||||
/* On NT-based windows systems, we could use WideCharToMultiByte(), but
|
||||
* MS doesn't actually have a consistent API across win32.
|
||||
*/
|
||||
*to = (char*)make_utf8_string(unicode);
|
||||
|
@ -172,11 +172,11 @@ int utf8_decode(const char *from, char **to)
|
|||
wchar_t *unicode;
|
||||
int chars, err;
|
||||
|
||||
/* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but
|
||||
/* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but
|
||||
* MS doesn't actually have a consistent API across win32.
|
||||
*/
|
||||
unicode = make_unicode_string((unsigned char*)from);
|
||||
if(unicode == NULL)
|
||||
if(unicode == NULL)
|
||||
{
|
||||
fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n");
|
||||
return -1;
|
||||
|
@ -193,14 +193,14 @@ int utf8_decode(const char *from, char **to)
|
|||
}
|
||||
|
||||
*to = (char *)calloc(chars + 1, sizeof(unsigned char));
|
||||
if(*to == NULL)
|
||||
if(*to == NULL)
|
||||
{
|
||||
fprintf(stderr, "Out of memory processing string to local charset\n");
|
||||
free(unicode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode,
|
||||
err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode,
|
||||
-1, *to, chars, NULL, NULL);
|
||||
if(err != chars)
|
||||
{
|
||||
|
@ -217,12 +217,11 @@ int utf8_decode(const char *from, char **to)
|
|||
|
||||
#else /* End win32. Rest is for real operating systems */
|
||||
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
int iconvert(const char *fromcode, const char *tocode,
|
||||
extern int iconvert(const char *fromcode, const char *tocode,
|
||||
const char *from, size_t fromlen,
|
||||
char **to, size_t *tolen);
|
||||
|
||||
|
@ -251,17 +250,17 @@ static int convert_buffer(const char *fromcode, const char *tocode,
|
|||
{
|
||||
int ret = -1;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
//#ifdef HAVE_ICONV
|
||||
ret = iconvert(fromcode, tocode, from, fromlen, to, tolen);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */
|
||||
ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
#endif
|
||||
//#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */
|
||||
// ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen);
|
||||
// if (ret != -1)
|
||||
// return ret;
|
||||
//#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<Target title="Debug">
|
||||
<Option output="../../../bin/plugins/libZeroSPU2.so.0.1.0" prefix_auto="0" extension_auto="0" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option external_deps="../../../3rdparty/SoundTouch/libSoundTouch.a;" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
<Option createDefFile="1" />
|
||||
|
@ -38,6 +37,7 @@
|
|||
<Add option="`pkg-config gtk+-2.0 --cflags`" />
|
||||
<Add option="-fPIC" />
|
||||
<Add option="-m32" />
|
||||
<Add option="-msse2" />
|
||||
<Add option="-DVERSION=1" />
|
||||
<Add directory="../Linux" />
|
||||
<Add directory="../../zerospu2" />
|
||||
|
@ -53,6 +53,27 @@
|
|||
<Add library="stdc++" />
|
||||
<Add library="dl" />
|
||||
</Linker>
|
||||
<Unit filename="../../../3rdparty/SoundTouch/AAFilter.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/AAFilter.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/BPMDetect.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/FIFOSampleBuffer.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/FIFOSampleBuffer.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/FIFOSamplePipe.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/FIRFilter.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/FIRFilter.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/RateTransposer.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/RateTransposer.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/STTypes.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/SoundTouch.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/SoundTouch.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/TDStretch.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/TDStretch.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/WavFile.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/WavFile.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/cpu_detect.h" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/mmx_optimized.cpp" />
|
||||
<Unit filename="../../../3rdparty/SoundTouch/sse_optimized.cpp" />
|
||||
<Unit filename="Alsa.cpp" />
|
||||
<Unit filename="Linux.cpp" />
|
||||
<Unit filename="Linux.h" />
|
||||
|
@ -66,7 +87,6 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="support.h" />
|
||||
<Unit filename="zerospu2.glade" />
|
||||
<Unit filename="../misc.h" />
|
||||
<Unit filename="../reg.h" />
|
||||
<Unit filename="../voices.cpp" />
|
||||
|
|
Loading…
Reference in New Issue