Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #61 from Astrabit-ST/revert-60-master
Browse files Browse the repository at this point in the history
Revert "ModShot fixes and notifications/balloons"
  • Loading branch information
Speak2Erase committed May 24, 2022
2 parents 891af61 + 79dbdba commit 718e6d5
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 447 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
- name: Build
working-directory: ${{ github.workspace }}
run: |
sudo apt update
bash setup.sh
pip3 install meson ninja
cd linux
Expand Down
2 changes: 2 additions & 0 deletions binding-mri/input-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ RB_METHOD(inputGetAllRepeated)
RB_METHOD(inputSetAllPressedUnPressed)
{
RB_UNUSED_PARAM;
VALUE res = rb_ary_new();
for (size_t i = 0; i < buttonCodesN; i++) {
if (shState->input().isPressed(buttonCodes[i].val)) {
shState->input().unsetKey(buttonCodes[i].val);
Expand All @@ -532,6 +533,7 @@ RB_METHOD(inputSetAllPressedUnPressed)
RB_METHOD(inputSetAllUnPressed)
{
RB_UNUSED_PARAM;
VALUE res = rb_ary_new();
for (size_t i = 0; i < buttonCodesN; i++) {
shState->input().unsetKey(buttonCodes[i].val);
}
Expand Down
4 changes: 0 additions & 4 deletions binding-mri/modshot-window-binding.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#endif

#include "oneshot.h"
#include "etc.h"
#include "sharedstate.h"
Expand Down
5 changes: 1 addition & 4 deletions binding-mri/niko-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ namespace syswm {

#define BUFFER_SIZE 256

#ifdef LINUX
static SDL_Thread *thread = NULL;
#endif

static SDL_Thread *thread = NULL;
static SDL_mutex *mutex = NULL;
static volatile char message_buffer[BUFFER_SIZE];
static volatile bool active = false;
Expand Down
41 changes: 0 additions & 41 deletions binding-mri/oneshot-binding.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#if defined _WIN32
#define WIN32_LEAN_AND_MEAN
#endif

#include "oneshot.h"
#include "etc.h"
#include "sharedstate.h"
Expand Down Expand Up @@ -105,42 +101,6 @@ RB_METHOD(oneshotCRC32)
return UINT2NUM(result.checksum());
}

RB_METHOD(oneshotNotificaion)
{
RB_UNUSED_PARAM;
char* title;
char* info;
VALUE icon = Qnil;
rb_get_args(argc, argv, "zz|o", &title, &info, &icon RB_ARG_END);

#ifdef _WIN32
if (!shState->oneshot().hasTrayIcon()) {
shState->oneshot().addNotifyIcon("OneShot");
}
#endif

switch (TYPE(icon))
{
case T_NIL:
shState->oneshot().sendBalloon(title, info, 0, NULL);
break;
case T_FIXNUM:
shState->oneshot().sendBalloon(title, info, NUM2INT(icon), NULL);
break;
case T_STRING:
{
std::string iconStr = std::string(RSTRING_PTR(icon), RSTRING_LEN(icon));
shState->oneshot().sendBalloon(title, info, 0, iconStr.c_str());
break;
}
default:
shState->oneshot().sendBalloon(title, info, 0, NULL);
break;
}

return Qnil;
}

void oneshotBindingInit()
{
VALUE module = rb_define_module("Oneshot");
Expand Down Expand Up @@ -172,5 +132,4 @@ void oneshotBindingInit()
_rb_define_module_function(module, "exiting", oneshotExiting);
_rb_define_module_function(module, "shake", oneshotShake);
_rb_define_module_function(module, "crc32", oneshotCRC32);
_rb_define_module_function(module, "notify", oneshotNotificaion);
}
3 changes: 1 addition & 2 deletions binding-mri/wallpaper-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ RB_METHOD(wallpaperSet)
int color;
rb_get_args(argc, argv, "zi", &name, &color RB_ARG_END);
std::string path;
std::string nameStr = name;
#ifdef _WIN32
path = "Wallpaper\\" + nameStr + ".bmp";
path = shState->config().gameFolder + "\\Wallpaper\\" + name + ".bmp";
Debug() << "Setting wallpaper to" << path;
// Crapify the slashes
size_t index = 0;
Expand Down
89 changes: 39 additions & 50 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,61 +1,50 @@
#!/bin/bash

# ModShot dependencies installer

if [[ $OSTYPE == msys ]]; then
echo " * MSYS2 detected"
echo " * Installing pactoys..."
pacman -S pactoys --needed --noconfirm
echo " * Installing dependencies..."
pacboy -S git: vim: libtool: autoconf: automake: gcc:p make:p cmake:p \
ruby:p bison: doxygen:p SDL2:p SDL2_image:p SDL2_ttf:p openal:p \
freetype:p physfs:p pixman:p libwebp:p zlib:p meson:p clang:p bzip2:p \
libvorbis:p libogg:p zeromq:p libsigc++:p boost:p libpng:p \
libjpeg-turbo:p libtiff:p harfbuzz:p --needed --noconfirm
echo "* MinGW-w64 detected."
echo "* Installing dependencies..."
pacman -S pactoys --noconfirm
pacboy -S libtool: autoconf: automake: git: gcc:p make:p cmake:p bison: doxygen:p ruby:p \
SDL2:p SDL2_image:p SDL2_ttf:p openal:p vim: freetype:p \
physfs:p pixman:p libwebp:p zlib:p meson:p clang:p \
bzip2:p libvorbis:p libogg:p zeromq:p libsigc++:p \
boost:p libpng:p libjpeg-turbo:p libtiff:p harfbuzz:p --noconfirm
else
if [[ "$(cat /etc/issue)" == Debian* || "$(cat /etc/issue)" == Ubuntu* ]];
then
echo " * Debian Linux detected"
echo " * Installing dependencies..."
sudo apt install -y gcc make cmake vim ruby bison doxygen meson \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libopenal-dev \
libphysfs-dev libpixman-1-dev libwebp-dev libbz2-dev libvorbis-dev \
libogg-dev libsodium-dev libboost-dev libpng-dev libjpeg-dev \
libtiff-dev libsigc++-2.0-dev libgtk-3-dev libxfconf-0-dev \
libfreetype-dev libharfbuzz-dev
if [[ "$(cat /etc/issue)" == Debian* || "$(cat /etc/issue)" == Ubuntu* ]]; then
echo "* Debian Linux detected."
echo "* Installing dependencies..."
sudo apt install -y gcc make cmake bison doxygen ruby \
libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libopenal-dev \
libphysfs-dev libpixman-1-dev libwebp-dev libbz2-dev \
libvorbis-dev libogg-dev libsodium-dev libboost-dev libpng-dev \
libjpeg-dev libtiff-dev libsigc++-2.0-dev meson vim libgtk2.0-dev \
libxfconf-0-dev libfreetype-dev libharfbuzz-dev \

fi

if [[ "$(cat /etc/issue)" == Manjaro* ]];
then
echo " * Manjaro detected"
echo " * Installing dependencies..."
sudo pacman -S --noconfirm --needed vim gcc make cmake ruby bison \
doxygen sdl2 openal pixman libwebp bzip2 libvorbis libogg libsodium \
libpng libjpeg libtiff zeromq mm-common base-devel gtk3
echo " * Installing dependencies with pamac..."
if [[ "$(cat /etc/issue)" == Manjaro* ]]; then
echo "* Manjaro detected."
echo "* Installing dependencies..."
sudo pacman --noconfirm -S gcc make cmake bison doxygen ruby \
sdl2 openal pixman libwebp bzip2 libvorbis libogg libsodium \
libpng libjpeg libtiff zeromq mm-common base-devel vim gtk2
echo "* Installing dependencies with pamac..."
sudo pamac install sdl2_image sdl2_ttf physfs boost boost-libs \
libsigc++ sdl_sound m4 meson freetype harfbuzz --no-confirm
fi

if [[ $(cat /etc/redhat-release) ]];
then
echo " * RedHat/Fedora Linux detected"
echo " * Installing dependencies..."
sudo dnf install vim gcc make cmake m4 bison doxygen ruby meson \
mm-common SDL2 SDL2-devel SDL2_image SDL2_tff SDL2_ttf-devel \
SDL2_image-devel bzip2-devel libwebp libwebp-devel libvorbis \
libvorbis-devel libpng libpng-devel libjpeg-turbo \
libjpeg-turbo-devel libogg libogg-devel libtiff libtiff-devel \
libsodium libsodium-devel zeromq zeromq-devel physfs physfs-devel \
pixman pixman-devel bzip2 openal-soft speex speex-devel libmodplug \
libmodplug-devel boost boost-devel openal-soft-devel xfconf \
xfconf-devel gtk3 gtk3-devel libsigc++-devel harfbuzz-devel
if [[ $(cat /etc/redhat-release) ]]; then
echo "* RedHat/Fedora Linux detected."
echo "* Installing dependencies..."
sudo dnf install gcc make m4 cmake bison doxygen ruby mm-common \
SDL2 SDL2-devel SDL2_image SDL2_tff SDL2_ttf-devel SDL2_image-devel \
bzip2-devel libwebp libwebp-devel libvorbis libvorbis-devel \
libpng libpng-devel libjpeg-turbo libjpeg-turbo-devel libogg \
libogg-devel libtiff libtiff-devel libsodium libsodium-devel \
zeromq zeromq-devel physfs physfs-devel pixman pixman-devel \
bzip2 openal-soft speex speex-devel libmodplug libmodplug-devel \
boost boost-devel openal-soft-devel xfconf xfconf-devel gtk2 gtk2-devel \
vim meson libsigc++-devel harfbuzz-devel
fi
fi

if [ $? -ne 0 ];
then
echo " * Finished with errors."
else
echo " * Done! All dependencies was installed."
fi
fi
10 changes: 5 additions & 5 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ zlib = dependency('zlib', static: build_static)
nsgif = dependency('libnsgif', static: build_static)

if host_system == 'windows'
bz2 = dependency('bzip2')
bz2 = dependency('bzip2')
iconv = compilers['cpp'].find_library('iconv')
else
bz2 = compilers['cpp'].find_library('bz2')
bz2 = compilers['cpp'].find_library('bz2')
iconv = compilers['cpp'].find_library('iconv')
gtk = dependency('gtk+-3.0')
xfconf = dependency('libxfconf-0')
gtk = dependency('gtk+-2.0')
xfconf = dependency('libxfconf-0')

global_dependencies += [gtk, xfconf]
endif

Expand Down Expand Up @@ -63,7 +64,6 @@ if host_system == 'windows'
global_dependencies += compilers['cpp'].find_library('winmm')
global_dependencies += compilers['cpp'].find_library('Secur32')
global_dependencies += compilers['cpp'].find_library('Shlwapi')
global_dependencies += compilers['cpp'].find_library('gdiplus')
endif

main_source = files(
Expand Down
8 changes: 0 additions & 8 deletions src/oneshot/headers/oneshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
#include "etc-internal.h"
#include <string>

#ifdef _WIN32
#include <windows.h>
#endif

struct OneshotPrivate;
struct RGSSThreadData;

Expand Down Expand Up @@ -64,7 +60,6 @@ class Oneshot
bool obscuredCleared() const;
bool allowExit() const;
bool exiting() const;
bool hasTrayIcon() const;

//Mutators
void setYesNo(const char *yes, const char *no);
Expand All @@ -75,9 +70,6 @@ class Oneshot

//Functions
bool msgbox(int type, const char *body, const char *title);
bool addNotifyIcon(const char* tip);
bool delNotifyIcon();
bool sendBalloon(const char* title, const char* info, const int iconId, const char* iconPath);
std::string textinput(const char* prompt, int char_limit, const char* fontName);

//Dirty flag for obscured texture
Expand Down
5 changes: 2 additions & 3 deletions src/oneshot/source/i18n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const int MAX_LANGUAGES = 20;
const int LANGCODE_SIZE = 16;
const int LANGFONT_SIZE = 128;

const char* defaultFont = "Terminus (TTF)";
char* currentLocale = 0;

struct LanguageFontAndSize {
Expand Down Expand Up @@ -117,7 +116,7 @@ void loadLanguageMetadata() {
FILE* fontSizesFile = fopen("Languages/internal/language_sizes.ini", "r");
if (fontSizesFile) {
while (fgets(line, 1024, fontSizesFile)) {
//int languageMetadataIndex = 0; // unused?
int languageMetadataIndex = 0;
char* indexOfEquals = strchr(line, '=');
if (indexOfEquals) {
// splitting the string in place here
Expand Down Expand Up @@ -168,7 +167,7 @@ char* getFontName() {
}

// default to terminus?
return (char *)defaultFont;
return "Terminus (TTF)";
}

void loadLocale(const char* locale) {
Expand Down
Loading

0 comments on commit 718e6d5

Please sign in to comment.