Open PanoptesDreams opened 1 year ago
@PanoptesDreams what do you mean by "opening the application by dropping file onto the binary file" ?
I mean, I'm not surprised that an OS designed for Video Games would have some wacky features like that.
OMEGALUL
Question: Does it also render "Drag&Drop Music Here" way smaller when you open it like that. (Also it does not play the music file you dragged onto it, you have to drag it over the application window, to get the alternative visuals).
Furthermore the window icon is not set. Look here Linux Users, Windows can open an App that has an icon in a specific way to get it to not show it and we get an alternative visualisation, how is that for customisability?
My hypothesis is that something is wrong with the current working directly. This is the behavior that you get when musializer can't find shaders and fonts. Maybe we should bake them into the executable so the cwd does not matter?
Opened in cmd shell:
INFO: FILEIO: [./resources/logo/logo-256.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (256x256 | R8G8B8A8 | 1 mipmaps)
INFO: Initializing raylib 4.5
INFO: Supported raylib modules:
INFO: > rcore:..... loaded (mandatory)
INFO: > rlgl:...... loaded (mandatory)
INFO: > rshapes:... loaded (optional)
INFO: > rtextures:. loaded (optional)
INFO: > rtext:..... loaded (optional)
INFO: > rmodels:... loaded (optional)
INFO: > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO: > Display size: 1920 x 1080
INFO: > Screen size: 960 x 540
INFO: > Render size: 960 x 540
INFO: > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 239
INFO: GL: OpenGL device information:
INFO: > Vendor: Intel
INFO: > Renderer: Intel(R) UHD Graphics 620
INFO: > Version: 3.3.0 - Build 27.20.100.8729
INFO: > GLSL: 3.30 - Build 27.20.100.8729
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: ASTC compressed textures supported
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: AUDIO: Device initialized successfully
INFO: > Backend: miniaudio / WASAPI
INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point
INFO: > Channels: 2 -> 2
INFO: > Sample rate: 48000 -> 48000
INFO: > Periods size: 1440
INFO: FILEIO: [./resources/fonts/Alegreya-Regular.ttf] File loaded successfully
INFO: TEXTURE: [ID 3] Texture loaded successfully (1024x1024 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Data loaded successfully (69 pixel size | 95 glyphs)
INFO: FILEIO: [./resources/shaders/glsl330/circle.fs] Text file loaded successfully
INFO: SHADER: [ID 4] Fragment shader compiled successfully
INFO: SHADER: [ID 5] Program shader loaded successfully
INFO: SHADER: [ID 5] Shader attribute (vertexPosition) set at location: 0
INFO: SHADER: [ID 5] Shader attribute (vertexTexCoord) set at location: 1
WARNING: SHADER: [ID 5] Failed to find shader attribute: vertexTexCoord2
WARNING: SHADER: [ID 5] Failed to find shader attribute: vertexNormal
WARNING: SHADER: [ID 5] Failed to find shader attribute: vertexTangent
INFO: SHADER: [ID 5] Shader attribute (vertexColor) set at location: 3
INFO: SHADER: [ID 5] Shader uniform (mvp) set at location: 0
WARNING: SHADER: [ID 5] Failed to find shader uniform: matView
WARNING: SHADER: [ID 5] Failed to find shader uniform: matProjection
WARNING: SHADER: [ID 5] Failed to find shader uniform: matModel
WARNING: SHADER: [ID 5] Failed to find shader uniform: matNormal
WARNING: SHADER: [ID 5] Failed to find shader uniform: colDiffuse
WARNING: SHADER: [ID 5] Failed to find shader uniform: texture0
WARNING: SHADER: [ID 5] Failed to find shader uniform: texture1
WARNING: SHADER: [ID 5] Failed to find shader uniform: texture2
INFO: SHADER: [ID 5] Shader uniform (radius) set at location: 1
INFO: SHADER: [ID 5] Shader uniform (power) set at location: 2
INFO: TEXTURE: [ID 4] Texture loaded successfully (1600x900 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: STREAM: Initialized successfully (48000 Hz, 32 bit, Stereo)
INFO: FILEIO: [C:\Users\alexa\Music\MOD\a-depres.xm] Music file loaded successfully
INFO: > Sample rate: 48000 Hz
INFO: > Sample size: 32 bits
INFO: > Channels: 2 (Stereo)
INFO: > Total frames: 18355200
Opened by dragging music file onto exe:
WARNING: FILEIO: [./resources/logo/logo-256.png] Failed to open file
INFO: Initializing raylib 4.5
INFO: Supported raylib modules:
INFO: > rcore:..... loaded (mandatory)
INFO: > rlgl:...... loaded (mandatory)
INFO: > rshapes:... loaded (optional)
INFO: > rtextures:. loaded (optional)
INFO: > rtext:..... loaded (optional)
INFO: > rmodels:... loaded (optional)
INFO: > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO: > Display size: 1920 x 1080
INFO: > Screen size: 960 x 540
INFO: > Render size: 960 x 540
INFO: > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 239
INFO: GL: OpenGL device information:
INFO: > Vendor: Intel
INFO: > Renderer: Intel(R) UHD Graphics 620
INFO: > Version: 3.3.0 - Build 27.20.100.8729
INFO: > GLSL: 3.30 - Build 27.20.100.8729
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: ASTC compressed textures supported
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: AUDIO: Device initialized successfully
INFO: > Backend: miniaudio / WASAPI
INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point
INFO: > Channels: 2 -> 2
INFO: > Sample rate: 48000 -> 48000
INFO: > Periods size: 1440
WARNING: FILEIO: [./resources/fonts/Alegreya-Regular.ttf] Failed to open file
WARNING: FILEIO: [./resources/shaders/glsl330/circle.fs] Failed to open text file
INFO: SHADER: [ID 3] Shader attribute (vertexPosition) set at location: 0
INFO: SHADER: [ID 3] Shader attribute (vertexTexCoord) set at location: 1
WARNING: SHADER: [ID 3] Failed to find shader attribute: vertexTexCoord2
WARNING: SHADER: [ID 3] Failed to find shader attribute: vertexNormal
WARNING: SHADER: [ID 3] Failed to find shader attribute: vertexTangent
INFO: SHADER: [ID 3] Shader attribute (vertexColor) set at location: 3
INFO: SHADER: [ID 3] Shader uniform (mvp) set at location: 0
WARNING: SHADER: [ID 3] Failed to find shader uniform: matView
WARNING: SHADER: [ID 3] Failed to find shader uniform: matProjection
WARNING: SHADER: [ID 3] Failed to find shader uniform: matModel
WARNING: SHADER: [ID 3] Failed to find shader uniform: matNormal
INFO: SHADER: [ID 3] Shader uniform (colDiffuse) set at location: 2
INFO: SHADER: [ID 3] Shader uniform (texture0) set at location: 1
WARNING: SHADER: [ID 3] Failed to find shader uniform: texture1
WARNING: SHADER: [ID 3] Failed to find shader uniform: texture2
WARNING: SHADER: [ID 3] Failed to find shader uniform: radius
WARNING: SHADER: [ID 3] Failed to find shader uniform: power
INFO: TEXTURE: [ID 3] Texture loaded successfully (1600x900 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: STREAM: Initialized successfully (48000 Hz, 32 bit, Stereo)
INFO: FILEIO: [C:\Users\alexa\Music\MOD\a-depres.xm] Music file loaded successfully
INFO: > Sample rate: 48000 Hz
INFO: > Sample size: 32 bits
INFO: > Channels: 2 (Stereo)
INFO: > Total frames: 18355200
I think I know why this happens. From the log I gather that certain files are not loaded. Therefore the visuals.
Normally dragging a file onto the exe would pass the filename as first argument. But since musializer declares its main function with main(void) it accepts no arguments, so if you drag a file onto it, it maybe somehow leaks into the environment block. (I am not so sure about this, since it apparently does not happen, when one lists further arguments in the shell, but whatever). Here is some small experimentation:
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main( void )
{
char* buffer;
if ((buffer = _getcwd( NULL, 0 )) == NULL ) {
perror( "_getcwd error" );
}
else {
printf( "%s \nLength: %zu\n", buffer, strlen(buffer) );
free(buffer);
}
getchar();
}
Copy pasta from: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/getcwd-wgetcwd?view=msvc-170&redirectedfrom=MSDN
When opened this small program prints the current directory. However when you drag a file onto it, it thinks the current directory is the path of the file you dragged onto it. And indeed musializer works perfectly, if you copy a file into the musializer build directory first and then drag it onto the exe. (So you can use this as a workaround ;-))
(I could make a PR that would allow musializer to accept a command line argument (the file path of the music file to render), that should hopefully fix this and should allow users to render music by dragging the music file onto the exe)
Edit: I got confused, it always screws up the CWD to the dir of the file dragged onto it, no matter how you declare the arguments.
My hypothesis is that something is wrong with the current working directly. This is the behavior that you get when musializer can't find shaders and fonts. Maybe we should bake them into the executable so the cwd does not matter?
Probably.
Note: https://stackoverflow.com/questions/882850/dragging-files-to-an-exe-sets-different-working-directory Note 2: If you create a new directory in the build dir like and call musializer like so:
mkdir test
..\musializer.exe
it is also broken.
Another option is to retrieve the location of the executable by calling GetModuleFilename with a NULL param and use this instead of the cwd to resolve relative paths.
If you want to proceed with the second option I described it similarly in issue #29. But this was regarding the build executable and not musializer.
@PanoptesDreams what do you mean by "opening the application by dropping file onto the binary file" ?
Click and drag a (music) file onto the executable. (It's in the title)
My hypothesis is that something is wrong with the current working directly. This is the behavior that you get when musializer can't find shaders and fonts. Maybe we should bake them into the executable so the cwd does not matter?
I always bake required resources into my executables, don't really see a reason not to if they're not interchangeable.
Question: Does it also render "Drag&Drop Music Here" way smaller when you open it like that. (Also it does not play the music file you dragged onto it, you have to drag it over the application window, to get the alternative visuals).
Yes. That is the third line in my post
I will also note that it does not open the [music] file either.
@PanoptesDreams what do you mean by "opening the application by dropping file onto the binary file" ?
Click and drag a (music) file onto the executable. (It's in the title)
Oh ok, I'm sorry, I didn't even know that was possible
@PanoptesDreams what do you mean by "opening the application by dropping file onto the binary file" ?
Click and drag a (music) file onto the executable. (It's in the title)
Oh ok, I'm sorry, I didn't even know that was possible
As a Windows user, it was a core paradigm I was raised to embrace, that and having access to the whole disk (unlike modern windows which restricts access heavily). And when UWP became a thing drag and drop seemed to be dropped itself as a concept. The OS and most objects became obfuscated behind "apps", the same way mobile devices handle things.
It's a very simple fix anyways. For the file loading, Windows will treat the dropped file as an argument which you can easily tap in to. As for resources; Bundle resources directly into the executable (I like this for end users) or make the application aware of it's location and make sure everything point's inside your operating directory. (A problem I've encountered and solved for myself in the past, and the one I prefer for advanced users.) Windows has a lot of nuances when it comes to where it's launched from, where it runs, and who it's launched by.
My debug panel so I always know where the app is running, because if something breaks it's usually the operating directory.
As per the title, see below:
This occurs when simply opening the application by dropping a [music] file onto the binary (executable) file in explorer.
I will also note that it does not open the [music] file either.