mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Rip out the support for the Atrac3+ plugin. It is gone, to never return.
This commit is contained in:
parent
be40289d6c
commit
2c5adc96cf
12 changed files with 13 additions and 526 deletions
|
@ -913,8 +913,6 @@ add_library(${CoreLibName} ${CoreLinkType}
|
|||
Core/HLE/scePauth.h
|
||||
Core/HW/SimpleAT3Dec.cpp
|
||||
Core/HW/SimpleAT3Dec.h
|
||||
Core/HW/atrac3plus.cpp
|
||||
Core/HW/atrac3plus.h
|
||||
Core/HW/AsyncIOManager.cpp
|
||||
Core/HW/AsyncIOManager.h
|
||||
Core/HW/MediaEngine.cpp
|
||||
|
@ -1155,7 +1153,6 @@ set(NativeAppSource
|
|||
UI/GamepadEmu.cpp
|
||||
UI/UIShader.cpp
|
||||
UI/OnScreenDisplay.cpp
|
||||
UI/PluginScreen.cpp
|
||||
UI/ControlMappingScreen.cpp
|
||||
UI/CwCheatScreen.cpp
|
||||
UI/ui_atlas.cpp)
|
||||
|
|
|
@ -250,7 +250,6 @@
|
|||
<ClCompile Include="HLE\__sceAudio.cpp" />
|
||||
<ClCompile Include="Host.cpp" />
|
||||
<ClCompile Include="HW\SimpleAT3Dec.cpp" />
|
||||
<ClCompile Include="HW\atrac3plus.cpp" />
|
||||
<ClCompile Include="HW\MediaEngine.cpp" />
|
||||
<ClCompile Include="HW\MemoryStick.cpp" />
|
||||
<ClCompile Include="HW\MpegDemux.cpp" />
|
||||
|
@ -492,7 +491,6 @@
|
|||
<ClInclude Include="HLE\__sceAudio.h" />
|
||||
<ClInclude Include="Host.h" />
|
||||
<ClInclude Include="HW\SimpleAT3Dec.h" />
|
||||
<ClInclude Include="HW\atrac3plus.h" />
|
||||
<ClInclude Include="HW\MediaEngine.h" />
|
||||
<ClInclude Include="HW\MpegDemux.h" />
|
||||
<ClInclude Include="HW\SasAudio.h" />
|
||||
|
|
|
@ -433,9 +433,6 @@
|
|||
<ClCompile Include="HW\SimpleAT3Dec.cpp">
|
||||
<Filter>HW</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HW\atrac3plus.cpp">
|
||||
<Filter>HW</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HW\MpegDemux.cpp">
|
||||
<Filter>HW</Filter>
|
||||
</ClCompile>
|
||||
|
@ -861,9 +858,6 @@
|
|||
<ClInclude Include="HW\SimpleAT3Dec.h">
|
||||
<Filter>HW</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HW\atrac3plus.h">
|
||||
<Filter>HW</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HW\MpegDemux.h">
|
||||
<Filter>HW</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -1,223 +0,0 @@
|
|||
#ifdef _WIN32
|
||||
#include "Common/CommonWindows.h"
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#ifdef ANDROID
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_MAC
|
||||
#define MACOSX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern std::string externalDirectory;
|
||||
|
||||
namespace Atrac3plus_Decoder {
|
||||
|
||||
bool IsSupported() {
|
||||
#if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A) || defined(MACOSX) || defined(__linux__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
HMODULE hlib = 0;
|
||||
#else
|
||||
static void *so;
|
||||
#endif // _WIN32
|
||||
|
||||
typedef int (* ATRAC3PLUS_DECODEFRAME)(void* context, void* inbuf, int inbytes, int* channels, void** outbuf);
|
||||
typedef void* (* ATRAC3PLUS_OPENCONTEXT)();
|
||||
typedef int (* ATRAC3PLUS_CLOSECONTEXT)(void* context);
|
||||
ATRAC3PLUS_DECODEFRAME frame_decoder = 0;
|
||||
ATRAC3PLUS_OPENCONTEXT open_context = 0;
|
||||
ATRAC3PLUS_CLOSECONTEXT close_context = 0;
|
||||
|
||||
std::string GetInstalledFilename() {
|
||||
#if defined(ANDROID) && defined(ARM)
|
||||
return g_Config.internalDataDirectory + "libat3plusdecoder.so";
|
||||
#elif defined(__linux__)
|
||||
return "/usr/lib/libat3plusdecoder.so";
|
||||
#elif defined(_WIN32)
|
||||
#ifdef _M_X64
|
||||
return "at3plusdecoder64.dll";
|
||||
#else
|
||||
return "at3plusdecoder.dll";
|
||||
#endif
|
||||
#elif defined(__APPLE__)
|
||||
#ifdef IOS
|
||||
return g_Config.memCardDirectory + "libat3plusdecoder.dylib";
|
||||
#else
|
||||
return "libat3plusdecoder.dylib";
|
||||
#endif
|
||||
#elif defined(BLACKBERRY)
|
||||
return g_Config.memCardDirectory + "libat3plusdecoder.so";
|
||||
#else
|
||||
return "libat3plusdecoder.so";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string GetAutoInstallFilename() {
|
||||
#if ARMEABI_V7A
|
||||
return g_Config.memCardDirectory + "PSP/libs/armeabi-v7a/libat3plusdecoder.so";
|
||||
#else
|
||||
return g_Config.memCardDirectory + "PSP/libs/armeabi/libat3plusdecoder.so";
|
||||
#endif
|
||||
}
|
||||
|
||||
// Android-only: From SD card. .so files must be in internal memory to load on many devices.
|
||||
bool CanAutoInstall() {
|
||||
#if defined(ANDROID) && defined(ARM)
|
||||
// Android will auto install from SD card
|
||||
if (File::Exists(GetAutoInstallFilename()))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// Other platforms can't.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsInstalled() {
|
||||
return File::Exists(GetInstalledFilename());
|
||||
}
|
||||
|
||||
bool DoAutoInstall() {
|
||||
#if defined(ANDROID) && defined(ARM)
|
||||
std::string internalFilename = g_Config.internalDataDirectory + "libat3plusdecoder.so";
|
||||
#if ARMEABI_V7A
|
||||
std::string sdFilename = g_Config.memCardDirectory + "PSP/libs/armeabi-v7a/libat3plusdecoder.so";
|
||||
#else
|
||||
std::string sdFilename = g_Config.memCardDirectory + "PSP/libs/armeabi/libat3plusdecoder.so";
|
||||
#endif
|
||||
|
||||
// SD cards are often mounted no-exec.
|
||||
if (!File::Exists(internalFilename)) {
|
||||
if (!File::Copy(sdFilename, internalFilename)) {
|
||||
ELOG("Failed to copy %s to %s", sdFilename.c_str(), internalFilename.c_str());
|
||||
return false;
|
||||
}
|
||||
if (chmod(internalFilename.c_str(), 0777) < 0) {
|
||||
ELOG("Failed to chmod %s, continuing anyway", internalFilename.c_str());
|
||||
}
|
||||
}
|
||||
#else
|
||||
ELOG("Autoinstall is for android only");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
int Init() {
|
||||
if (!g_Config.bEnableAtrac3plus)
|
||||
return -1;
|
||||
|
||||
if (!IsInstalled()) {
|
||||
// Okay, we're screwed. Let's bail.
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _M_X64
|
||||
hlib = LoadLibraryA(GetInstalledFilename().c_str());
|
||||
#else
|
||||
hlib = LoadLibraryA(GetInstalledFilename().c_str());
|
||||
#endif
|
||||
if (hlib) {
|
||||
frame_decoder = (ATRAC3PLUS_DECODEFRAME)GetProcAddress(hlib, "Atrac3plusDecoder_decodeFrame");
|
||||
open_context = (ATRAC3PLUS_OPENCONTEXT)GetProcAddress(hlib, "Atrac3plusDecoder_openContext");
|
||||
close_context = (ATRAC3PLUS_CLOSECONTEXT)GetProcAddress(hlib, "Atrac3plusDecoder_closeContext");
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
std::string filename = GetInstalledFilename();
|
||||
|
||||
ILOG("Attempting to load atrac3plus decoder from %s", filename.c_str());
|
||||
so = dlopen(filename.c_str(), RTLD_LAZY);
|
||||
if (so) {
|
||||
frame_decoder = (ATRAC3PLUS_DECODEFRAME)dlsym(so, "Atrac3plusDecoder_decodeFrame");
|
||||
open_context = (ATRAC3PLUS_OPENCONTEXT)dlsym(so, "Atrac3plusDecoder_openContext");
|
||||
close_context = (ATRAC3PLUS_CLOSECONTEXT)dlsym(so, "Atrac3plusDecoder_closeContext");
|
||||
ILOG("Successfully loaded atrac3plus decoder from %s", filename.c_str());
|
||||
if (!frame_decoder || !open_context || !close_context) {
|
||||
ILOG("Found atrac3plus decoder at %s but failed to load functions", filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (errno == ENOEXEC) {
|
||||
ELOG("Failed to load atrac3plus decoder from %s. errno=%i, dlerror=%s", filename.c_str(), (int)(errno), dlerror());
|
||||
} else {
|
||||
ELOG("Failed to load atrac3plus decoder from %s. errno=%i", filename.c_str(), (int)(errno));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Shutdown() {
|
||||
#ifdef _WIN32
|
||||
if (hlib) {
|
||||
FreeLibrary(hlib);
|
||||
hlib = 0;
|
||||
}
|
||||
#else
|
||||
if (so) {
|
||||
dlclose(so);
|
||||
so = 0;
|
||||
}
|
||||
#endif // _WIN32
|
||||
frame_decoder = 0;
|
||||
open_context = 0;
|
||||
close_context = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* OpenContext() {
|
||||
if (!open_context)
|
||||
return 0;
|
||||
return open_context();
|
||||
}
|
||||
|
||||
int CloseContext(Context *context) {
|
||||
if (!close_context || !context)
|
||||
return 0;
|
||||
close_context(*context);
|
||||
*context = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Decode(Context context, void* inbuf, int inbytes, int *outbytes, void* outbuf) {
|
||||
if (!frame_decoder) {
|
||||
*outbytes = 0;
|
||||
return false;
|
||||
}
|
||||
int channels = 0;
|
||||
void* buf;
|
||||
int ret = frame_decoder(context, inbuf, inbytes, &channels, &buf);
|
||||
if (ret != 0) {
|
||||
*outbytes = 0;
|
||||
return false;
|
||||
}
|
||||
*outbytes = channels * 2 * 0x800;
|
||||
memcpy(outbuf, buf, *outbytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // Atrac3plus_Decoder
|
|
@ -1,20 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "Core/HW/BufferQueue.h"
|
||||
|
||||
namespace Atrac3plus_Decoder {
|
||||
bool IsSupported();
|
||||
bool IsInstalled();
|
||||
bool CanAutoInstall();
|
||||
bool DoAutoInstall();
|
||||
std::string GetInstalledFilename();
|
||||
|
||||
int Init();
|
||||
int Shutdown();
|
||||
|
||||
typedef void* Context;
|
||||
|
||||
Context OpenContext();
|
||||
int CloseContext(Context *context);
|
||||
bool Decode(Context context, void* inbuf, int inbytes, int *outbytes, void* outbuf);
|
||||
}
|
|
@ -15,13 +15,15 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/colorutil.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "math/curves.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/viewgroup.h"
|
||||
#include "ui/ui_context.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/PluginScreen.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "UI/MiscScreens.h"
|
||||
|
@ -30,14 +32,10 @@
|
|||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
#include "android/jni/TestRunner.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "base/colorutil.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "math/curves.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "android/jni/TestRunner.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "Common/KeyMap.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -189,10 +187,7 @@ void GameSettingsScreen::CreateViews() {
|
|||
audioSettingsScroll->Add(audioSettings);
|
||||
tabHolder->AddTab(ms->T("Audio"), audioSettingsScroll);
|
||||
|
||||
std::string atracString;
|
||||
atracString.assign(Atrac3plus_Decoder::IsInstalled() ? "Redownload Atrac3+ plugin" : "Download Atrac3+ plugin");
|
||||
audioSettings->Add(new ItemHeader(ms->T("Audio")));
|
||||
audioSettings->Add(new Choice(a->T(atracString.c_str())))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin);
|
||||
|
||||
audioSettings->Add(new PopupSliderChoice(&g_Config.iSFXVolume, 0, 8, a->T("SFX volume"), screenManager()));
|
||||
audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, 8, a->T("BGM volume"), screenManager()));
|
||||
|
@ -369,31 +364,20 @@ void GameSettingsScreen::sendMessage(const char *message, const char *value) {
|
|||
}
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnDownloadPlugin(UI::EventParams &e) {
|
||||
screenManager()->push(new PluginScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) {
|
||||
// If we're in-game, return to the game via DR_CANCEL.
|
||||
if(PSP_IsInited()) {
|
||||
if (PSP_IsInited()) {
|
||||
screenManager()->finishDialog(this, DR_CANCEL);
|
||||
host->UpdateScreen();
|
||||
} else {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
|
||||
if(g_Config.bEnableSound) {
|
||||
if(PSP_IsInited() && !IsAudioInitialised())
|
||||
if (g_Config.bEnableSound) {
|
||||
if (PSP_IsInited() && !IsAudioInitialised())
|
||||
Audio_Init();
|
||||
}
|
||||
// It doesn't matter if audio is inited or not, it'll still output no sound
|
||||
// if the mixer isn't available, so go ahead and init/shutdown at our leisure.
|
||||
if(Atrac3plus_Decoder::IsInstalled()) {
|
||||
if(g_Config.bEnableAtrac3plus)
|
||||
Atrac3plus_Decoder::Init();
|
||||
else Atrac3plus_Decoder::Shutdown();
|
||||
}
|
||||
|
||||
Reporting::Enable(enableReports_, "report.ppsspp.org");
|
||||
g_Config.Save();
|
||||
|
||||
|
@ -428,11 +412,6 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
|
|||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnFactoryReset(UI::EventParams &e) {
|
||||
screenManager()->push(new PluginScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnLanguage(UI::EventParams &e) {
|
||||
I18NCategory *de = GetI18NCategory("Developer");
|
||||
auto langScreen = new NewLanguageScreen(de->T("Language"));
|
||||
|
|
|
@ -58,7 +58,6 @@ private:
|
|||
UI::EventReturn OnLanguageChange(UI::EventParams &e);
|
||||
UI::EventReturn OnPostProcShader(UI::EventParams &e);
|
||||
UI::EventReturn OnPostProcShaderChange(UI::EventParams &e);
|
||||
UI::EventReturn OnFactoryReset(UI::EventParams &e);
|
||||
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
|
||||
UI::EventReturn OnChangeNickname(UI::EventParams &e);
|
||||
UI::EventReturn OnClearRecents(UI::EventParams &e);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "UI/CwCheatScreen.h"
|
||||
#include "UI/MiscScreens.h"
|
||||
#include "UI/ControlMappingScreen.h"
|
||||
#include "UI/PluginScreen.h"
|
||||
#include "UI/ui_atlas.h"
|
||||
#include "Core/Config.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
|
|
|
@ -39,12 +39,14 @@
|
|||
#include "native/util/text/utf8.h"
|
||||
#include "gfx_es2/gl_state.h"
|
||||
#include "gfx_es2/draw_text.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "gfx/gl_lost_manager.h"
|
||||
#include "gfx/texture.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "input/input_state.h"
|
||||
#include "math/math_util.h"
|
||||
#include "math/lin/matrix4x4.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/screen.h"
|
||||
#include "ui/ui_context.h"
|
||||
#include "ui/view.h"
|
||||
|
@ -57,7 +59,6 @@
|
|||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
#include "Common/MemArena.h"
|
||||
|
||||
#include "ui_atlas.h"
|
||||
|
@ -65,8 +66,8 @@
|
|||
#include "GameInfoCache.h"
|
||||
#include "UIShader.h"
|
||||
|
||||
#include "UI/PluginScreen.h"
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
#include "UI/MiscScreens.h"
|
||||
|
||||
// The new UI framework, for initialization
|
||||
|
||||
|
@ -395,7 +396,7 @@ void NativeInit(int argc, const char *argv[],
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (skipLogo) {
|
||||
screenManager->switchScreen(new EmuScreen(boot_filename));
|
||||
} else {
|
||||
|
@ -585,7 +586,6 @@ void NativeUpdate(InputState &input) {
|
|||
}
|
||||
}
|
||||
|
||||
UIUpdateMouse(0, input.pointer_x[0], input.pointer_y[0], input.pointer_down[0]);
|
||||
screenManager->update(input);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// 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, version 2.0 or later versions.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/functional.h"
|
||||
#include "UI/PluginScreen.h"
|
||||
#include "ext/vjson/json.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/viewgroup.h"
|
||||
#include "ui/ui_context.h"
|
||||
#include "UI/ui_atlas.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_MAC
|
||||
#define MACOSX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PluginScreen::PluginScreen() {
|
||||
// Let's start by downloading the json. We'll find out in Update when it's finished.
|
||||
json_ = downloader_.StartDownload("http://www.ppsspp.org/update/at3plusdecoder.json", "");
|
||||
}
|
||||
|
||||
void PluginScreen::CreateViews() {
|
||||
I18NCategory *p = GetI18NCategory("Plugin");
|
||||
I18NCategory *d = GetI18NCategory("Dialog");
|
||||
// Build the UI.
|
||||
|
||||
using namespace UI;
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL);
|
||||
|
||||
Margins textMargins(20,17);
|
||||
Margins buttonMargins(10,10);
|
||||
|
||||
root_->Add(new TextView(p->T("Atrac3+ Audio Support"), ALIGN_HCENTER, 1.5f, new LinearLayoutParams(textMargins)));
|
||||
|
||||
ViewGroup *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0));
|
||||
LinearLayout *scrollContents = new LinearLayout(ORIENT_VERTICAL);
|
||||
root_->Add(scroll);
|
||||
scroll->Add(scrollContents);
|
||||
|
||||
tvDescription_ = scrollContents->Add(new TextView(p->T("Looking for download..."), ALIGN_LEFT, 1.0f, new LinearLayoutParams(textMargins)));
|
||||
|
||||
const char *legalityNotice =
|
||||
p->T("Origins are dubious", "* Mai's Atrac3+ decoder is currently required\n"
|
||||
"for background audio and voice in many games.\n"
|
||||
"Please note that the origins of this code are dubious.\n"
|
||||
"Choose More Information for more information.");
|
||||
|
||||
scrollContents->Add(new TextView(legalityNotice, ALIGN_LEFT, 0.65f, new LinearLayoutParams(textMargins) ));
|
||||
|
||||
progress_ = root_->Add(new ProgressBar());
|
||||
progress_->SetVisibility(V_GONE);
|
||||
|
||||
ViewGroup *buttonBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(buttonMargins));
|
||||
root_->Add(buttonBar);
|
||||
|
||||
buttonBack_ = new Button(d->T("Back"), new LinearLayoutParams(1.0));
|
||||
buttonBar->Add(buttonBack_)->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
buttonDownload_ = new Button(p->T("Download and install"), new LinearLayoutParams(1.0));
|
||||
buttonDownload_->SetEnabled(false);
|
||||
buttonBar->Add(buttonDownload_)->OnClick.Handle(this, &PluginScreen::OnDownload);
|
||||
buttonBar->Add(new Button(p->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Handle(this, &PluginScreen::OnInformation);
|
||||
}
|
||||
|
||||
void PluginScreen::update(InputState &input) {
|
||||
UIScreen::update(input);
|
||||
|
||||
I18NCategory *p = GetI18NCategory("Plugin");
|
||||
|
||||
downloader_.Update();
|
||||
|
||||
if (json_.get() && json_->Done()) {
|
||||
if (json_->ResultCode() != 200) {
|
||||
char codeStr[18];
|
||||
sprintf(codeStr, "%i", json_->ResultCode());
|
||||
tvDescription_->SetText(p->T("Failed to reach server", "Failed to reach server.\nPlease try again later and check that you have a\nworking internet connection."));
|
||||
buttonDownload_->SetEnabled(false);
|
||||
} else {
|
||||
std::string json;
|
||||
json_->buffer().TakeAll(&json);
|
||||
|
||||
JsonReader reader(json.data(), json.size());
|
||||
const json_value *root = reader.root();
|
||||
|
||||
std::string abi = "";
|
||||
#if defined(_M_IX86) && defined(_WIN32)
|
||||
abi = "Win32";
|
||||
#elif defined(_M_X64) && defined(_WIN32)
|
||||
abi = "Win64";
|
||||
#elif defined(ARMEABI)
|
||||
abi = "armeabi";
|
||||
#elif defined(ARMEABI_V7A)
|
||||
abi = "armeabi-v7a";
|
||||
#elif defined(ANDROID) && defined(_M_IX86)
|
||||
abi = "android-x86";
|
||||
#elif defined(BLACKBERRY)
|
||||
abi = "blackberry10";
|
||||
#elif defined(IOS)
|
||||
abi = "ios";
|
||||
#elif defined(MACOSX)
|
||||
abi = "MacOSX64";
|
||||
#endif
|
||||
const char *notSupportedText = p->T("SorryNoDownload", "Sorry, there is no automatic download of the decoder\navailable for this platform.");
|
||||
if (!abi.empty()) {
|
||||
at3plusdecoderUrl_ = root->getString(abi.c_str(), "");
|
||||
if (at3plusdecoderUrl_.empty()) {
|
||||
buttonDownload_->SetEnabled(false);
|
||||
tvDescription_->SetText(notSupportedText);
|
||||
} else {
|
||||
buttonDownload_->SetEnabled(true);
|
||||
const char *notInstalledText = p->T("To download and install", "To download and install Mai's Atrac3+ decoding\n support, click Download.");
|
||||
const char *reInstallText = p->T("Already installed", "Mai's Atrac3+ decoder already installed.\nWould you like to redownload and reinstall it?");
|
||||
tvDescription_->SetText(Atrac3plus_Decoder::IsInstalled() ? reInstallText : notInstalledText);
|
||||
}
|
||||
} else {
|
||||
tvDescription_->SetText(notSupportedText);
|
||||
}
|
||||
}
|
||||
|
||||
json_.reset();
|
||||
}
|
||||
|
||||
if (at3plusdecoder_.get() && at3plusdecoder_->Done()) {
|
||||
// Done! yay.
|
||||
progress_->SetProgress(1.0);
|
||||
|
||||
if (at3plusdecoder_->ResultCode() == 200) {
|
||||
// Yay!
|
||||
tvDescription_->SetText(p->T("Installed Correctly", "Mai Atrac3plus plugin downloaded and installed.\n"
|
||||
"Please press Back."));
|
||||
buttonDownload_->SetVisibility(UI::V_GONE);
|
||||
} else {
|
||||
char codeStr[18];
|
||||
sprintf(codeStr, "%i", at3plusdecoder_->ResultCode());
|
||||
tvDescription_->SetText(p->T("Failed to download plugin", "Failed to download plugin.\nPlease try again later."));
|
||||
progress_->SetVisibility(UI::V_GONE);
|
||||
buttonDownload_->SetEnabled(true);
|
||||
}
|
||||
|
||||
at3plusdecoder_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
UI::EventReturn PluginScreen::OnDownload(UI::EventParams &e) {
|
||||
buttonDownload_->SetEnabled(false);
|
||||
|
||||
std::string destination = Atrac3plus_Decoder::GetInstalledFilename();
|
||||
at3plusdecoder_ = downloader_.StartDownload(at3plusdecoderUrl_, destination);
|
||||
progress_->SetVisibility(UI::V_VISIBLE);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn PluginScreen::OnInformation(UI::EventParams &e) {
|
||||
LaunchBrowser("http://www.ppsspp.org/at3plusdecoder.html");
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// 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, version 2.0 or later versions.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "ui/screen.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/viewgroup.h"
|
||||
#include "ui/ui_screen.h"
|
||||
#include "file/file_util.h"
|
||||
#include "net/http_client.h"
|
||||
|
||||
#include "UI/MiscScreens.h"
|
||||
|
||||
class PluginScreen : public UIDialogScreenWithBackground {
|
||||
public:
|
||||
PluginScreen();
|
||||
|
||||
virtual void update(InputState &input);
|
||||
|
||||
protected:
|
||||
virtual void CreateViews();
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
UI::EventReturn OnDownload(UI::EventParams &e);
|
||||
UI::EventReturn OnInformation(UI::EventParams &e);
|
||||
|
||||
// Keeping track of downloads
|
||||
http::Downloader downloader_;
|
||||
std::shared_ptr<http::Download> json_;
|
||||
std::shared_ptr<http::Download> at3plusdecoder_;
|
||||
|
||||
// UI widgets that need updating
|
||||
UI::TextView *tvDescription_;
|
||||
UI::Button *buttonBack_;
|
||||
UI::Button *buttonDownload_;
|
||||
UI::ProgressBar *progress_;
|
||||
|
||||
std::string at3plusdecoderUrl_;
|
||||
};
|
|
@ -109,7 +109,6 @@ EXEC_AND_LIB_FILES := \
|
|||
$(SRC)/UI/GamepadEmu.cpp \
|
||||
$(SRC)/UI/GameInfoCache.cpp \
|
||||
$(SRC)/UI/OnScreenDisplay.cpp \
|
||||
$(SRC)/UI/PluginScreen.cpp \
|
||||
$(SRC)/UI/GameScreen.cpp \
|
||||
$(SRC)/UI/ControlMappingScreen.cpp \
|
||||
$(SRC)/UI/GameSettingsScreen.cpp \
|
||||
|
@ -172,7 +171,6 @@ EXEC_AND_LIB_FILES := \
|
|||
$(SRC)/Core/ELF/PrxDecrypter.cpp \
|
||||
$(SRC)/Core/ELF/ParamSFO.cpp \
|
||||
$(SRC)/Core/HW/SimpleAT3Dec.cpp \
|
||||
$(SRC)/Core/HW/atrac3plus.cpp \
|
||||
$(SRC)/Core/HW/AsyncIOManager.cpp \
|
||||
$(SRC)/Core/HW/MemoryStick.cpp \
|
||||
$(SRC)/Core/HW/MpegDemux.cpp.arm \
|
||||
|
|
Loading…
Add table
Reference in a new issue