Merge pull request #54 from OmniTroid/master
Restructuring + better cross-platform support
This commit is contained in:
commit
4d93f059c0
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,11 +3,13 @@
|
||||
*.user
|
||||
*.dll
|
||||
*.so
|
||||
*.pro.autosave
|
||||
base_override.h
|
||||
|
||||
base-full/
|
||||
bass.lib
|
||||
|
||||
bin/
|
||||
bins/
|
||||
release/
|
||||
debug/
|
||||
|
30
Attorney_Online.pro
Normal file
30
Attorney_Online.pro
Normal file
@ -0,0 +1,30 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2016-12-29T01:14:46
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui multimedia network
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = Attorney_Online
|
||||
TEMPLATE = app
|
||||
|
||||
VERSION = 2.6.0.0
|
||||
|
||||
INCLUDEPATH += $$PWD/include
|
||||
DESTDIR = $$PWD/bin
|
||||
OBJECTS_DIR = $$PWD/build
|
||||
MOC_DIR = $$PWD/build
|
||||
|
||||
SOURCES += $$files($$PWD/src/*.cpp)
|
||||
HEADERS += $$files($$PWD/include/*.h)
|
||||
LIBS += -L$$PWD/lib -lbass -ldiscord-rpc
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
RESOURCES += resources.qrc
|
||||
|
||||
win32:RC_ICONS = resource/logo.ico
|
||||
|
||||
QTPLUGIN += qapng
|
@ -1,116 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2016-12-29T01:14:46
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui multimedia network
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
RC_ICONS = logo.ico
|
||||
|
||||
TARGET = Attorney_Online
|
||||
TEMPLATE = app
|
||||
|
||||
VERSION = 2.6.0.0
|
||||
|
||||
SOURCES += main.cpp\
|
||||
lobby.cpp \
|
||||
text_file_functions.cpp \
|
||||
path_functions.cpp \
|
||||
aoimage.cpp \
|
||||
file_functions.cpp \
|
||||
aobutton.cpp \
|
||||
debug_functions.cpp \
|
||||
networkmanager.cpp \
|
||||
aoapplication.cpp \
|
||||
aopacket.cpp \
|
||||
packet_distribution.cpp \
|
||||
hex_functions.cpp \
|
||||
encryption_functions.cpp \
|
||||
courtroom.cpp \
|
||||
aocharbutton.cpp \
|
||||
hardware_functions.cpp \
|
||||
aoscene.cpp \
|
||||
aomovie.cpp \
|
||||
misc_functions.cpp \
|
||||
aocharmovie.cpp \
|
||||
aoemotebutton.cpp \
|
||||
emotes.cpp \
|
||||
aosfxplayer.cpp \
|
||||
aomusicplayer.cpp \
|
||||
aoblipplayer.cpp \
|
||||
evidence.cpp \
|
||||
aoevidencebutton.cpp \
|
||||
charselect.cpp \
|
||||
aotextarea.cpp \
|
||||
aolineedit.cpp \
|
||||
aotextedit.cpp \
|
||||
aoevidencedisplay.cpp \
|
||||
discord_rich_presence.cpp \
|
||||
aooptionsdialog.cpp \
|
||||
chatlogpiece.cpp \
|
||||
aocaseannouncerdialog.cpp
|
||||
|
||||
HEADERS += lobby.h \
|
||||
aoimage.h \
|
||||
file_functions.h \
|
||||
aobutton.h \
|
||||
debug_functions.h \
|
||||
networkmanager.h \
|
||||
aoapplication.h \
|
||||
datatypes.h \
|
||||
aopacket.h \
|
||||
hex_functions.h \
|
||||
encryption_functions.h \
|
||||
courtroom.h \
|
||||
aocharbutton.h \
|
||||
hardware_functions.h \
|
||||
aoscene.h \
|
||||
aomovie.h \
|
||||
misc_functions.h \
|
||||
aocharmovie.h \
|
||||
aoemotebutton.h \
|
||||
aosfxplayer.h \
|
||||
aomusicplayer.h \
|
||||
aoblipplayer.h \
|
||||
aoevidencebutton.h \
|
||||
aotextarea.h \
|
||||
aolineedit.h \
|
||||
aotextedit.h \
|
||||
aoevidencedisplay.h \
|
||||
discord_rich_presence.h \
|
||||
discord-rpc.h \
|
||||
aooptionsdialog.h \
|
||||
text_file_functions.h \
|
||||
chatlogpiece.h \
|
||||
aocaseannouncerdialog.h
|
||||
|
||||
# 1. You need to get BASS and put the x86 bass DLL/headers in the project root folder
|
||||
# AND the compilation output folder. If you are compiling statically, you'll probably
|
||||
# need the .lib file too. MinGW-GCC is really finicky finding BASS, it seems. However,
|
||||
# even with the .lib file, you still need the DLL in the final output.
|
||||
# 2. You need to compile the Discord Rich Presence SDK separately and add the lib/headers
|
||||
# in the same way as BASS. Discord RPC uses CMake, which does not play nicely with
|
||||
# QMake, so this step must be manual. If you are compiling dynamically, it's fine to
|
||||
# use the prebuilt libraries.
|
||||
# 3. You also need to build QtApng (https://github.com/Skycoder42/QtApng).
|
||||
# Optionally, you may install it in /usr/share/qt5/plugins/imageformats, but if you do
|
||||
# so, then you must patch qapng.pri, qapngd.pri, png.pri, pngd.pri, z.pri, and zd.pri
|
||||
# such that they no longer point to the builds in the original project directory
|
||||
# (by removing those respective entries in QMAKE_PRL_LIBS and replacing them with
|
||||
# something like `-L$$[QT_INSTALL_LIBS] -lpng -lz`).
|
||||
#
|
||||
# Naturally, the build process becomes significantly less convoluted if you simply
|
||||
# compile dynamically. If your primary distribution method is via the launcher, then
|
||||
# a simple dynamic compilation is recommended.
|
||||
unix:LIBS += -L$$PWD -lbass -ldiscord-rpc
|
||||
win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc
|
||||
INCLUDEPATH += $$PWD/include
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
||||
DISTFILES +=
|
@ -1,4 +1,4 @@
|
||||
# Attorney Online 2
|
||||
# Attorney Online
|
||||
|
||||
[Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format.
|
||||
|
||||
|
43
README_BUILD.md
Normal file
43
README_BUILD.md
Normal file
@ -0,0 +1,43 @@
|
||||
### Dependencies
|
||||
|
||||
This program has five main dependencies
|
||||
|
||||
* Qt 5.6+ (https://www.qt.io/download)
|
||||
* BASS (http://www.un4seen.com/bass.html)
|
||||
* BASS Opus Plugin (http://www.un4seen.com/bass.html#addons)
|
||||
* Discord Rich Presence (https://github.com/discordapp/discord-rpc/releases)
|
||||
* Qt Apng Plugin (https://github.com/Skycoder42/QtApng/releases)
|
||||
|
||||
### How to build dynamically (the easy way)
|
||||
|
||||
What you want to do is first download the latest version of Qt from the first link. (get the prebuilt dynamic version)
|
||||
If you're on Ubuntu, go to the scripts/ folder and run configure_ubuntu.sh. This should fetch all the required dependencies automatically.
|
||||
If not, go to each one of the links above and find the right dynamic library for your platform:
|
||||
* Windows: .dll
|
||||
* Linux: .so
|
||||
* Mac: .dylib
|
||||
|
||||
And put them in BOTH lib/ and the repository root (lib/ is required for linking and root is required for runtime)
|
||||
|
||||
Launch Qt creator, open the .pro file and try running it. Ask in the Discord if you're having issues: https://discord.gg/wWvQ3pw
|
||||
|
||||
### How to build statically (the hard way)
|
||||
|
||||
You're gonna have a bad time.
|
||||
|
||||
Building statically means you can distribute the final program without needing to pack alongside a lot of dynamic libraries.
|
||||
This is a tricky process and is not recommended unless you know what you're doing.
|
||||
|
||||
First, you need to build the entirety of Qt statically. To do this, check the desired version under "Sources" in the Qt maintenance tool.
|
||||
After this is done, follow these instructions: https://dimitris.apeiro.gr/2015/06/24/build-a-static-qt5-for-windows-by-compiling/
|
||||
This guide is specifically for Windows, but Qt is cross-platform and you should be good with or without some minor adjustments to the guide.
|
||||
Note that this **is** a computationally heavy process and will take a lot of time on a slow computer.
|
||||
After this, you need to configure the project to use the static version of qmake (see http://doc.qt.io/qtcreator/creator-build-settings.html)
|
||||
|
||||
BASS and BASS Opus only comes as dynamic libraries and is not open-source. That means you can't link it statically in the program.
|
||||
|
||||
For Discord RPC, you can download prebuilt static libraries for your platform. Just put them in lib/.
|
||||
|
||||
For Qt Apng Plugin, you need to compile it statically. This guide does not go into detail how to configure this to build a static library. You may have to add Q_IMPORT_PLUGIN(ApngImagePlugin); in main.cpp. See more about importing static plugins here: http://doc.qt.io/qt-5/plugins-howto.html#static-plugins
|
||||
It's also possible to just link this dynamically.
|
||||
|
1139
include/bass.h
Normal file
1139
include/bass.h
Normal file
File diff suppressed because it is too large
Load Diff
2
lib/.gitignore
vendored
Normal file
2
lib/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@ -1,6 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>resource/fonts/Ace-Attorney.ttf</file>
|
||||
<file>logo.png</file>
|
||||
<file>resource/logo.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
38
scripts/configure_ubuntu.sh
Executable file
38
scripts/configure_ubuntu.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
#assumes a somewhat recent 64-bit ubuntu
|
||||
|
||||
#need some openGL stuff
|
||||
sudo apt install libgl1-mesa-dev
|
||||
|
||||
mkdir tmp
|
||||
|
||||
cd tmp
|
||||
|
||||
#get the bass prebuilt
|
||||
curl http://www.un4seen.com/files/bass24-linux.zip -o bass_linux.zip
|
||||
|
||||
unzip bass_linux.zip
|
||||
|
||||
cp x64/libbass.so ../../lib
|
||||
|
||||
#get the discord-rpc prebuilt
|
||||
curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o discord_rpc_linux.zip
|
||||
|
||||
unzip discord_rpc_linux.zip
|
||||
|
||||
cp discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ../../lib/
|
||||
|
||||
#get libqtapng plugin prebuilt
|
||||
curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.0-5/build_gcc_64_5.12.0.tar.xz -o apng.tar.xz
|
||||
|
||||
tar -xvf apng.tar.xz
|
||||
|
||||
cp gcc_64/plugins/imageformats/libqapng.so ../../lib
|
||||
|
||||
cd ..
|
||||
|
||||
rm -rf tmp
|
||||
|
||||
#during runtime, the program expects the libraries to exist in the root folder
|
||||
cp ../lib/* ..
|
16
scripts/fix_dynamic_linking_macos.sh
Normal file
16
scripts/fix_dynamic_linking_macos.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
#this script relinks dynamic libraries so the .app file can be distributed as standalone
|
||||
|
||||
install_name_tool -id @executable_path/../Frameworks/libbass.dylib ../bin/Attorney_Online.app/Contents/Frameworks/libbass.dylib
|
||||
|
||||
install_name_tool -id @executable_path/../Frameworks/libbassopus.dylib ../bin/Attorney_Online.app/Contents/Frameworks/libbassopus.dylib
|
||||
|
||||
install_name_tool -id @executable_path/../Frameworks/libdiscord-rpc.dylib ../bin/Attorney_Online.app/Contents/Frameworks/libdiscord-rpc.dylib
|
||||
|
||||
install_name_tool -id @executable_path/../Frameworks/libqapng.dylib ../bin/Attorney_Online.app/Contents/Frameworks/libqapng.dylib
|
||||
|
||||
install_name_tool -change @loader_path/libbass.dylib @executable_path/../Frameworks/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
|
||||
|
||||
install_name_tool -change @rpath/libdiscord-rpc.dylib @executable_path/../Frameworks/libdiscord-rpc.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
|
||||
|
@ -512,6 +512,11 @@ bool AOOptionsDialog::needs_default_audiodev()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#elif defined __APPLE__
|
||||
bool AOOptionsDialog::needs_default_audiodev()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
#error This operating system is not supported.
|
||||
#endif
|
@ -3508,6 +3508,11 @@ void Courtroom::load_bass_opus_plugin()
|
||||
{
|
||||
BASS_PluginLoad("libbassopus.so", 0);
|
||||
}
|
||||
#elif defined __APPLE__
|
||||
void Courtroom::load_bass_opus_plugin()
|
||||
{
|
||||
BASS_PluginLoad("libbassopus.dylib", 0);
|
||||
}
|
||||
#else
|
||||
#error This operating system is unsupported for bass plugins.
|
||||
#endif
|
@ -50,6 +50,13 @@ QString get_hdid()
|
||||
return "gxcpz32sa9fnwic92mfbs0";
|
||||
}
|
||||
|
||||
#elif defined __APPLE__
|
||||
QString get_hdid()
|
||||
{
|
||||
//hdids are broken at this point anyways
|
||||
return "just a mac passing by";
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error This operating system is unsupported for hardware functions.
|
@ -7,7 +7,6 @@
|
||||
#include "courtroom.h"
|
||||
#include <QPluginLoader>
|
||||
#include <QDebug>
|
||||
Q_IMPORT_PLUGIN(ApngImagePlugin);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
|
Loading…
Reference in New Issue
Block a user