Skip to content

Commit

Permalink
might've been cooked idk not tested
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 committed Dec 31, 2024
1 parent 7548c67 commit 30d8146
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 11 deletions.
5 changes: 4 additions & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@
<assets path='art/readme.txt' rename='do NOT readme.txt' unless="mobile" />

<section if="android">
<assets path='art/ffmpeg-android/arm64/ffmpeg' rename="ffmpeg" />
<assets path='art/ffmpeg-android/ffmpeg-armv7a' rename="ffmpeg-armv7a" />
<assets path='art/ffmpeg-android/ffmpeg-arm64' rename="ffmpeg-arm64" />
<assets path='art/ffmpeg-android/ffmpeg-x86' rename="ffmpeg-x86" />
<assets path='art/ffmpeg-android/ffmpeg-x86_64' rename="ffmpeg-x86_64" />
</section>

<assets path="assets/fonts" />
Expand Down
Binary file removed art/ffmpeg-android/arm64/ffmpeg
Binary file not shown.
Binary file added art/ffmpeg-android/ffmpeg-arm64
Binary file not shown.
Binary file added art/ffmpeg-android/ffmpeg-armv7a
Binary file not shown.
Binary file added art/ffmpeg-android/ffmpeg-x86
Binary file not shown.
Binary file added art/ffmpeg-android/ffmpeg-x86_64
Binary file not shown.
7 changes: 0 additions & 7 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6764,9 +6764,6 @@ class PlayState extends MusicBeatState

ffmpegExists = true;

#if android
lime.system.JNI.createStaticMethod('org/libsdl/app/SDLActivity', 'nativeSetenv', '(Ljava/lang/String;Ljava/lang/String;)V')("LD_LIBRARY_PATH", android.content.Context.getFilesDir());
#end
process = new Process(#if android '${android.content.Context.getFilesDir()}/ffmpeg' #else 'ffmpeg' #end, [
'-v',
'quiet',
Expand Down Expand Up @@ -6806,10 +6803,6 @@ class PlayState extends MusicBeatState
if (!ClientPrefs.ffmpegMode)
return;

#if android
lime.system.JNI.createStaticMethod('org/libsdl/app/SDLActivity', 'nativeSetenv', '(Ljava/lang/String;Ljava/lang/String;)V')("LD_LIBRARY_PATH", '');
#end

if (process != null){
if (process.stdin != null)
process.stdin.close();
Expand Down
31 changes: 30 additions & 1 deletion source/mobile/CopyState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ import sys.FileSystem;

using StringTools;

#if (android && cpp)
@:headerInclude('sys/utsname.h')
#end
class CopyState extends MusicBeatState
{
public static var locatedFiles:Array<String> = [];
Expand All @@ -56,6 +59,9 @@ class CopyState extends MusicBeatState
var failedFilesStack:Array<String> = [];
var canUpdate:Bool = true;
var shouldCopy:Bool = false;
#if android
var archPrefix:String = "";
#end

private static final textFilesExtensions:Array<String> = ['ini', 'txt', 'xml', 'hxs', 'hx', 'lua', 'json', 'frag', 'vert'];

Expand All @@ -73,9 +79,21 @@ class CopyState extends MusicBeatState
CoolUtil.showPopUp("Seems like you have some missing files that are necessary to run the game\nPress OK to begin the copy process", "Notice!");

#if android
switch (getArch().toLowerCase())
{
case "armv7" | "armv7l" | "armv8l":
archPrefix = "armv7a";
case "arm64" | "aarch64" | "armv8" | :
archPrefix = "aarch64";
case "x86" | "i386" | "i686":
archPrefix = "x86";
case "x86_64" | "amd64":
archPrefix = "x86_64";
}

if (!FileSystem.exists(android.content.Context.getFilesDir() + '/ffmpeg'))
{
File.saveBytes(android.content.Context.getFilesDir() + '/ffmpeg', getFileBytes(getFile('ffmpeg')));
File.saveBytes(android.content.Context.getFilesDir() + '/ffmpeg-$archPrefix', getFileBytes(getFile('ffmpeg')));
Sys.command('chmod', ['777', android.content.Context.getFilesDir() + '/ffmpeg']);
}
#end
Expand Down Expand Up @@ -238,5 +256,16 @@ class CopyState extends MusicBeatState

return (maxLoopTimes < 0);
}

#if (android && cpp)
@:functionCode('
struct utsname osInfo{};
uname(&osInfo);
return ::String(osInfo.machine);
')
@:noCompletion
private function getArch():String
return null;
#end
}
#end
2 changes: 1 addition & 1 deletion source/options/GameRendererSettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class GameRendererSettingsSubState extends BaseOptionsMenu
'vidEncoder',
'string',
'libx264',
['libx264', 'libx264rgb', 'libx265', 'libxvid', 'libsvtav1', 'mpeg2video']);
['libx264', 'libx264rgb' #if !android , 'libx265', 'libxvid', 'libsvtav1' #end, 'mpeg2video']);
addOption(option);

var option:Option = new Option('Classic Rendering Mode', //Name
Expand Down
2 changes: 1 addition & 1 deletion source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OptionsState extends MusicBeatState
var konamiIndex:Int = 0; // Track the progress in the Konami code sequence
var konamiCode = [];
var isEnteringKonamiCode:Bool = false;
var options:Array<String> = ['Note Colors', 'Controls', 'Adjust Delay and Combo', 'Graphics', 'Optimization', 'Game Rendering', 'Visuals and UI', 'Gameplay', 'Misc', 'Mobile Options'];
var options:Array<String> = ['Note Colors', 'Controls', 'Adjust Delay and Combo', 'Graphics', 'Optimization' #if (desktop && android), 'Game Rendering' #end, 'Visuals and UI', 'Gameplay', 'Misc', 'Mobile Options'];
private var grpOptions:FlxTypedGroup<Alphabet>;
private static var curSelected:Int = 0;
public static var menuBG:FlxSprite;
Expand Down

0 comments on commit 30d8146

Please sign in to comment.