• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

[SOLVED] Working directory in android not useable when referenced

W

Wraithious

Guest
Hello, I've run into a roadblock with trying to pass a filepath from the included files in gamemaker 1.4 to my Android extension I've made, in windows passing working_directory to a variable works as expected, such as if i put
Code:
global.wrkdir=working_directory;
I get the expected file path:
Screenshot_windows.png
BUT if i run the exact same thing in android I get this result:
Screenshot_20171107-030129[1].png
This is not a valid path at all, so as @FrostyCat suggested I tried using program_directory instead, but that resulted completely blank, nothing there at all, and I tried using game_save_id and that was closer, it gave me the path to the folder where the game_save saves to,
Code:
/data/user/0/com.companyname.GM_Audio_Save/files
but I need the path to the included files in android, which in the gamemaker manual says working_directory is that path that I need, but it doesn't work! does anyone know what the actual path is in android? I tried many other things too like:
Code:
var str=game_save_id;str=string_replace(str,"files","assets///");global.wrkdir=str;
global.wrkdir=game_save_id;
I'm calling my extension in 2 ways for testing:
Code:
///Save audio from game to new folder
if canRec=1 SaveFromAs(global.wrkdir+"wildDubz.mp3",global.myFolder,"wildDubz.mp3",0);//get path from gms
//if canRec=1 SaveFromAs("wildDubz.mp3",global.myFolder,"wildDubz.mp3",2);//get path from java in extension
and I rooted one of my old phones but I still can't find the file path (or the file!! and I loaded it into gms in 3 places!! the assets/Files folder in the extension folder, included files, and imported it into the resource tree)

I also tried getting it in my extension with java that works in android studio but does not work in GMS, and I made sure i injected compileFiletree(dir: 'assets/Files') in my gradle dependencies
Code:
    public void SaveFromAs(String inputPath, String opp, String opn, double setToRing) {
        if(setToRing<2){
        File f = new File(inputPath);
        Log.i("yoyo", "got file: " + f.toString());
        String ext = (f.getAbsolutePath().substring(f.getAbsolutePath().lastIndexOf(".")));
        Log.i("yoyo", "folder is: " + opp);
        boolean istrue = false;
        if (f.exists()) istrue = true;
        Log.i("yoyo", "File exists: " + istrue);
        if(istrue){
        try {
            File dir = new File(opp);
            if (!dir.exists()) {
                dir.mkdirs();
            }
            InputStream in = new FileInputStream(f);
            OutputStream out = new FileOutputStream(opp + "/" + opn + ext);
            byte[] buffer = new byte[1024];
            int read;
            while ((read = in.read(buffer)) != -1) {
                out.write(buffer, 0, read);
            }
            in.close();
            in = null;
            out.flush();
            out.close();
            out = null;
            if(setToRing==0){
                OsUpdt(opp + "/" + opn + ext);
            }
            if(setToRing==1){
                ringFolder = (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES));
                if (!ringFolder.exists()) {
                    ringFolder.mkdirs();
                    Intent rint = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
                    rint.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_RINGTONE);
                    //rint.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Tone");
                    RunnerActivity.CurrentActivity.startActivityForResult(rint, 0);
                }
                String rfl = ringFolder.toString() + "/";
                msg = rfl + "/" + opn + ext;
                MakeRingtone();
            }
        } catch (FileNotFoundException fnfe1) {
            Log.e("tag", fnfe1.getMessage());
        } catch (Exception e) {
            Log.e("tag", e.getMessage());
        }
        }
        if(!istrue){
        Log.i("yoyo", "Couldn't find file");   
        }
        }
        if(setToRing==2) {
            AssetManager assetManager = RunnerActivity.CurrentActivity.getAssets();Log.i("yoyo", "Game file requested: " + inputPath);
            String[] files = null;
            try {
            files = assetManager.list("Files");Log.i("yoyo", "Looking for the file");
            }
        catch (Exception e) {
            Log.e("Tag", e.getMessage());
            }
            InputStream in = null;Log.i("yoyo", "Defining Input stream");
            OutputStream out = null;Log.i("yoyo", "Defining Output stream");
            try
            {
                in = assetManager.open("Files/" + inputPath);
                Log.i("yoyo", "Found the file, input stream created");
                out = new FileOutputStream(opp + "/" + opn);Log.i("yoyo", "Output stream created");
                copyFile(in, out);
                in.close();
                in = null;
                out.flush();
                out.close();
                out = null;
                OsUpdt(opp + "/" + opn);
                }
            catch(IOException e)
            {
            Log.i("yoyo", "Couldn't find file");
            Log.e("tag", "Failed to copy asset file: " + inputPath, e);
            }     
        }
    }
