Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ addons/*
dev-libs/
*.sum
.vs/
.env
3 changes: 2 additions & 1 deletion assets/data/config/menuItems.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
story mode
freeplay
options
credits
credits
gamejolt
Binary file added assets/images/menus/gamejolt-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions building/libs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<lib name="funkin-modchart" skipDeps="true" />
<lib name="hxvlc" version="1.9.3" skipDeps="true" />
<lib name="hxWebSockets" />
<git name="crypto" url="https://github.com/HaxeFoundation/crypto" ref="9959143" />

<!-- Documentation and other features -->
<git name="away3d" url="https://github.com/CodenameCrew/away3d" />
Expand Down
4 changes: 4 additions & 0 deletions project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
<!-- Comment this out to disable GitHub API integration !-->
<define name="GITHUB_API" unless="web || hl"/>

<!-- Comment this out to disable GameJolt API integration !-->
<define name="GAMEJOLT_API" if="GITHUB_API"/>

Comment on lines +69 to +71

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may also be a good idea to additionally constrain GAMEJOLT_API against STRIPPED_COMPILE so that it gets disabled, as not everyone may want to immediately compile support for the Game API in, such as when working on a pull request.

<define name="GAMEJOLT_API" if="GITHUB_API" unless="STRIPPED_COMPILE"/>

<!-- Comment this out to prevent unused classes from being compiled.
Reduces compilation time at the cost of limited HScript flexibility. !-->
<define name="COMPILE_ALL_CLASSES" unless="STRIPPED_COMPILE" />
Expand Down Expand Up @@ -131,6 +134,7 @@
<haxelib name="flixel-addons" />

<haxelib name="hxWebSockets" />
<haxelib name="crypto" />

<haxelib name="hxvlc" if="VIDEO_CUTSCENES" />
<haxelib name="away3d" if="THREE_D_SUPPORT" />
Expand Down
11 changes: 10 additions & 1 deletion source/funkin/backend/assets/ModsFolder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package funkin.backend.assets;
import flixel.util.FlxSignal.FlxTypedSignal;
import funkin.backend.system.MainState;
import funkin.backend.utils.CoolUtil;
import funkin.backend.utils.GJUtil;
import haxe.ds.StringMap;
import haxe.io.Path;
import lime.text.Font;
Expand Down Expand Up @@ -75,9 +76,17 @@ class ModsFolder {
}

public static function reloadMods() {
if (!__firstTime)
if (!__firstTime) {
#if GAMEJOLT_API
if (GJUtil.active)
GJUtil.logout();
#end

FlxG.switchState(new MainState());
}
__firstTime = false;


}

/**
Expand Down
6 changes: 6 additions & 0 deletions source/funkin/backend/system/Flags.hx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Flags {
public static var MOD_NAME:String = "";
public static var MOD_DESCRIPTION:String = "";
public static var MOD_AUTHOR:String = "";
public static var MOD_VERSION:String = "";
@:lazy public static var MOD_API_VERSION:Null<Int> = null;
public static var MOD_DOWNLOAD_LINK:String = "";
public static var MOD_DEPENDENCIES:Array<String> = [];
Expand All @@ -43,6 +44,11 @@ class Flags {

public static var MOD_REDIRECT_STATES:Map<String, String> = [];

@:also(funkin.backend.system.gamejolt.GameJoltSecurity.gameId)
public static var MOD_GAMEJOLT_GAME_ID:String = '';
@:also(funkin.backend.system.gamejolt.GameJoltSecurity.encryptedGameToken)
public static var MOD_GAMEJOLT_ENCRYPTED_TOKEN:String = '';

// -- Codename's Default Flags --
@:lazy public static var SAVE_PATH:String = haxe.macro.Compiler.getDefine("SAVE_PATH");
@:lazy public static var SAVE_NAME:String = haxe.macro.Compiler.getDefine("SAVE_NAME");
Expand Down
8 changes: 7 additions & 1 deletion source/funkin/backend/system/MainState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import funkin.backend.assets.ModsFolderLibrary;
import funkin.backend.assets.ZipFolderLibrary;
import funkin.backend.chart.EventsData;
import funkin.backend.system.framerate.Framerate;
import funkin.backend.utils.GJUtil;
import funkin.editors.ModConfigWarning;
import funkin.menus.TitleState;
import funkin.menus.gamejolt.GameJoltCompleteScreen;
import haxe.io.Path;


Expand Down Expand Up @@ -162,7 +164,11 @@ class MainState extends FlxState {
if (cast(lib, ZipFolderLibrary).PRELOAD_VIDEOS) cast(lib, ZipFolderLibrary).precacheVideos();
}

var startState:Class<FlxState> = Flags.DISABLE_WARNING_SCREEN ? TitleState : funkin.menus.WarningState;
#if GAMEJOLT_API
GJUtil.init();
#end

var startState:Class<FlxState> = /**GameJoltData.freshStart ?**/ GameJoltCompleteScreen /**: (Flags.DISABLE_WARNING_SCREEN ? TitleState : funkin.menus.WarningState)**/;

// In this case if the mod we just loaded a compressed modpack, we can't edit or modify files without decompressing it.
if (Options.devMode && Options.allowConfigWarning && !isZipMod) {
Expand Down
Loading