Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #6034

Merged
merged 6 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Pioneer includes the following third-party software:
Copyright (C) 2002, Lev Povalahev
Licensed under the Modified BSD licence (see licenses/GLEW.txt)

atomic_queue - C++ lockless queue
atomic_queue v1.6.4 - C++ lockless queue
Copyright (c) 2019 Maxim Egorushkin
Licensed under the MIT license (see contrib/atomic_queue/LICENSE)

Expand Down
189 changes: 108 additions & 81 deletions contrib/atomic_queue/atomic_queue.h

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions contrib/atomic_queue/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static inline void spin_loop_pause() noexcept {
_mm_pause();
}
} // namespace atomic_queue
#elif defined(__arm__) || defined(__aarch64__)
#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64)
namespace atomic_queue {
constexpr int CACHE_LINE_SIZE = 64;
static inline void spin_loop_pause() noexcept {
Expand All @@ -30,6 +30,8 @@ static inline void spin_loop_pause() noexcept {
defined(__ARM_ARCH_8A__) || \
defined(__aarch64__))
asm volatile ("yield" ::: "memory");
#elif defined(_M_ARM64)
__yield();
#else
asm volatile ("nop" ::: "memory");
#endif
Expand All @@ -51,11 +53,15 @@ static inline void spin_loop_pause() noexcept {} // TODO: Find the right instruc
namespace atomic_queue {
constexpr int CACHE_LINE_SIZE = 64;
static inline void spin_loop_pause() noexcept {
asm volatile ("nop");
asm volatile (".insn i 0x0F, 0, x0, x0, 0x010");
}
} // namespace atomic_queue
#else
#ifdef _MSC_VER
#pragma message("Unknown CPU architecture. Using L1 cache line size of 64 bytes and no spinloop pause instruction.")
#else
#warning "Unknown CPU architecture. Using L1 cache line size of 64 bytes and no spinloop pause instruction."
#endif
namespace atomic_queue {
constexpr int CACHE_LINE_SIZE = 64; // TODO: Review that this is the correct value.
static inline void spin_loop_pause() noexcept {}
Expand All @@ -82,6 +88,7 @@ auto constexpr A = std::memory_order_acquire;
auto constexpr R = std::memory_order_release;
auto constexpr X = std::memory_order_relaxed;
auto constexpr C = std::memory_order_seq_cst;
auto constexpr AR = std::memory_order_acq_rel;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
10 changes: 10 additions & 0 deletions data/libs/EquipType.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ function EquipType.NewType(baseType, name)
return proto
end

-- Override the unserializer to handle prototype metatables
-- If the new type defines an Unserialize method it must store this unserializer method and call it
function newType.Unserialize(data)
local inst = baseType.Unserialize(data)
local proto = rawget(inst, "__proto")
return setmetatable(inst, proto and proto.meta or newType.meta)
end

Serializer:RegisterClass(name, newType)

return newType
Expand Down Expand Up @@ -304,4 +312,6 @@ function EquipType:GetFlavourText()
return self.transient.flavourtext
end

Serializer:RegisterClass("EquipType", EquipType)

return EquipType
1 change: 1 addition & 0 deletions data/modules/Equipment/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt

local EquipType = require 'EquipType'
local Game = require 'Game'
local ShipDef = require 'ShipDef'

local utils = require 'utils'
Expand Down
8 changes: 5 additions & 3 deletions data/pigui/modules/new-game-window/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ StartVariants.register({
missile_bay_2 = "missile_bay.opli_internal_s2",
},
cargo = {
{ Commodities.hydrogen, 2 }
},
pattern = 1,
colors = { Color('000000'), Color('000000'), Color('000000') }
Expand All @@ -66,7 +65,6 @@ StartVariants.register({
thruster = "thruster.default_s1",
},
cargo = {
{ Commodities.hydrogen, 2 }
},
pattern = 1,
colors = { Color('000000'), Color('000000'), Color('FFFF00') }
Expand All @@ -87,7 +85,6 @@ StartVariants.register({
thruster = "thruster.default_s1",
},
cargo = {
{ Commodities.hydrogen, 2 }
},
pattern = 6,
colors = { Color('E17F00'), Color('FFFFFF'), Color('FF7F00') }
Expand Down Expand Up @@ -210,6 +207,11 @@ local function startGame(gameParams)
cargoMgr:AddCommodity(Commodities[id], amount)
end

local drive = player:GetInstalledHyperdrive()
if drive then
drive:SetFuel(player, drive:GetMaxFuel())
end

for _, entry in ipairs(gameParams.flightlog.Custom) do
if FlightLog.InsertCustomEntry(entry) then
-- ok then
Expand Down
2 changes: 1 addition & 1 deletion data/ships/vatakara.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"model": "vatakara",
"name": "Vatakara",
"cockpit": "",
"shield_model": "vatakara_shield",
"shield_model": "malabar_shield",
"manufacturer": "mandarava-csepel",
"ship_class": "heavy_freighter",
"min_crew": 4,
Expand Down
3 changes: 2 additions & 1 deletion src/ship/PlayerShipController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ void PlayerShipController::PollControls(const float timeStep, int *mouseMotion,
wantAngVel += Util::NeededAngVelocityToFaceDirection(*this, timeStep, GetMouseDir(), outParams.angPower);
}

if (InputBindings.killRot->IsActive()) SetFlightControlState(CONTROL_FIXHEADING_KILLROT);
if (InputBindings.killRot->IsActive() && GetFlightControlState() != CONTROL_FIXSPEED)
SetFlightControlState(CONTROL_FIXHEADING_KILLROT);

outParams.desiredAngular = wantAngVel;

Expand Down