So can anyone help me out with what the android path to the included files actually is? and why is working_directory bugged when put in a variable in android??? Are there any other workarounds anyone can suggest?
 
W

Wraithious

Guest
This is the last thing I need to figure out to finish this extension,
please.. help.. meh.. haha
 
W

Wraithious

Guest
Sooo where does gamemaker put the assets folder on the android device when the game is built and installed? I really need to know because what should work in java to find the assets folder is not working, is the assets folder put in some other folder with some weird name or something? because this code right here should find any files in the assets/Files folder that I added in my extension and yet it is not, why? any yoyo devs can help me out with this?
Code:
if(setToRing==2) {
            AssetManager assetManager = RunnerActivity.CurrentActivity.getAssets();Log.i("yoyo", "Game file requested: " + inputPath);
            String[] files = null;
            try {
            files = assetManager.list("Files");Log.i("yoyo", "Looking for the file");
            }
        catch (Exception e) {
            Log.e("Tag", e.getMessage());
            }
            InputStream in = null;Log.i("yoyo", "Defining Input stream");
            OutputStream out = null;Log.i("yoyo", "Defining Output stream");
            try
            {
                in = assetManager.open("Files/" + inputPath);
                Log.i("yoyo", "Found the file, input stream created");
                out = new FileOutputStream(opp + "/" + opn);Log.i("yoyo", "Output stream created");
                copyFile(in, out);
                in.close();
                in = null;
                out.flush();
                out.close();
                out = null;
                OsUpdt(opp + "/" + opn);
                }
            catch(IOException e)
            {
            Log.i("yoyo", "Couldn't find file");
            Log.e("tag", "Failed to copy asset file: " + inputPath, e);
            }   
        }

    private void copyFile(InputStream in, OutputStream out) throws IOException
{
      byte[] buffer = new byte[1024];
      int read;
      while((read = in.read(buffer)) != -1)
      {
            out.write(buffer, 0, read);
      }
}
This is my filetree for the extension (I know it won't look like this when built in android, so what will it look like?)
Clipboard03.png
 
Last edited by a moderator:
Hey there,

EDIT: Apologies in advance if this does not help directly, I don't have experience with android extensions specifically, please ignore if you know the following already!

It's my understanding from the docs that working_directory is not as simple as returning a standard string. It's some kind of shortcut for a bit of underlying logic that is context sensitive, depending on if you are doing a read or write operation, and whether or not the file exists in your included files or not, as well as if the file exists in your working_directory or not....phew...long sentence there.

Anyway, when you are assigning the working_directory to a global variable, GMS will, *at that moment in time* do some sort of under-the-hood evaluation of what working_directory should be based on your usage of it.

Now, that global variable holds a non-changing value, however, that value may not be the same value you require when you go to load assets later on.

I haven't extensively tested this, so that's why I'm rambling on a bit and can't give a short and concise answer because I don't know exactly what goes on behind the scenes.

What I would suggest is not saving the working_directory value to a global variable, and instead, use the value working_directory as and when it is needed directly.

That will allow GMS to correctly work out if it needs to pull a file from your included files, or just load it from the local storage area if the file already exists.

Working_directory can actually return two different values depending on what you are using it for. If you are writing a file to disk, working_directory points to the area of local storage that is reserved for your game on the target device (in windows this is "%LOCALAPPDATA%/gamedir/" where the "gamedir" is the directory with the name of your game). However, when reading from disk, working_directory can be either the local storage or the area where the included files are stored.
 
W

Wraithious

Guest
What I would suggest is not saving the working_directory value to a global variable, and instead, use the value working_directory as and when it is needed directly.

That will allow GMS to correctly work out if it needs to pull a file from your included files, or just load it from the local storage area if the file already exists.
Hi thanks for the reply, I have tried both ways to get it to work (using working_directory directly and hard
coding it into a string variable) and also a 3rd way of using the actual java code that the native android language uses to do it all in the extension, and I know what you mean by the 2 working directiries, they are different as in one can only be read from (thats the one I need) and one can be written to or read. There doesn't seem to be any problem in windows because it returns a valid directory as a string, however in android it's a different story and nothing seems to work through my extension side or gms side, and I know the extension isn't breaking untill it tries to find the actual file, I put log entries in at the suspected points and it reports looking for the file, setting up the file in and file out, then reports it couldn't find the file, so the code flow makes it all the way through the method in my extension without the dreaded 'cant find method on extension class: null' error, and also doesnt silently fail at any point in the method so it's really really strange that it won't work on either end, theres also a note in the manual saying that what working_directory returns in different platforms is sometimes not what you would expect, which is definatly the case here in android. I don't know if you've messed around with android studio but there are specific folders that you put your assets in and i tried to coppy that format and failed. As well as putting my file in 3 different places in my pronect and also failed. Thats why Im wondering if theres some specific file tree format the included files get put in when GMS builds the final apk and how to find it.
 
W

Wraithious

Guest
No I haven't seen that before, I'll check that out! Thanks

I was looking at this stack overflow post earlier today and changed this part of my java code
Code:
AssetManager assetManager = RunnerActivity.CurrentActivity.getAssets();
to this
Code:
AssetManager assetManager = RunnerActivity.CurrentActivity.getResources().getAssets();
but still didn't work, I'm having a look now into your link, it may be a private directory issue, but that is promising because technically the file is in my app so I should be able to access it, I'll let you know if I make any progress.
 
Last edited by a moderator:
W

Wraithious

Guest
@IndianaBones Nope still no luck, here is the log output from the GMS runner
Code:
11-13 23:09:30.620 12597 12614 I yoyo    : Game file requested: wildDubz.mp3
11-13 23:09:30.620 12597 12614 I yoyo    : Defining Input stream
11-13 23:09:30.620 12597 12614 I yoyo    : Defining Output stream: /storage/emulated/0/GM Audio Save/wildDubz.mp3
11-13 23:09:30.637 12597 12614 I yoyo    : Couldn't find file
And here's the log output from the android studio runner, notice that it is successful on all accounts:
Code:
11-13 23:18:10.241 16358-16358/com.companyname.audiomanipulation I/yoyo: Game file requested: wildDubz.mp3
11-13 23:18:10.241 16358-16358/com.companyname.audiomanipulation I/yoyo : Defining Input stream
11-13 23:18:10.241 16358-16358/com.companyname.audiomanipulation I/yoyo : Defining Output stream
11-13 23:18:10.241 16358-16358/com.companyname.audiomanipulation I/yoyo : Found the file, input stream created
11-13 23:18:10.249 16358-16358/com.companyname.audiomanipulation I/yoyo : Output stream created
11-13 23:18:10.539 16358-16358/com.companyname.audiomanipulation I/yoyo : Checking new file to alert os-  /storage/emulated/0/Audio Manipulator/wildDubz.mp3
11-13 23:18:10.539 16358-16358/com.companyname.audiomanipulation I/yoyo : file exists: true
11-13 23:18:10.542 16358-16358/com.companyname.audiomanipulation I/yoyo : File ready to send- /storage/emulated/0/Audio Manipulator/wildDubz.mp3
11-13 23:18:10.547 16358-16358/com.companyname.audiomanipulation I/yoyo : Updated sucessfully! /storage/emulated/0/Audio Manipulator/wildDubz.mp3
so I'm at a total loss as to why it won't work

something interesting to note is I just changed one of the log statements to show me the string value of the input stream in android studio to see what it returns and this was the result:
Code:
11-13 23:37:50.893 7508-7508/com.companyname.audiomanipulation I/yoyo: Found the file, input stream created: android.content.res.AssetManager$AssetInputStream@b6a5a3a
 
Last edited by a moderator:

rwkay

GameMaker Staff
GameMaker Dev.
On Android included files are included inside the APK file itself

you should be able to use file_copy to move them to the save area if you need access to them... Not sure what you are trying to do

Russell
 
W

Wraithious

Guest
Ok thanks, so basically the inuded files get bundled in with the resulting jar file then? That makes sense why I can't access them then. What I'm doing is making an android extension that lets the player or developer copy audio files to the public storage directory so the player can play the audio outside of the game if they want to. also the extension can record from mic and save to a player accessable file in wav or mp3, or even raw so the developer can do what they want with the audio with buffers or whatever they want, also set any chosen audio as ringtone, and copy audio from users device to the game folder, all of that works perfect, just having the problem with saving included file audio to external storage.
Thanks for your advice I will try the copy file method, I was thinking that would only work for text and images so I'm glad to hear that and will try it, thanks!
 
W

Wraithious

Guest
@rwkay ok, your suggestion seems promising as it can get the file into game memory, but it's only option is to change the name of the file. I actually need to feed this file to my extension so it can be saved in a user accessible folder. so what I'm thinking is while this file is in memory using file_copy, how can I feed it into my android extension? can I load it into a buffer and feed it to my extension somehow? Also in windows there is the get_save_filename but this isn't available in android (but my extension handles that, if it could get the file from the included files. (it has no problem copying files from the user's device to any other folder I want to put it in on the user's device) ) other than that there are no functions available to save anything other than text, image, game saves and buffers in gms so I'm at a catch 22 here.
While I was in the file handling section of the manual I came accross filename_path and filename_dir but they didn't help either.

This is what I tried:
left pressed event:
Code:
var str=game_save_id;
str="/"+string_replace(str,"files","assets/");
global.wrkdir=str;
file_copy("wildDubz.mp3","wildDubz.mp3");
if canRec=1 SaveFromAs(global.wrkdir+"wildDubz.mp3",global.myFolder,"wildDubz",0);
SaveFromAs relavent code in my extension
Code:
    public void SaveFromAs(String inputPath, String opp, String opn, double setToRing) {

        if(setToRing<2){
        File f = new File(inputPath);
        Log.i("yoyo", "got file: " + f.toString());
        String ext = (f.getAbsolutePath().substring(f.getAbsolutePath().lastIndexOf(".")));
        Log.i("yoyo", "Output folder is: " + opp);
        boolean istrue = false;
        if (f.exists()) istrue = true;
        Log.i("yoyo", "File exists: " + istrue);
        if(istrue){
        try {
            File dir = new File(opp);
            if (!dir.exists()) {
                dir.mkdirs();
            }
            InputStream in = new FileInputStream(f);
            OutputStream out = new FileOutputStream(opp + "/" + opn + ext);
            copyFile(in, out);
            in.close();
            in = null;
            out.flush();
            out.close();
            out = null;
            if(setToRing==0){
                OsUpdt(opp + "/" + opn + ext);
            }
//.......
 catch (FileNotFoundException fnfe1) {
            Log.e("tag", fnfe1.getMessage());
        } catch (Exception e) {
            Log.e("tag", e.getMessage());
            }
        }

    private void copyFile(InputStream in, OutputStream out) throws IOException
{
      byte[] buffer = new byte[1024];
      int read;
      while((read = in.read(buffer)) != -1)
      {
            out.write(buffer, 0, read);
      }
}
log output:
Code:
11-14 23:36:53.977 10129 10189 I yoyo    : got file: /data/user/0/com.companyname.GM_Audio_Save/assets/wildDubz.mp3
11-14 23:36:53.979 10129 10189 I yoyo    : Output folder is: /storage/emulated/0/GM Audio Save
11-14 23:36:53.980 10129 10189 I yoyo    : File exists: false
11-14 23:36:53.980 10129 10189 I yoyo    : Couldn't find file
 
Last edited by a moderator:
W

Wraithious

Guest
OOooo it's getting soooo close!!!! so now I got it to find the file from included files, send the buffer, and save it to a user accessable folder BUT it saves the file as 1kb in size, So currently I have created a buffer with an audio file in it using gamemaker studio side like so:
Code:
var fileTotransfer = file_copy("wildDubz.mp3","wildDubz.mp3"); //finds and copies the file into a variable
var gameTransfer = buffer_create(1024,buffer_grow,1);           //create the buffer
buffer_write(gameTransfer,buffer_s16,fileTotransfer);
var buffsize = buffer_get_size(gameTransfer);                   //get the buffer size
var buffaddress = buffer_get_address(gameTransfer);             //get the buffer memory address
SaveFromAs(buffaddress,global.myFolder,"wildDubz.mp3",buffsize);// send the memory address and buffer size to java class
buffer_delete(gameTransfer);
and my method in my java class:
Code:
public void SaveFromAs(String inputPath, String opp, String opn, double setToRing) {
            int numOfBytes = (int)setToRing;
            Log.i("yoyo", "Buffer path: " + inputPath);
            Log.i("yoyo", "Buffer size: " + String.valueOf(numOfBytes));
            try
            {
                mf = new MemoryFile(inputPath, numOfBytes);
                InputStream in = null;
                OutputStream out = null;
                in = mf.getInputStream();
                Log.i("yoyo", "Found the file, input stream created: " + String.valueOf(in));
                out = new FileOutputStream(opp + "/" + opn);Log.i("yoyo", "Output stream created");
                copyFile(in, out);
                in.close();
                in = null;
                out.flush();
                out.close();
                out = null;
                OsUpdt(opp + "/" + opn);
            }
            catch(IOException e)
            {
                Log.i("yoyo", "Couldn't find file");
                Log.e("tag", "Failed to copy asset file: " + inputPath, e);
            }
      }
}
and my copy file method:
Code:
    private void copyFile(InputStream in, OutputStream out) throws IOException {
      byte[] buffer = new byte[1024];
      int read;
      while((read = in.read(buffer)) != -1)
          {
          out.write(buffer, 0, read);
          }
    }
My log output:
Code:
11-15 23:40:29.320 18521 18590 I yoyo    : Buffer path:
11-15 23:40:29.320 18521 18590 I yoyo    : Buffer size: 1024
11-15 23:40:29.326 18521 18590 I yoyo    : Found the file, input stream created: android.os.MemoryFile$MemoryInputStream@1bac19b
11-15 23:40:29.328 18521 18590 I yoyo    : Output stream created
11-15 23:40:29.328 18521 18590 I yoyo    : Checking new file to alert os- /storage/emulated/0/GM Audio Save/wildDubz.mp3
11-15 23:40:29.328 18521 18590 I yoyo    : file exists: true
11-15 23:40:29.330 18521 18590 I yoyo    : File ready to send- /storage/emulated/0/GM Audio Save/wildDubz.mp3
11-15 23:40:29.331 18521 18590 I yoyo    : The file /storage/emulated/0/GM Audio Save/wildDubz.mp3 was updated sucessfully!
Can anyone tell me if I've done something wrong loading the buffer on the GMS side? should I not delete the buffer right away?
Or is it something on the extension side like maybe byte[] buffer = new byte[1024]; should actually be the buffer size and not 1024? in either case 1024 suspiciously looks like the equivolent of 1 killobyte....
hmm, exactly 1024 bytes...
wd1kb.png
I'm tired I've been working on this for days, please advise what I might be doing wrong thanks!
 
Last edited by a moderator:

rwkay

GameMaker Staff
GameMaker Dev.
The file_copy copies the file from one to another so it should have copied the file to the save area on the Android device (not into a variable).

if you wanted to do it yourself then you could buffer_load the file into memory and buffer_save it onto the Android save area...

Russell
 
W

Wraithious

Guest
Thanks, I'm definatly re thinking on how I'm creating the buffer, the way it is above isnt loading anything into the buffer maybe because I have no for loop there to get each byte from the file into the buffer resulting in an empty buffer of length 1024, so since I dont need to do anything to the file except read it's bytes into a buffer I'm going to try the file_bin functions to get and load the bytes and get the size and address from there and see how that goes. I was looking at audio buffers as well but they only accept raw wav data to fill them so hopefully filling a buffer_grow with each byte via file_bin_read with a loop will work.
 
W

Wraithious

Guest
@rwkay So I managed to get that to work using the file_bin functions, BUT it only works when pressing the run button to run the game, if I compile and final build the game, it does not work saying there's no file (gms side trying to open it with file_bin_open), if i don't check if the file exists it crashes saying file not opened, so I put a check for if file exists and if it doesn't then I put a show_debug_message and get this: (not working)
Code:
11-16 16:44:38.191  2027  2075 I yoyo    : file_open_bin has failed to open the file
This is my current code:
Code:
file_copy("wildDubz.mp3","wildDubz.mp3");
var fname = "wildDubz.mp3";
if(canRec=1 && file_exists(fname))
{gameTransfer = buffer_create(1024, buffer_grow, 1);
var file = file_bin_open("wildDubz.mp3",0);
var size = file_bin_size(file);
for(var i=0;i<size;i+=1;)
{buffer_write(gameTransfer,buffer_s16,file_bin_seek(file,i));
}
var buffaddress = buffer_get_address(gameTransfer);
SaveFromAs(buffaddress,global.myFolder,"wildDubz.mp3",size);
file_bin_close(file);
}
if !file_exists(fname) show_debug_message("file_open_bin has failed to open the file");
And this is my log output when I only press run game and not final build the apk: (working)
Code:
11-16 18:07:19.757 19722 19757 I yoyo    : Buffer path:
11-16 18:07:19.757 19722 19757 I yoyo    : Buffer size: 11214551
11-16 18:07:19.767 19722 19757 I yoyo    : Found the file, input stream created: android.os.MemoryFile$MemoryInputStream@7ce57e9
11-16 18:07:19.769 19722 19757 I yoyo    : Output stream created
11-16 18:07:19.946 19722 19757 I yoyo    : Checking new file to alert os- /storage/emulated/0/GM Audio Save/wildDubz.mp3
11-16 18:07:19.947 19722 19757 I yoyo    : file exists: true
11-16 18:07:19.949 19722 19757 I yoyo    : File ready to send- /storage/emulated/0/GM Audio Save/wildDubz.mp3
11-16 18:07:19.949 19722 19757 I yoyo    : The file /storage/emulated/0/GM Audio Save/wildDubz.mp3 was updated sucessfully!
11-16 18:07:19.950 19722 19757 I yoyo    : Sent social async event to GM:S, Type: buff_finished, Value:
11-16 18:07:19.952 19722 19757 I yoyo    : temporary buffer deleted
The file is put in the folder I told it, and also in the gmStudio folder of course. (altho the copied file in the folder I put it in does not play, while the file put in gmstudio folder with the copy_file function does)
So the manual tells me if no file exists then file_open_bin creates the file, which would be useless in my case but even so, it doesn't create the file, so what is going on here? why is file_open_bin broken on final compile of the apk?

EDIT:
I forgot to mention the exact same thing happens when using buffer_load, works on run project, does not work on build final apk reporting it can't find the file,
there is one difference tho, this time both files saved in the run scenario do not play.
Code:
file_copy("wildDubz.mp3","wildDubz.mp3");
var fname = "wildDubz.mp3";
if(canRec=1 && file_exists(fname))
{gameTransfer = buffer_create(1024, buffer_grow, 1);
gameTransfer = buffer_load(fname);
var size = buffer_get_size(gameTransfer);
var buffaddress = buffer_get_address(gameTransfer);
SaveFromAs(buffaddress,global.myFolder,"wildDubz.mp3",size);
}
if !file_exists(fname) show_debug_message("file_open_bin has failed to open the file");
results from both folders buffer_load way (both unuseable):
wd1kb2.png
and with file bin way, in gmstudio folder(the gms save area in android) (usable):
wd1kb3.png
my public folder is the same result as the load_buffer way, unuseable file
 
Last edited by a moderator:
W

Wraithious

Guest
So I figured it out, 99% anyway, GMS' file handling functions do not work with .mp3 files!! so I converted it to an .ogg and I got it to work but the resulting file is not playable, the file is all there right down to the last byte, but always reports the track length is 00:00:00, same deal with .wav files, really weird, I'm going to post a new topic about it in programming because maybe it's a problem with how I create the buffer, I'm not too good with buffers and alignments but my reasoning was if I made a u16 buffer with a 1 alignment it would just copy the file byte for byte and not change anything, but I'm guessing the meta data somehow gets lost (doubtful because every single byte is accounted for) or that maybe I have to use an alignment of 2 or 4 to account for mono or stereo but I really have no idea.
The final code block that made it work if anyone's interested was:
Code:
fname = "wildDubz.ogg";
if(file_exists(fname))
{file = file_bin_open(fname,0);
size = file_bin_size(file);
gameTransfer = buffer_create(1024, buffer_grow, 1);
for(var i=0;i<size;i+=1;){buffer_write(gameTransfer,buffer_s16,file_bin_seek(file,i));}
var buffaddress = buffer_get_address(gameTransfer);
SaveFromAs(buffaddress,global.myFolder,"wildDubz.ogg",size);
file_bin_close(file);}
if !file_exists(fname) show_debug_message("file_open_bin has failed to open the file");
But note that only files recognized by gms will work.
 

GMWolf

aka fel666
Rather than using the bin file finctfunc, why not just load the buffer directly?
It would remove one possible source of errors.
(Sorry if I missed something from earlier posts when skimming through this).
 
W

Wraithious

Guest
Rather than using the bin file finctfunc, why not just load the buffer directly?
It would remove one possible source of errors.
(Sorry if I missed something from earlier posts when skimming through this).
I ended up solving it thanks to the help in this topic, I had to encode and decode using a base 64 buffer to preserve the integrity of the files
 
Top