Skip to content

Instantly share code, notes, and snippets.

Grok Prompt

I'm using CrossOver on an Apple M4 machine. A Unity game I'm playing just got updated from engine version 6000.0.49f1 to 6000.0.59f2. After I launch the game, I lose the ability to interact with the game via mouse and keyboard. If I roll back to 6000.0.49f1, everything works. What could be the problem or settings I need to investigate?

Potential Causes

Based on known issues with Unity on Apple Silicon (including M4), CrossOver (which relies on Wine for translating Windows inputs to macOS), and recent Unity 6000.x updates, the loss of mouse/keyboard interaction after the game update is likely tied to how the new Unity version handles input—specifically the Input System package. Unity 6000.0.59f2 (part of the 6000.2 tech stream) includes refinements to input detection, device polling, and event handling that can conflict with CrossOver's input bridging on ARM-based Macs. Earlier versions like 6000.0.49f1 may have used less strict detection or fallback behaviors that worked better with Wine'

@akarnokd
akarnokd / FusionReactorFix.java
Created April 22, 2024 12:21
The Planet Crafter Fusion Reactor Fixer
package hu.akarnokd.theplanetcrafter;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.*;
import java.util.regex.Pattern;
public class FusionReactorFix {
public static void main(String[] args) throws Throwable {
script.on_event(defines.events.on_player_setup_blueprint, function(event)
local player = game.get_player(event.player_index)
local bp = player.blueprint_to_setup
if not bp.valid_for_read then
bp = player.cursor_stack
end
local bp_ents = bp.get_blueprint_entities()
if bp_ents then
local source = event.mapping.get()
for i, entity in pairs(bp_ents) do
function transfer(sourceInventory, destinationInventory, recipe, alimit, tag)
if not destinationInventory then return end
local limits = { }
if recipe then
for _, ingredient in pairs(recipe.ingredients) do
if alimit then
limits[ingredient.name] = math.min(alimit, ingredient.amount + 1)
else
limits[ingredient.name] = ingredient.amount + 1
script.on_event({
defines.events.on_built_entity,
defines.events.on_robot_built_entity,
defines.events.script_raised_built,
defines.events.script_raised_revive,
}, function(event)
handleEntityPlaced(event.created_entity)
end)
script.on_event({
import java.util.*;
public class SortySort {
public static String stringSorter(List<String> stringList, String sortingOrder) {
if ((stringList == null) || (stringList.isEmpty())) {
return "Given stringList or sortingOrder is empty, null or blank space";
}
if ((stringList.size() == 1)) {
return "The list contains an empty or blank space value";
}

You'll have to escape the currency symbol as it might be a reserved symbol in regex. Plus, splitting doesn't keep the symbol itself so you'll have to add it back manually:

String currency = "$"; // from your method

String escapedCurrency = Pattern.quote(currency);

String[] result = "$5".split(escapedCurrency, 2);
result[0] = currency;
Map<List<String>, String> map = new HashMap<>();
map.put(List.of("A", "B"), "X");
map.put(List.of("C"), "Y");
var result = map.entrySet()
.stream()
.flatMap(kv -> kv.getKey().stream().map(k -> Map.entry(k, kv.getValue())))
.collect(Collectors.toMap(k -> k.getKey(), v -> v.getValue()));
result.entrySet().forEach(System.out::println);
@akarnokd
akarnokd / main.py
Created January 28, 2022 23:13
Python script to convert Imperium Galactica's SMP files into WAV files
import sys
import os.path
from os import listdir
from os.path import isfile, join
def int_to_bytes(uint):
return bytearray([
(uint & 0xFF),
((uint >> 8) & 0xFF),
static <T, R> Publisher<R> map(Publisher<T> upstream, Function<T, R> mapper) {
return downstream -> upstream.subscribe(new Mapper<>(downstream, mapper));
}
class Mapper<T, R> implements Subscriber<T> {
final Subscriber<? super R> downstream;
final Function<T, R> mapper;