#Generated files are not recognized until reboot

10 messages · Page 1 of 1 (latest)

final stump
#

#theming message
I previously reported this phenomenon in the theming section, but it has not been fixed in a21c, so I am reporting it again.

When dynamically creating files on the theme side, the files that should have been created are not recognized until Project OutFox itself is restarted.

released builds: OutFox-alpha-0.5.0-pre043-a21c-Win64-date-20241005
Operating System: Windows 11 Pro (23H2)
CPU: i5-12400F
GPU: GeForce RTX 3060
Storage: SSD
Game Version: pre043-a21c
Game Mode and Function: dance
Theme: _fallback + Lua

#

This phenomenon is very annoying in the following cases

Example 1: The first time a theme is applied, it is not recognized after saving the settings.

ScreenInit overlay.lua

GLOBAL_PATH = '/Save/MyConfig.txt'
return Def.ActorFrame{
    OnCommand = function(self)
        if not FILEMAN:DoesFileExist(GLOBAL_PATH) then
            local f = RageFileUtil.CreateRageFile()
            if f:Open(GLOBAL_PATH, 2) then
                f:Write(math.random(1, 10000))
                f:Close()
            end
            f:destroy()
        end
    end,
}

ScreenGameplay overlay.lua

return Def.ActorFrame{
    OnCommand = function(self)
        local value = 0
        local search = 'not found'
        if FILEMAN:DoesFileExist(GLOBAL_PATH) then
            search = 'exists'
            local f = RageFileUtil.CreateRageFile()
            if f:Open(GLOBAL_PATH, 1) then
                value = tonumber(f:Read())
                f:Close()
            end
            f:destroy()
        end
        SCREENMAN:SystemMessage(string.format('File %s / Config value: %d', search, value))
    end,
}
  • Expectation: Value in MyConfig.txt
  • Actual: 0 (File not found)

After restarting Project OutFox, /Save/MyConfig.txt will be recognized in ScreenGameplay.

#

Example 2: Custom sort created but not accessible.

ScreenSelectMusic overlay.lua

return Def.ActorFrame({
    InitCommand = function(self)

        local name = string.format('%02d%02d%02d', Hour(),Minute(),Second())
        local prefPath = string.format(
            THEME:GetCurrentThemeDirectory()..'Other/SongManager %s.txt', name)
        local group = SONGMAN:GetSongGroupNames()[1]
        local songs = SONGMAN:GetSongsInGroup(group)
        local data = '---'..group
        for i=1, 5 do
            data = string.format(
                '%s\n%s/%s',
                data,
                group,
                songs[math.random(1, #songs)]:GetSongFolder()
            )
        end
        local f = RageFileUtil.CreateRageFile()
        if f:Open(prefPath, 2) then
            f:Write(data)
            f:Close()
        end
        f:destroy()
        SONGMAN:SetPreferredSongs(name)
    end,
})

Of course, the file exists.
This is particularly fatal as the same error will appear even after pressing retry, and pressing cancel will exit the game.

#

The code in Example 2 was incorrect and has been corrected. The images at runtime are shown in the attachment.

craggy quest
#

Do they show up after you use F2+3?

final stump
#

For Example1, press F2+3 for correct operation.
In the case of Example2, it is not possible to press F2+3 because it tries to read the file immediately after generation.

Also, as mentioned in #theming message , it is difficult to require an ordinary player who is not the theme author to press F2+3.
It would require an operation that OutFox 0.4 and StepMania do not require.

hushed flicker
#

FILEMAN:FlushDirCache(dir)

final stump
# hushed flicker FILEMAN:FlushDirCache(dir)

I added the following after f:destroy() and it worked.

  • Example1: FILEMAN:FlushDirCache('/Save/')
  • Example2: FILEMAN:FlushDirCache(THEME:GetCurrentThemeDirectory()..'Other/')

This is not mentioned in the Lua documentation, is this a feature that will be formally implemented?

hushed flicker
#

it is implemented just not in the lua docs (yet)

final stump
#

Okay, thank you!