Compare commits

2 Commits

Author SHA1 Message Date
1d16db0e5f Typo fixes 2020-01-15 23:39:20 +00:00
4293ebda7f Blog post about Stardew Valley 2020-01-15 23:31:55 +00:00
2 changed files with 220 additions and 236 deletions

View File

@@ -1,236 +0,0 @@
+++
title = "Biological sex"
date = "2019-12-23"
tags = ["biology"]
+++
# DRAFT
### "Biological Sex"
This is a term I've been bumping up against on various online communities
recently - usually in discussions about (or, more accurately, against) trans
people, but it shows up in other contexts too.
Being a (lapsed) biologist, I have Opinions about this term. Rather than repeat
the same case over and over again in these discussions, I'm laying it out here
for easy linking, and to act as a sort of persistent memory of my conversations
on this topic. If I've linked you to this page, you've probably used the term
where I could hear you, and I am now grumpy at you. This is easily resolved -
read the page, think carefully about its implications for what you are saying,
and act or respond accordingly. If you think the positions or ideas on this page -
either my own, or those I'm representing on behalf of others - need changes,
let me know. We can talk about it.
Anyway, what is "biological sex"?
The people using it seem to want a static label for people - "male" or "female"
(sometimes "hermaphrodite" is recognised, sometimes not). The categories and
their immutability are asserted because "sex is biological". As a (very sad,
purely coincidental, honest guv) consequence, trans men aren't, and neither are
trans women. Gender theory is entirely bypassed - you are your biological sex
(curiously, this is usually identical to the gender you were assigned at birth),
and you will be that forever. There is no point to reassignment surgery, and
your pronouns absolutely must be determined from this datum, as must the
bathroom you use, the sports competitions you take part in, and the systemic
biases or privileges you suffer or benefit from.
This position is upsetting to various people, and I don't like it myself, but as
a biologist, I have a very specific question - **which** definition of
"biological sex" are we using here?
That animals (and, by extension, humans) have multiple sexes is definitely not
in doubt, but for biologists, the term means different things in different
contexts . Even when restricting the discussion to just humans, we can talk
about sex as a genotypical, phenotypical, or even neurotypical attribute.
Biologists may assign one person to different categories for each definition,
depending on circumstances.
Which definition were you thinking of when you said "biological sex" to me?
Maybe jump straight to that section. If you weren't thinking of one at all,
maybe you've got a problem - start at the top. If you were thinking of one that
I've not listed, maybe I've got a problem - tell me about it.
#### Genotype
In this model of biological sex, men are `XY`, women are `XX`, and you can work
out which sex you are by karyotyping. Anyone can do it - all you need is a swab,
a light microscope, and a bit of stain. It's irrefutable. Sorry, trans people -
if your karyotype disagrees with your feelings, that's just reality come to
call. This is probably what most people implicitly think of when talking about
biological sex.
The biggest question I have about this model is why we would use it in the first
place. Fundamentally - why does it matter what karyotype people are? How does
this characteristic feed into decisions people make about other people when,
even though it's so easy and simple to do, karyotyping is almost never done, and
plays almost no role in human social interaction? Why do we pick this attribute?
To me, it looks like it's just a fairly good **proxy** for things that people
care about, rather than being the cared-about thing itself.
Note that there are *other* possible sets of sex chromosomes in humans. There
are, in fact, six reasonably-common permutations:
* `XX` - Female
* `XY` - Male
* `X` - Turner's syndrome
* `XXY` - Klinefelter's syndrome
* `XYY` - XYY syndrome
* `XXYY` - XXYY syndrome
Approaches to managing this extra complexity vary - you could declare there are
more than two biological sexes, for instance, or that being biologically male is
all about having at-least-one Y chromosome. The former is very uncommon, but if
karyotype itself matters, rather than being a proxy for something, I'd expect
people to take it.
Some examples of outliers may be instructive here. Yes, outliers. Theories are
tested against anomalous data - Einstein's model of gravity works where Newton's
doesn't, and we'll all be much happier when we find something that works where
both fail. If biological sex is a biological concept, it needs to run the same
gauntlet.
To pick on sports performance for a moment - we don't actually know which
karyotypes [Caster Semenya](https://en.wikipedia.org/wiki/Caster_Semenya) or
[Dutee Chand](https://en.wikipedia.org/wiki/Dutee_Chand) have, but measures
against them have focused on other attributes, like testosterone levels. Being
uncharitable to the IAAF, this suggests to me that they have an `XX` karyotype,
but the governing body still isn't happy with them competing. In any case, we
can certainly imagine athletes like them existing with an `XX` karyotype.
Why don't we karyotype all athletes and use that as the sole basis of sex here?
Would that solve all these issues, in your view?
Another example: if a
person who is a [mosaic of `X` and `XY` cells](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2190741/)
has given birth to a child, what is the biological sex of the parent, and are
they a mother, or a father?
Yup, people can be several different karyotypes **at the same time**. Does this
mean that they're multiple sexes at the same time? Do we take the most prevalent
karyotype? Are different parts of them different sexes? How does this feed into
policy?
This person is almost entirely `XY`-karyotype. Does this mean they're male, and
should be treated as such? If not, why not?
For some reason, despite the fact that a simple karyotype would have returned
`XY`, this person was assigned female at birth. They grew up as a woman, and had
a baby in due course via the usual mechanisms. I don't know if they were into
sport or not, though.
Are they, then, a woman? If not, why not?
If you're thinking something along the lines of "congratulations, he's a new
father, but I really think he should stop entering women's bathrooms and sports
competitions" - well, you're consistent, at least, but please do tell me **why**
you think karyotype should determine this, because I can't think of a good
reason for it.
Most people either already knew, or are perhaps now in the process of realising,
that this version of biological sex doesn't encapsulate their beliefs at all.
Which leads us on to...
#### Phenotype
Genotype plus interaction with environment equals phenotype. This is a very
broad statement, but out of it falls all of developmental biology, morphology,
etc. Typically, but not always, `XX` people will have no penis, but breasts,
vagina and womb; cyclical oestrogen; and low testosterone. `XY` people will
typically have a penis but no breasts, vagina, or womb; fairly stable oestrogen;
and higher levels of testosterone. I submit that this is the kind of thing
people generally *mean* when they talk about biological sex, even though they're
*thinking* about genotype.
In support of this submission, note that this tidies up the outlier we found
earlier - now an `XY` person who is "phenotypically female" can give birth and
enter women's bathrooms without contradiction - and this is what people
**actually** use, instead of karyotyping, to assign gender most of the time.
However, we need to let go of something very important here. Unlike genotype,
phenotype can - and invariably does - change over time. By moving away from
"genotype", we have lost the part of "biological sex" that was initially most
attractive about it in the context of this discussion - immutability. Suddenly,
one's "biological sex" is mutable, and it can change - or be changed - over
time.
Hopefully the implications of that are clear, but there are a few angles that
should be specifically addressed.
##### "Only your phenotype at birth matters"
Why? I was born with two legs, but if one comes off somehow, my phenotype is now
"one-legged". This is not negotiable. Treating me as if I have two legs, just
because I was born with two, is not going to be good for me, and you're going to
look like a right prick at airport security when you take my crutch away.
##### "Reproduction is the key part of the phenotype"
Is it? Is it really? How do we account for people who are capable of
reproducing, but choose not to? Or infertile people? Do women stop being women
at menopause? Do men stop being men post-vasectomy? What do they become, if so?
What elevates this one aspect of human experience into the determinative one,
anyway? On whose authority? Note that evolutionary teleology is not an answer.
##### "Trans women phenotypes are not identical to cis women phenotypes"
Certainly true. In other, entirely unrelated news, rich women phenotypes are not
identical to poor women phenotypes.
This objection is often a repetition of "Reproduction is the key part of the
phenotype", so you might want to read that as well.
##### "You're making it far too complicated, biological sex is just common sense"
Appeals to common sense are a particularly pernicious form of conservatism that
I have no truck with. There is truthiness to the term "biological sex", but it
falls apart upon careful examination. So kindly stop using it.
If you must persist with the general idea, consider using the term "genotypical
sex", "phenotypical sex", or some other, more accurate, qualifier, so we can at
least start this conversation from a different point in the future.
##### What attributes determine phenotypical sex anyway?
It's easy to put most people into one sex category or another, phenotypically -
as I noted above, penises and vaginas are how assignments are usually made at
birth. However, as with genotype, there are instructive outliers here. How do
we decide when it's not obvious at first glance, and what does this tell us
about "phenotypical sex"?
The obvious first bite is hermaphrodism, or people who have some form of sexual
indeterminacy at birth. What we do here is variable - but sometimes includes
surgical intervention to make one's phenotype "unambiguous". Often this is a
matter of judgement by the surgeon. What happens if they get it wrong? What does
it *mean* to get it wrong?
With adults, the phenotypical cues we use in the street to determine which
category we put people into vary - and we quite often get it wrong. For many
years, I had long hair. This often caused people to identify me as a woman,
leading to embarrassment, confusion, and not a few cases of violence, when they
realised their mistake.
Is long hair a biological trait of women, or does culture determine whether long
hair connotates one sex or another? I think you know the answer.
Do you now agree that cultural has at least some part in determining what it
means to be phenotypically male, or female? If not, why not?
#### Neurotype
Just as a brief coda - biologists have other definitions of sex, too. One of
those is neurotype - the idea that a person's brain may be morphologically male
or female (with the same caveats as above). This is mostly a specialism of
phenotype, and nobody's resorted to it yet. Maybe I'll get to fill it out in the
future.
#### tl;dr
* Biologists do not have a single concept of sex
* The term "biological sex" elides attributes of genotype and phenotype
* Genotypical sex is only a proxy for phenotypical sex
* The categories of sex found in phenotype are **at least partly** socially determined
* Although genotypes are fairly immutable, phenotypes are very mutable
* Some people changing their phenotype are trans people
* You cannot short-circuit gender theory by appeal to "biological sex"

View File

@@ -0,0 +1,220 @@
+++
title = "Stardew Valley on aarch64"
date = "2020-01-15"
tags = ["PBP", "hacking"]
+++
#### Stardew Valley on aarch64
At the end of last year I got a [Pinebook Pro](https://pine64.org/pinebook-pro) -
mostly for reasons of paranoia. So far, it's been pretty good, but there was
one thing that I couldn't get working: [Stardew Valley](https://stardewvalley.com/)
You could call me a little bit addicted to this game, but it's proprietary,
closed-source, and the authors don't release binaries compiled for aarch64 -
although they do very kindly release x86_32 and x86_64 Linux binaries, which
is more than most companies do.
I [left a message on the forum](https://community.playstarbound.com/threads/arm-arm64-aarch64-linux-support.158840/)
and moved on, confident that it wouldn't ever happen. I vaguely knew it was
written in C#, but it's not an ecosystem I have any experience in. I figured it
was going to be the kind of thing that comes under "possible, but not trivial" -
and aarch64 + linux is super-niche.
Fast forward a few weeks, I mentioned it in passing on the `#pinebook` IRC
channel, which went a little like:
```
<lupine> stardew valley never got back to me *sob*
<halosghost> lupine: trying to get Stardew Valley on the pbp as well?
<Nadia> The game itself is written in C# so runs through Mono
<lupine> they don't distribute aarch64-linux executables
<Nadia> You just need to build the libraries it needs and it should run
<lupine> it's closed source, so "just need to build" is rather an issue
```
They rather roundly assured me that it wasn't an issue at all, and literally
10 minutes later I had a working Stardew Valley setup. This is incredible.
I'm documenting the steps I took so I can come back to this in the future, but
maybe it'll be useful for others too.
First, you need a copy of the game. I was working with v1.4 as shipppd by
[GOG Games](https://www.gog.com/game/stardew_valley). It comes as one of those
`.sh` files that contains an archive. That doesn't have aarch64 support, and
doesn't run on the PBP. Fortunately, I'd already installed it on an amd64 laptop
so I just rsynced that over:
```
lupine@pbp:~$ rsync -avzP '10.0.1.104:GOG Games' .
# Might as well grab my savegames at the same time
lupine@pbp:~$ rsync -avzP 10.0.1.104:.config/StardewValley .config/StardewValley
```
I'm sure it's possible to make it run, I'm just being lazy. I'll update this in
the future if I work out how to go from the `.sh` file.
What does this give us?:
```
lupine@pbp:~/GOG Games/Stardew Valley/game$ ls -lh
total 438M
-rwxrwxr-x 1 lupine lupine 12K Dec 8 23:58 BmFont.dll
drwx--x--x 17 lupine lupine 4.0K Dec 8 23:58 Content
-rwxrwxr-x 1 lupine lupine 330K Dec 8 23:58 GalaxyCSharp.dll
-rwxrwxr-x 1 lupine lupine 336 Dec 8 23:58 GalaxyCSharp.dll.config
-rwxrwxr-x 1 lupine lupine 91K Dec 8 23:58 goggame-1453375253.hashdb
-rwxrwxr-x 1 lupine lupine 782 Dec 8 23:58 goggame-1453375253.info
drwx--x--x 2 lupine lupine 4.0K Dec 8 23:58 lib
drwx--x--x 2 lupine lupine 4.0K Dec 8 23:58 lib64
-rwxrwxr-x 1 lupine lupine 197M Dec 8 23:59 libGalaxyPeer64.so
-rwxrwxr-x 1 lupine lupine 177M Dec 8 23:59 libGalaxyPeer.so
-rwxrwxr-x 1 lupine lupine 5.3M Dec 8 23:59 libSkiaSharp.dll
-rwxrwxr-x 1 lupine lupine 119K Dec 8 23:58 Lidgren.Network.dll
lrwxrwxrwx 1 lupine lupine 14 Dec 9 00:00 mcs -> mcs.bin.x86_64
-rwxrwxr-x 1 lupine lupine 17M Dec 8 23:59 mcs.bin.x86
-rwxrwxr-x 1 lupine lupine 16M Dec 8 23:59 mcs.bin.x86_64
drwx--x--x 3 lupine lupine 4.0K Dec 8 23:59 mono
-rwxrwxr-x 1 lupine lupine 2.5K Dec 8 23:59 monoconfig
-rwxrwxr-x 1 lupine lupine 1.3M Dec 8 23:58 MonoGame.Framework.dll
-rwxrwxr-x 1 lupine lupine 527 Dec 8 23:58 MonoGame.Framework.dll.config
-rwxrwxr-x 1 lupine lupine 203K Dec 8 23:58 Mono.Posix.dll
-rwxrwxr-x 1 lupine lupine 328K Dec 8 23:58 Mono.Security.dll
-rwxrwxr-x 1 lupine lupine 3.6M Dec 8 23:59 mscorlib.dll
-rwxrwxr-x 1 lupine lupine 267K Dec 8 23:58 SkiaSharp.dll
-rwxrwxr-x 1 lupine lupine 1.2K Dec 8 23:58 StardewValley
-rwxrwxr-x 1 lupine lupine 4.0M Dec 8 23:58 StardewValley.bin.x86
-rwxrwxr-x 1 lupine lupine 3.8M Dec 8 23:58 StardewValley.bin.x86_64
-rwxrwxr-x 1 lupine lupine 4.1M Dec 8 23:58 StardewValley.exe
-rwxrwxr-x 1 lupine lupine 6.5K Dec 8 23:58 StardewValley.GameData.dll
-rwxrwxr-x 1 lupine lupine 127K Dec 8 23:58 System.Configuration.dll
-rwxrwxr-x 1 lupine lupine 879K Dec 8 23:58 System.Core.dll
-rwxrwxr-x 1 lupine lupine 2.0M Dec 8 23:58 System.Data.dll
-rwxrwxr-x 1 lupine lupine 2.2M Dec 8 23:58 System.dll
-rwxrwxr-x 1 lupine lupine 442K Dec 8 23:58 System.Drawing.dll
-rwxrwxr-x 1 lupine lupine 966K Dec 8 23:58 System.Runtime.Serialization.dll
-rwxrwxr-x 1 lupine lupine 130K Dec 8 23:58 System.Security.dll
-rwxrwxr-x 1 lupine lupine 3.1M Dec 8 23:58 System.Xml.dll
-rwxrwxr-x 1 lupine lupine 131K Dec 8 23:58 System.Xml.Linq.dll
-rwxrwxr-x 1 lupine lupine 161K Dec 8 23:58 WindowsBase.dll
-rwxrwxr-x 1 lupine lupine 48K Dec 8 23:59 xTile.dll
-rwxrwxr-x 1 lupine lupine 9.0K Dec 8 23:59 xTilePipeline.dll
```
The magic here is that not all the `.dll` and `.exe` files here are **Windows**
object files. Instead, many of them are just Mono bytecode, which is analogous
to JVM bytecode:
```
lupine@pbp:~/GOG Games/Stardew Valley/game$ file StardewValley*
StardewValley: Bourne-Again shell script, ASCII text executable
StardewValley.bin.x86: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=4801f8881feefa8aa515f9fadc02c01598c44131, not stripped
StardewValley.bin.x86_64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=04fe4f2c2ca8b4dc7faf70c643417bf0df632a9e, not stripped
StardewValley.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows
StardewValley.GameData.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows
```
We need Mono to run these assemblies. I guess the `StardewValley.bin.*` files
ar just stripped-down Mono runtimes that invoke `StardewValley.exe`!
The `mcs.*` binaries are "Mono C Sharp" - I don't know C#, but I assume it's
another essential part of the runtime.
Debian has Mono + MCS already, so...
```
lupine@pbp~/GOG Games/Stardew Valley/game$ sudo apt install mono-runtime mono-rcs
lupine@pbp~/GOG Games/Stardew Valley/game$ ln -sf `which mcs`
```
We can then try to run the game:
```
lupine@pbp~/GOG Games/Stardew Valley/game$ mono StardewValley.exe
```
Amazingly, that's **almost sufficient**, all by itself, to get a fully working
game, at least for me. It starts up, and the only obviously broken thing is
sound. There are some complaints on the comamnd line that don't seem to get in
the way of actually playing it.
Wat.
No sound is annoying though, how about we fix that?
Turns out Stardew Valley only **requires** two external libraries: SDL and
libasound. I've no idea if the graphics is working even though it can't find
SDL, or if it can find my native SDL libary but not the libasound one, or what,
but it's trivial to fix. Edit `MonoGame.Framework.dll.config` and add these
two lines:
```
<dllmap dll="SDL2.dll" os="linux" cpu="armv8" target="./libaarch64/libSDL2-2.0.so.0"/>
<dllmap dll="soft_oal.dll" os="linux" cpu="armv8" target="./libaarch64/libopenal.so.1" />
```
Now you just need to put those two .so files into that directory locally, and
sound begins to work!
(I just symlinked `/usr/lib/aarch64-linux-gnu` into place, which does the same
job).
At this point the game works perfectly, including LAN multiplayer - which is
ridiculous - and despite worries about endianness, it can load and run my saves
as well.
There are a few complaints on the console though. Let's see what we can do
about them.
```
Your mono runtime and class libraries are out of sync.
The out of sync library is: /home/lupine/GOG Games/Stardew Valley/game/System.dll
```
OK, these are shipped with `mono-runtime` (actually in `libmono-system4.0-cil`)
anyway. The complaint is that these assemblies were compiled with a different
version of Mono, but it's falling back to the main ones anyway, so we can just
move these out of the way.
The only `System.*.dll` file we need to keep is `System.Runtime.Serialization.dll` -
the rest can be moved out of the way.
```
System.TypeInitializationException: The type initializer for 'Galaxy.Api.GalaxyInstance' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CustomExceptionHelper' threw an exception. ---> System.DllNotFoundException: GalaxyCSharpGlue
at (wrapper managed-to-native) Galaxy.Api.GalaxyInstance+CustomExceptionHelper.CustomExceptionRegisterCallback(Galaxy.Api.GalaxyInstance/CustomExceptionHelper/CustomExceptionDelegate)
at Galaxy.Api.GalaxyInstance+CustomExceptionHelper..cctor () [0x00011] in <22373852dcce42128dc7e065ea92368d>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at Galaxy.Api.GalaxyInstance..cctor () [0x00000] in <22373852dcce42128dc7e065ea92368d>:0
--- End of inner exception stack trace ---
at StardewValley.SDKs.GalaxyHelper.Initialize () [0x00000] in <1ed49e648be548bcae8e4508597c9f4c>:0
```
I am **astonished** that this one isn't a fatal error - but the game runs fine
even though it can't find an external library. Ridiculous.
Galaxy is GOG's multiplayer gubbins. If you've got a Steam game, it's different,
I'm sure, but the functionality this stuff is *for* is to negotiate multiplayer
games with strangers.
I have no use for this myself, but `libGalaxyCSharpGlue.so` is looked up via
another dllmap in `GalaxyCSharp.dll.config` - it's not packaged by Debian, and
it may even be proprietary GOG code, but if we can get an aarch64 version of it,
making it work should be as simple as adding an entry there.
If this did become a fatal error at some point, the minimum work would be a stub
implementation that meets the ABI but always says "no games available" or some
such.
And... that's all the errors. Despite a different architecture, despite being
short some libraries, and despite running reverse-engineered (Panfrost) graphics
drivers with only a bare whisper of OpenGL support, my favourite game is running
at normal speed on an architecture its authors and publishers didn't even think
about.
Again I say: ridiculous
...maybe I should learn some CSharp?