Skip to content

Commit a4464aa

Browse files
committed
Small tweaks
1 parent 7f25a47 commit a4464aa

File tree

7 files changed

+245
-158
lines changed

7 files changed

+245
-158
lines changed

included-apps/CspDebug/CspDebug.lua

Lines changed: 175 additions & 150 deletions
Large diffs are not rendered by default.

included-cars/android_auto/apps/web/app.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ local searchProviders = {
5151

5252
local function userURL(input)
5353
return input:regfind(urlRegex) and input
54-
or (searchProviders[ac.load('.WebBrowser.searchProvider')] or searchProviders.ddg):format(input:urlEncode())
54+
or (searchProviders[ac.load('.WebBrowser.searchProvider')] or searchProviders.ddg).query:format(input:urlEncode())
5555
end
5656

5757
local function searchIcon()

included-cars/android_auto/apps/youtube/youtube.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local remoteExe = 'https://github.com/yt-dlp/yt-dlp/releases/download/2023.10.13/yt-dlp.exe'
1+
local remoteExe = 'https://github.com/yt-dlp/yt-dlp/releases/download/2024.10.07/yt-dlp.exe'
22

33
---Finds optimal format from list of formats returned by yt-dlp. Prefers something with both audio and video,
44
---looking for the largest file.

included-new-modes/driver-interview/manifest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ FORCE_WIND=0, 0
2020
LOADING_BACKGROUND=loading.jpg, 0
2121
LOADING_PROGRESS=loading_progress.jpg, 0.1, 0.9, 0.8, 0.059
2222
IMMEDIATE_START=1
23+
DISABLE_FLAGS=YELLOW, BLUE
2324

2425
[OPPONENTS]
2526
; Need to spawn some extra cars to match the original mission

included-new-modes/overtake/manifest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ SPEED_LIMIT=60
1010
PENALTIES=0
1111
AI_LEVEL=80
1212
ALLOWED_TRACKS=pits>1
13+
DISABLE_FLAGS=YELLOW, BLUE

included-tools/traffic/src/simulation/TrafficGraph.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,16 @@ function TrafficGraph:initialize(lanes, intersections)
165165
self._edgesFromIDMap = {}
166166
for i = 1, #self._gEdges do
167167
local edge = self._gEdges[i]
168-
local fromPos = self:getGPos(edge.fromID)
169-
local toPos = self:getGPos(edge.toID)
170-
edge.dir = toPos:clone():sub(fromPos):normalize()
171-
172-
table.getOrCreate(self._edgesFromIDMap, edge.fromID, Array):push(edge)
173168
if edge.fromID ~= 0 and edge.toID ~= 0 then
174-
self._graph:addEdge(edge.fromID, edge.toID, fromPos:distance(toPos))
169+
local fromPos = self:getGPos(edge.fromID)
170+
local toPos = self:getGPos(edge.toID)
171+
print(i, edge.toID, edge.fromID, edge.lane.name, self._gVertices)
172+
edge.dir = toPos:clone():sub(fromPos):normalize()
173+
174+
table.getOrCreate(self._edgesFromIDMap, edge.fromID, Array):push(edge)
175+
if edge.fromID ~= 0 and edge.toID ~= 0 then
176+
self._graph:addEdge(edge.fromID, edge.toID, fromPos:distance(toPos))
177+
end
175178
end
176179
end
177180
end

lua-shared/web/browser.lua

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,63 @@ _drawDisposed = function(self, p1, p2, realScale)
21742174
return drawSkip(self, p1, p2, 'Browser has been disposed', 'crash', self:crash() or getCrash(self))
21752175
end
21762176

2177+
---Access texture for drawing it directly using commands such as `ui.drawImage()`. Be careful: if second argument is `true`,
2178+
---texture is flipped upside down! Also, doesn’t include secondary layer with popups (such as default non-CSS dropdown lists),
2179+
---anything about non-CEF pages including error messages, or touchscreen touches.
2180+
---@return ui.ImageSource?
2181+
---@return boolean @If true, image should be drawn upside down.
2182+
function webBrowser:texture()
2183+
sync(self)
2184+
2185+
self._alive = false
2186+
local h = self._blankHeldPage or self._blankPage
2187+
if h then
2188+
return nil, false
2189+
end
2190+
2191+
if connect.cefState ~= 0 then
2192+
self._mm.beAliveTime = sim.systemTime
2193+
return nil, false
2194+
end
2195+
2196+
if self._loadError then
2197+
return nil, false
2198+
end
2199+
2200+
awakeRender(self)
2201+
2202+
if self._mm.handle == 0 then
2203+
if backendUnresponsive(self) then
2204+
self._installingCEF = nil
2205+
self._mm.beFlags = 0
2206+
end
2207+
return nil, false
2208+
end
2209+
2210+
if not self._texture or self._lastHandle ~= self._mm.handle then
2211+
self._working = true
2212+
if self._installingCEF then self._installingCEF = nil end
2213+
if self._texture then self._texture:dispose() end
2214+
self._lastHandle = self._mm.handle
2215+
if self._settings.directRender then
2216+
self._texture = ui.SharedTexture(self._prefix..'.'..tonumber(self._mm.handle))
2217+
self._textureResolution = self._texture:resolution():clone():scale(1 / self._pixelDensity)
2218+
else
2219+
self._texture = ui.SharedTexture(self._mm.handle)
2220+
end
2221+
if self._invalidatingViewCount and self._texture:valid() then
2222+
self._invalidatingViewCount = nil
2223+
end
2224+
end
2225+
2226+
if not self._texture:valid() then
2227+
return nil, false
2228+
end
2229+
2230+
self._alive = true
2231+
return self._texture, self._settings.directRender
2232+
end
2233+
21772234
---Draw browser within given rect. Uses up to two `ui.drawImage()` calls inside (second one for possible popup layer like
21782235
---an opened dropdown list). If there is an error, draws an error message instead.
21792236
---@param p1 vec2 @Position for the upper left corner.

0 commit comments

Comments
 (0)