Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
@ericoporto
ericoporto / emscripten-ags-hack.txt
Created August 9, 2025 23:52
hack to download tap test from emscripten builds
filePath = '/home/web_user/saved_games/ags3-auto-test/agstest.tap'
fileContent = FS.readFile(filePath, { encoding: 'binary' })
blob1 = new Blob([fileContent], { type: 'text/plain' });
downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(blob1);
downloadLink.download = 'agstest.tap';
document.body.appendChild(downloadLink);
downloadLink.click();
@ericoporto
ericoporto / fix_mp3_encode.sh
Last active August 11, 2025 01:56
Helpful scripts made to help to condition mp3 files to my old car mp3 player
for f in *.mp3; do
ffmpeg -hide_banner -loglevel error -i "$f" -vn -ar 44100 -ac 2 -sample_fmt s16 -b:a 320k -f mp3 "reencoded_$f"
done
@ericoporto
ericoporto / from3to4.md
Last active June 26, 2025 14:02
SKETCH Small guide on how to upgrade your existing game project to AGS 4.

Small guide on how to upgrade your existing game project to AGS 4.

Warnings

There are a few things that cannot be upgraded at the current time, so we need to warn you about it.

  1. AGSJoy plugin: Attempts to build your game with this plugin active will not compile with AGS 4 because its Joystick struct will conflict with the AGS own Joystick struct. The solution is to either disable the newest script API level (by lowering it to v3.6.1, but that will also disable anything else), or adjust the code to work with the new Joystick API. The API is relatively simple, so upgrading should not be a huge problem. The plugin is no longer needed after that.

  2. Speech Center and Translations: Speech Center with translations will stop working with this AGS 4 update. It won't crash, but it won't see translated strings. This is because Translation storage had changed in the Editor. The plugin will have to be updated to work with AGS 4.

@ericoporto
ericoporto / cleantrailspace.py
Created October 22, 2024 02:14
Python script to clean trailing whitespace, preserving individual line endings
import os
import argparse
import chardet
def is_text_file(filename, chunk_size=1024):
"""Check if the file is likely a text file by reading a small chunk."""
try:
with open(filename, 'rb') as f:
chunk = f.read(chunk_size)
# Use chardet to detect encoding and ensure it's text-like
@ericoporto
ericoporto / glob_match.cc
Created July 20, 2024 14:10 — forked from alco/glob_match.cc
A translation of Python's fnmatch function into C++
#include <string>
#include "regex.h"
/*
* Return a new string with all occurrences of 'from' replaced with 'to'
*/
std::string replace_all(const std::string &str, const char *from, const char *to)
{
std::string result(str);
.\test\runner browser.test_sdl2_mixer_music_mp3
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 19864]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']
Running the browser tests. Make sure the browser allows popups from localhost.
@ericoporto
ericoporto / error_log.txt
Created February 25, 2024 17:26
fail to run sdl2_mixer test
.\test\runner browser.test_sdl2_*
Test suites:
['test_browser']
Running test_browser: (48 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 17704]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']
Running the browser tests. Make sure the browser allows popups from localhost.
.\test\runner browser.test_sdl2_*
Test suites:
['test_browser']
Running test_browser: (48 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 6876]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']
Running the browser tests. Make sure the browser allows popups from localhost.
@ericoporto
ericoporto / dav1dmsys2error.log
Last active September 30, 2023 16:17
dav1d error in msys2
[82/107] Compiling C object tests/checkasm.exe.p/checkasm_checkasm.c.obj
FAILED: tests/checkasm.exe.p/checkasm_checkasm.c.obj
"cc" "-Itests/checkasm.exe.p" "-Itests" "-I../tests" "-I." "-I.." "-Iinclude/dav1d" "-I../include/dav1d" "-Iinclude" "-I../include" "-fdiagnostics-color=always" "-DNDEBUG" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wextra" "-std=c99" "-O3" "-fvisibility=hidden" "-Wundef" "-Werror=vla" "-Wno-maybe-uninitialized" "-Wno-missing-field-initializers" "-Wno-unused-parameter" "-Wstrict-prototypes" "-Werror=missing-prototypes" "-fomit-frame-pointer" "-ffast-math" -MD -MQ tests/checkasm.exe.p/checkasm_checkasm.c.obj -MF "tests/checkasm.exe.p/checkasm_checkasm.c.obj.d" -o tests/checkasm.exe.p/checkasm_checkasm.c.obj "-c" ../tests/checkasm/checkasm.c
../tests/checkasm/checkasm.c: In function ΓÇÿsignal_handlerΓÇÖ:
../tests/checkasm/checkasm.c:504:29: error: variable ΓÇÿdefault_saΓÇÖ has initializer but incomplete type
504 | static const struct sigaction default_sa = { .sa_handler
@ericoporto
ericoporto / issue_sketch.md
Created September 29, 2023 21:25
issues sketch

Describe the problem

The Dialog Scripts are great for writing dialog lines. But sometimes one wants to handle the logic of which dialog to run from elsewhere, like a Room Script. For a character that only exists in a room, or for a particular scene, it's useful to hold all dialogs in the same dialog script, so one doesn't have to open many different dialog scripts.


Suggested change

If possible to either add a parameter in dialog start or create a new dialog.Run(int x).