Files
Microtransactions64/src/s2d_engine
Matt Pharoah febcb71ea3 Added emulator detection (#651)
* Added emulator detection

* Fixed missing assignments

* Disable interrupts around the count factor test

* Added more comments to emutest

* Changed PJ64 enum values so the versions work as a bitfield

* Updated README

* Fixed comments

* Updated enum values so you can safely AND and OR all emulator version flags together

* Remove redundant gIsConsole, gIsVC, and gCacheEmulated global variables

* Changed console check to be more future proof against Ares

* Use assembly file instead of casting to a function pointer

* Moved round_double_to_float back to its own compilation unit

* Moved the ParallelN64 check before the Ares check for better future-proofing

* Align pj64_get_count_factor_asm with cache lines... not that it actually matters for pj64

* Adjusted some comments

* Made emulator check thread-safe on emulators that emulate PI timings

* Added gIsConsole macro for backwards compatibility

* Added cen64 to INSTANT_INPUT_BLACKLIST

* Updated comment
2023-08-28 18:03:26 -04:00
..
2023-08-28 18:03:26 -04:00

S2DEX Text Engine

How to "Install"

  • Clone this repo into a folder in your SM64 decomp or homebrew repo
  • Include that folder in your makefile's SRC_DIRS
  • Add that folder to the linker script (sm64.ld) or specfile
  • Wherever you're including your font (I use actors/group0.c for SM64), insert:
#include "src/s2d_engine/config.h"
#include FONT_C_FILE
  • You're ready to use S2DEX Text Engine!

Simple Usage (Sample Program)

#include "s2d_engine/init.h"
#include "s2d_engine/s2d_draw.h"
#include "s2d_engine/s2d_print.h"

char myString[] = "This is a " SCALE "200" "test string!\n"
                "Supports a bunch of standard " ROTATE "-36" "escape characters!\n"
                "\tIncluding " COLOR "255 0 0 0" "Colorful text!\n"
                COLOR "255 255 255 0" DROPSHADOW "And look at these shadows!";

// ...
void render_game(void) {
	// do game rendering and stuff
	// ...

	// initialized S2DEX; only needed once before all prints
	s2d_init();

	// Allows you to print from anywhere in the game
	// as long as this is run directly afterwards
	s2d_handle_deferred();

	// reloads the original microcode; only needed once after all prints
	s2d_stop();
}

void some_actor_function(void) {
	s2d_print_deferred(50, 50, myString); // It's that easy!
}

Command Usage

(All numbers must be in base 10)

  • SCALE "N" - Scales text by an percentage (25 for 25%, 200 for 200%, -50 for upside down at 50%, etc.)
  • TRANSLATE "X Y" - Moves the rest of the string to the specified X and Y position
  • COLOR "R G B A" - Sets the text color to the specified value
  • DROPSHADOW - Toggles a drop shadow that shares the color of the current text
  • ROTATE "N" - (Deprecated due to plugin incompatibility) Rotates each glyph by N degrees (Can be negative, useful for italics)