-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
308 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
FullscreenWindowed = FullscreenWindowed or {} | ||
|
||
FullscreenWindowed.mod_path = ModPath | ||
FullscreenWindowed.save_path = SavePath .. "FullscreenWindowed.json" | ||
_, FullscreenWindowed.library = blt.load_native(FullscreenWindowed.mod_path .. "Borderless Windowed Updated.dll") | ||
|
||
FullscreenWindowed._settings = { | ||
display_mode = 0 | ||
} | ||
|
||
function FullscreenWindowed:save_settings() | ||
local file = io.open(self.save_path, "w+") | ||
if file then | ||
file:write(json.encode(self._settings)) | ||
file:close() | ||
end | ||
end | ||
|
||
function FullscreenWindowed:load_settings() | ||
local file = io.open(self.save_path, "r") | ||
if file then | ||
for k, v in pairs(json.decode(file:read("*all")) or {}) do | ||
self._settings[k] = v | ||
end | ||
file:close() | ||
end | ||
end | ||
|
||
Hooks:PostHook(__classes["Application"], "apply_render_settings", "FullscreenWindowedApplyRenderSettings", function(self) | ||
FullscreenWindowed.library.change_display_mode(FullscreenWindowed._settings.display_mode, RenderSettings.resolution.x, RenderSettings.resolution.y) | ||
end) | ||
|
||
Hooks:PostHook(Setup, "init_managers", "FullscreenWindowedInit", function(self, managers) | ||
if io.file_is_readable(FullscreenWindowed.save_path) then | ||
FullscreenWindowed:load_settings() | ||
FullscreenWindowed.library.change_display_mode(FullscreenWindowed._settings.display_mode, RenderSettings.resolution.x, RenderSettings.resolution.y) | ||
else | ||
FullscreenWindowed._settings.display_mode = managers.viewport:is_fullscreen() and 0 or 1 | ||
end | ||
end) | ||
|
||
Hooks:PostHook(MenuOptionInitiator, "modify_video", "FullscreenWindowedDisplayMode", function(self, node) | ||
local br_item = node:item("brightness") | ||
if br_item then | ||
br_item:set_enabled(FullscreenWindowed._settings.display_mode == 0) | ||
end | ||
|
||
function MenuCallbackHandler:on_change_display_mode(dm_item) | ||
local choice = dm_item:value() | ||
|
||
if FullscreenWindowed._settings.display_mode == choice then | ||
return | ||
end | ||
|
||
managers.viewport:set_fullscreen(choice == 0) | ||
FullscreenWindowed.library.change_display_mode(choice, RenderSettings.resolution.x, RenderSettings.resolution.y) | ||
local old_display_mode = FullscreenWindowed._settings.display_mode | ||
FullscreenWindowed._settings.display_mode = choice | ||
FullscreenWindowed:save_settings() | ||
managers.menu:show_accept_gfx_settings_dialog(function () | ||
managers.viewport:set_fullscreen(old_display_mode == 0) | ||
FullscreenWindowed.library.change_display_mode(old_display_mode, RenderSettings.resolution.x, RenderSettings.resolution.y) | ||
FullscreenWindowed._settings.display_mode = old_display_mode | ||
FullscreenWindowed:save_settings() | ||
dm_item:set_value(FullscreenWindowed._settings.old_display_mode) | ||
if br_item then | ||
br_item:set_enabled(old_display_mode == 0) | ||
end | ||
self:refresh_node() | ||
end) | ||
if br_item then | ||
br_item:set_enabled(choice == 0) | ||
end | ||
self:refresh_node() | ||
end | ||
|
||
local fs_item = node:item("toggle_fullscreen") | ||
if not fs_item then | ||
local dm_item = node:item("multi_display_mode") | ||
if dm_item then | ||
dm_item:set_value(FullscreenWindowed._settings.display_mode) | ||
end | ||
return | ||
end | ||
|
||
node:delete_item("toggle_fullscreen") | ||
local params = { | ||
name = "multi_display_mode", | ||
text_id = "menu_display_mode", | ||
help_id = "menu_fullscreen_help", | ||
callback = "on_change_display_mode", | ||
filter = true | ||
} | ||
local data_node = { | ||
{ | ||
value = 0, | ||
text_id = "menu_fullscreen", | ||
_meta = "option" | ||
}, | ||
{ | ||
value = 1, | ||
text_id = "menu_windowed", | ||
_meta = "option" | ||
}, | ||
{ | ||
value = 2, | ||
text_id = "menu_fullscreen_windowed", | ||
_meta = "option" | ||
}, | ||
type = "MenuItemMultiChoice" | ||
} | ||
local dm_item = node:create_item(data_node, params) | ||
dm_item:set_value(FullscreenWindowed._settings.display_mode) | ||
node:insert_item(dm_item, 3) | ||
end) | ||
|
||
function MenuCallbackHandler:change_resolution(item) | ||
local old_resolution = RenderSettings.resolution | ||
|
||
if item:parameters().resolution == old_resolution then | ||
return | ||
end | ||
|
||
managers.viewport:set_resolution(item:parameters().resolution) | ||
managers.viewport:set_aspect_ratio(item:parameters().resolution.x / item:parameters().resolution.y) | ||
FullscreenWindowed.library.change_display_mode(FullscreenWindowed._settings.display_mode, item:parameters().resolution.x, item:parameters().resolution.y) | ||
|
||
local function on_decline() | ||
managers.viewport:set_resolution(old_resolution) | ||
managers.viewport:set_aspect_ratio(old_resolution.x / old_resolution.y) | ||
FullscreenWindowed.library.change_display_mode(FullscreenWindowed._settings.display_mode, old_resolution.x, old_resolution.y) | ||
end | ||
|
||
managers.menu:show_accept_gfx_settings_dialog(on_decline) | ||
end | ||
|
||
Hooks:Add("LocalizationManagerPostInit", "FullscreenWindowedAddLocalization", function(loc) | ||
local languages = { | ||
[Idstring("english"):key()] = "english", | ||
[Idstring("french"):key()] = "french", | ||
[Idstring("russian"):key()] = "russian", | ||
[Idstring("dutch"):key()] = "dutch", | ||
[Idstring("german"):key()] = "german", | ||
[Idstring("italian"):key()] = "italian", | ||
[Idstring("spanish"):key()] = "spanish", | ||
[Idstring("japanese"):key()] = "japanese", | ||
[Idstring("schinese"):key()] = "schinese", | ||
[Idstring("tchinese"):key()] = "tchinese", | ||
[Idstring("korean"):key()] = "korean", | ||
[Idstring("finnish"):key()] = "finnish", | ||
[Idstring("swedish"):key()] = "swedish", | ||
[Idstring("portuguese"):key()] = "portuguese", | ||
[Idstring("turkish"):key()] = "turkish", | ||
[Idstring("danish"):key()] = "danish", | ||
[Idstring("norwegian"):key()] = "norwegian", | ||
[Idstring("polish"):key()] = "polish" | ||
} | ||
|
||
local lang = languages[SystemInfo:language():key()] | ||
if lang == nil then | ||
lang = "english" | ||
end | ||
|
||
local lang_exist = io.file_is_readable(FullscreenWindowed.mod_path .. "/loc/" .. lang .. ".json") | ||
if not lang_exist then | ||
loc:add_localized_strings({ | ||
["menu_display_mode"] = "Display Mode", | ||
["menu_windowed"] = "Windowed", | ||
["menu_fullscreen_windowed"] = "Fullscreen Windowed" | ||
}) | ||
return | ||
end | ||
LocalizationManager:load_localization_file(FullscreenWindowed.mod_path .. "/loc/" .. lang .. ".json") | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Skærmtilstand", | ||
"menu_windowed" : "I vindue", | ||
"menu_fullscreen_windowed" : "Fuldskærm i vindue" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Weergavemodus", | ||
"menu_windowed" : "Venster", | ||
"menu_fullscreen_windowed" : "Volledig scherm (in venster)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Display Mode", | ||
"menu_windowed" : "Windowed", | ||
"menu_fullscreen_windowed" : "Fullscreen Windowed" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Näyttötila", | ||
"menu_windowed" : "Ikkuna", | ||
"menu_fullscreen_windowed" : "Koko näyttö ikkunoitu" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Affichage", | ||
"menu_windowed" : "Fenêtré", | ||
"menu_fullscreen_windowed" : "Plein écran fenêtré" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Anzeigemodus", | ||
"menu_windowed" : "Fenstermodus", | ||
"menu_fullscreen_windowed" : "Vollbildfenster" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Modalità di visualizzazione", | ||
"menu_windowed" : "In finestra", | ||
"menu_fullscreen_windowed" : "Schermo intero in finestra" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "ディスプレイモード", | ||
"menu_windowed" : "ウィンドウ", | ||
"menu_fullscreen_windowed" : "全画面ウィンドウ" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "화면 모드", | ||
"menu_windowed" : "창 모드", | ||
"menu_fullscreen_windowed" : "창 있는 전체 화면" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Skjermmodus", | ||
"menu_windowed" : "I vindu", | ||
"menu_fullscreen_windowed" : "Fullskjerm i vindu" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Tryb wyświetlania", | ||
"menu_windowed" : "W oknie", | ||
"menu_fullscreen_windowed" : "Pełny ekran, w oknie" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Modo de Exibição", | ||
"menu_windowed" : "Em Janela", | ||
"menu_fullscreen_windowed" : "Tela cheia em janela" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Режим отображения", | ||
"menu_windowed" : "В окне", | ||
"menu_fullscreen_windowed" : "Полноэкранный в окне" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "显示模式", | ||
"menu_windowed" : "窗口模式", | ||
"menu_fullscreen_windowed" : "全屏窗口模式" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Modo de presentación", | ||
"menu_windowed" : "Modo ventana", | ||
"menu_fullscreen_windowed" : "Ventana a pantalla completa" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Visningsläge", | ||
"menu_windowed" : "Fönster", | ||
"menu_fullscreen_windowed" : "Helskärm i fönsterläge" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "顯示模式", | ||
"menu_windowed" : "視窗化", | ||
"menu_fullscreen_windowed" : "全螢幕視窗化" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"menu_display_mode" : "Görüntü Modu", | ||
"menu_windowed" : "Pencereli", | ||
"menu_fullscreen_windowed" : "Tam Ekran Pencereli" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name" : "Fullscreen Windowed(Borderless Windowed Updated)", | ||
"description" : "An updated version of Borderless Windowed plugin.", | ||
"author" : "Shatyuka", | ||
"contact" : "https://t.me/Shatyuka", | ||
"version" : "1.4", | ||
"blt_version" : 2, | ||
"priority" : 0, | ||
"color" : "255 255 255", | ||
"undisablable" : true, | ||
"disable_safe_mode" : true | ||
"hooks" : [ | ||
{ | ||
"hook_id" : "lib/entry", | ||
"script_path" : "Borderless Windowed Updated.lua" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<mod> | ||
<native_module platform="mswindows" filename="Borderless Windowed Updated.dll" /> | ||
</mod> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters