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/
source/funkin/backend/utils/GameJoltSecurity.hx
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 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.utils.GameJoltSecurity.gameId)
public static var MOD_GAMEJOLT_GAME_ID:String = '';
@:also(funkin.backend.utils.GameJoltSecurity.encryptedGameToken)
public static var MOD_GAMEJOLT_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: 8 additions & 0 deletions source/funkin/backend/system/MainState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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 haxe.io.Path;
Expand Down Expand Up @@ -162,6 +163,13 @@ class MainState extends FlxState {
if (cast(lib, ZipFolderLibrary).PRELOAD_VIDEOS) cast(lib, ZipFolderLibrary).precacheVideos();
}

#if GAMEJOLT_API
if (FlxG.save.data.gameJoltArray != null) {
var gjDat:Array<String> = FlxG.save.data.gameJoltArray;
GJUtil.attemptLogin(gjDat[0], gjDat[1]);
}
#end

var startState:Class<FlxState> = 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.
Expand Down
Loading