Warner Bros Piracy Prevention Fail

A colleague recently met up with a group of friends to go see the new Superman movie “Man of Steel”. After arriving at the cinema about half of the group decided to rather not see the movie after all. Why ? Because they were greeted by the following sign:

Information at the cinema entrance

Information at the cinema entrance

The text reads:

Dear cinema visitors,

we hereby inform you that as of now, according to the explicit wish of Waner Bros. Entertainment UK, we will have security personel monitoring all screenings of  Man of Steel using night vision devices. This applies until the 22nd of June. We apologize for any convenience

The remaining ones who decided to still watch the movie (because they drove the furthest to the cinema where they met) were greeted with lots of ‘piracy is crime’ posters inside the cinema and had  their bags searched for recording equipment. During the movie there noticeable watermarking effects which didn’t help to improve the whole experience either. Once again the paying customers are the fools in this scenario. And do you think it helped ? Don’t answer just yet. Head over to some random torrent page and search for ‘Man of Steel’. Convinced now ?

Now I was actually considering to see this movie but if they pull off equal stunts at my local cinema I sure as hell won’t. I will call my local cinema tomorrow to find out. What about the cinemas at YOUR place ? Has anyone else made similar experiences ?

watashi wa super famicom

Introduction

The other day someone on my twitter stream mentioned that he wanted to try some SNES programming. Since the SNES is still my all time favorite video game system I’m always happy to see people working on it. Ideally with the result of them releasing something for it. Be it some demo scene production or a little game. I quickly compiled a little email with some information on how to get started. When some others mentioned interest as well I decided to put together a little blog entry for it.

History

The Super Famicom was first released in Japan in 1990. Releases in North America and Europe followed in 1991 and 1992 as Super NES and Super Nintendo respectively. Now if that makes you feel old that’s completely normal. The System was launched with “Super Mario World” as pack-in game and unless you’ve been hiding under a rock for a rather long time you probably know many of the gems released for it in the course of the years:

  • Street Fighter 2
  • F-Zero
  • Zelda: A Link To The Past
  • Super Metroid
  • Final Fantasy Series
  • Starfox
  • etc etc etc …

According to Wikipedia the last official game released for the Super Famicom in Japan was ‘Metal Slader Glory: Director’s Cut’. Sure enough there were many unofficial releases after that. Don’t hold your breath though because those are mostly really crappy NES game conversions or just slight modifications of existing games.

I am sure you are very capable of looking things up on wikipedia yourself but let me just mention a few random tidbits that come to my mind on the SNES in no special order:

  • The SNES was rival to SEGA’s Genesis which was released just two years prior in 1988. While Genesis games never looked quite as colorful and mostly didn’t sound as good as many SNES games did I am certain about one thing: Genesis developers must have led a much happier life than their SNES targeting counterparts. Why? Because while SEGA decided to go for the Motorola 68k Nintendo chose the Ricoh 5A22 …

  • Like Microsoft in 2013 Nintendo wasn’t to keen on the idea of people being able to freely play games from region A in region B. Apart from shaping the cartridges differently they also added regional lockout chips to the game system unit and the cartridges which would only allow for matching region pairs of system and game to work. It took until 2010 for this custom chip to be fully reversed (http://sd2snes.de/blog/cool-stuff/supercic).

  • The SNES was designed in a way that would allow for interfacing with special chips embedded on cartridges. The most popular is the SuperFX chip used in games like the Starfox and Stunt FX Racing. The Super FX is a custom RISC processor with simple polygon drawing features. Other enhancement chips were developed as well. Apart from custom decompression of graphics data the features provided were mostly various 2D graphical transformations. Results would be rendered directly to the SNES VRAM via DMA.

  • Homebrew development was sparked by the release of backup stations in Hong Kong and mainland china. These units would plug in your SNES like a normal cartridge. On top there is another cartridge slot and a 3.5″ floppy drive. Of course those units were exclusively purchased with the intention of creating original software for it… The console warez scene that emerged in the 90s relied heavily on it and the units got more sophisticated adding features like parallel port interfacing, real time saving, support for cheat codes and so forth. Manufacturers worth mentioning in this context are Bung (which went on to produce similar devices for other systems including the Gameboy Color, Nintendo 64 and others but was later forced to cease production of copying devices after a jointly filed suit by Nintendo, Sony and Microsoft in 2002 against the then famous Lik-Sang reseller.) and Front Far East (FFE). Among the most popular devices were the Super Wildcard produced by FFE and the Gamedoctor by Bung.

Hardware

I will provide you with plenty of links to documentation that contain tons of detailed information on all that matters and more but let me nonetheless provide some basic information right now to give you an idea what you are dealing with:

CPU

How should I put this nicely … well I think I cannot. The SNES CPU is a bloody punch in the face. Ever wondered why the SNES never had a game that was even remotely similar to the super fast Sonic titles on the Genesis ? Meet Ricoh 5A22, 3.55 Mhz of 65c816 awesomeness. It is so awesome you cannot even reliably disassemble any SNES code because the bit width of arguments may depend on the setting of a cpu status register. Thus you cannot be sure if you are looking at ‘LDA #12’ or ‘LDA #1234’. The opcode for LDA remains the same. (To add insult to injury it should be noted that the initial plan was to use a 10Mhz 68k CPU. This was discarded because of (a) economical reasons, the system just got too expensive and (b) because Nintendo wanted to provide backwards compatibility with the NES. We all know how splendidly that worked out).

Very roughly put you get a spiced up 6502 CPU with …

  • a 24bit address bus and 8bit data bus
  • 16bit accumulator and index registers (X and Y) all of which can be toggled between 8 and 16 bit modes
  • A zero page which is now called direct page that can be placed within the first 64K of RAM
  • 128KB of DRAM which is mapped all over the place in address space
  • 64KB of VRAM (512 + 32bytes sprite RAM + 256 x 15bits palette RAM)
  • 64KB audio RAM
  • Various DMA and HDMA modes with 8 distinct channels. HDMA can be used to achieve interesting effects
  • by changing display data during the horizontal blanking period
  • Hardware Division and Multiplication

You also get a whole lot of addressing modes. Those range from the obvious candidates like immediate (lda #ff) or absolute (lda $00ff) to the new absolute long indexed (lda $80ff00, x) or the stack relative indirect indexed (lda (1,s),y). Unless you plan to use the stack for passing arguments to subroutines you probably won’t be needing the latter though.

Graphics

  • Like most other systems of its era the SNES uses tile based graphics which was most useful for the majority of games developed in the 16bit era.
  • Up to 4 background layers depending on the chosen video mode (mode0 to mode7)
  • Special mode with rotation and scaling using matrix transformations in Mode 7
  • Hardware Mosaic Effect (omg please don’t use it)
  • Color Addition/Subtraction
  • Window Clipping
  • Hardware Scrolling
  • Progressive Scan Resolutions: 256×224, 512×224, 256×239, 512×239
  • Interlaced Resolutions: 512×448, 512×478
  • Hardware sprite support for 8×8, 16×16, 32×32 or 64×64 sprites
  • 128 sprites in total, 32 sprites per line max

Typically you will prepare video data in memory to be transfered to VRAM via DMA. All VRAM is accessed via CPU Registers. You can set the destination address and how the designated address should be increased at each step. This is useful if you don’t want to change continuous regions in video memory but only stripes. DMA allows for transfers from either RAM or ROM to VRAM. As usual data needs to be transfered during vblank or forced blank. You can use the horizontal blanking period to achieve nice effects by changing scroll values, colors, fiddle with OAM (object attribute memory) to get implement multiplexing etc. I’ve also seen mid-frame video mode changes in order to achieve mode7 3d transformations on top and multi-layer graphics in a different mode on the bottom of the screen. For a lot of this you can use HDMA which reads data from a predefined table and transfers it to consecutive horizontal blanking periods of specified lines (You can also specify gaps).

You can use the nmi (non-maskable interrupt) to trigger a routine at the start of the vblank and you can also trigger interrupts at the start of a given scanline.

Audio

  • Sony SPC700
  • 16bit ADPCM with 8 channels
  • 32khz 16bit stereo
  • ADSR evenlope control
  • frequency scaling and modulation using Gaussian interpolation Echo noise generation

Quite honestly I don’t have anything to add to this because I’ve never concerned myself with audio programming at all. Luckily there some useful converters and player libraries to convert/play .xm/.mod files that work just fine.

Development Tools

Moving on we get to the practical part of this: The tools that you will be using.

Compiler/Assembler

I take it as given that you want to program in assembler. First and foremost because it’s fun but also because the 658c16 sucks for C and the only working compiler solution that I know of (https://code.google.com/p/snes-sdk/) is not maintained anyomre either. If you still want to have a look at the C approach here is another link for you though: http://www.portabledev.com/wiki/doku.php?id=start – A C library and some examples to get you started.

But as I said I suggest you take the red pill and climb down the rabbit hole which in this case leads to : ca65. If you’ve done 65xx programming on other platforms you might have used it before. It’s a bit verbose and not as straight forward as other assemblers that are targeted at snes but it’s the assembler I like best.

If you want to get started you can check out my sfckit repository on github: https://github.com/gilligan/snesdev It contains various examples and some routines to get you started. Be careful though: I haven’t touched it in quite a while and i’m sure there are bugs and/or messy pieces of code all over. It should certainly be helpful as a starting point though. Setting up ca65 configuration/link scripts is not exactly the most entertaining thing I can think of. Thus feel free to rip anything you find useful from my repository.

Get the assembler(/compiler) here: http://www.cc65.org/

Emulators

In order to quickly test code while you are developing you’ll want to use an emulator. There are different valid options for this but also at least one emulator you should stay the hell away from: SNES9X: Your code may run just fine on snes9x and everything looks dandy until you try it on the real hardware and everything just explodes right into your face: glitch-o-rama. It just isn’t accurate enough at all. So stay away. Valid options for testing your code are:

  • bsnes (now called higan) : This is the most accurate snes emulator there is. It might in fact be one of the most accurate emulators for any platform. Recently it mutated into a multi-arch emulator. Personally I am not to terribly keen on that so I stick to some older version which is snes only. Traditionally it has also always been a bit of a pain in the arse to get bsnes to compile because the author is rather keen on using recent C++11 features and the code sometimes just wouldn’t compile on OSX. I am also disappointed by the fact that the debugger was dropped at some point in the past.
  • ssnes (now called retroArch): This project started out as a frontend to the bsnes emulation core but has also evolved into a more elaborate multi-platform solution. Again i’m not too terribly fond of that but I keep an older version around which I adjusted to my needs (I’m listening to SIGUSR in the main loop to allow for quick ROM reloads without restarting the emulator. If anyone is interested in this let me know).
  • no$sns: Finally there is the most recent snes emulator from the author of the awesome no$gmb Gameboy emulator. Like his other emulators it features a great debugging environment. It also has built-in features like a stdout which you can use by writing to a custom register in your snes code to get debugging output. The downside is that the author is really keen on writing all his emulators in win32asm. Luckily for me it works just fine under wine on my macbook so that’s how I use it.

(You can find links to the emulators at the end.)

Hardware

Emulators are a must-have for fast testing-cycles and debugging but you should also always check your code on the real hardware to make sure its actually working. There are a couple of options to choose from:

  1. You could look for an old backup device like the Super Wildcard DX2 or the GDSF7. These work just fine and when sending code via the parallel port you can even get fast test-cycles. The only problem is finding a computer with a parallel port. Do you have one ? Let me check the back of my Macbook Pro .. hm, nope. I also doubt that there are any USB-Parallel-Port dongles that would work. If there are I would love to know that though :) You might find one here: http://www.tototek.com/store/index.php?main_page=index&cPath=1_8_11
  2. My personal favorite is the quickdev16: https://www.assembla.com/spaces/quickdev16/wiki – The only problem is that I doubt you can still purchase one. If I remember correctly all info for building one yourself is available though.
  3. There are several other flash cart solutions that you can get. These work fine but unlike the quickdev16 they are made for gamers not developers. Copying a ROM file to an SD-card and then putting that back into your flashcart isn’t exactly ideal. You can find some shop links at the end of this article.

Documentation

If you have made it to here chances are you are still interested in SNES development. Luckily there is lot of reading material so let’s get started!

LINKS

I hope this little article was helpful to someone or at least managed to wet your appetite a bit for looking further into this nice retro system. Feel free to give feedback/corrections!

In case you were hoping to see actual code or a rundown of some hello world program – Sorry. Took me long enough to just write this silly intro. Feel free to have a look at http://bit.ly/18erbNt and see if you get it to compile. I hope it isn’t all completely broken :-)

A glimpse into the world of the deported

Last saturday was supposed to mark the start of my trip to Izmir/Turkey. My wife and my 1 year old son have been there for a week already and I was looking forward to joining them at the house of my wife’s grandparents. At least that’s what I thought …

After a slightly delayed 3h flight I arrived in Izmir and hurried to the pass control. Impatiently I stood there watching people in front me getting there papers and id cards checked. The whole
mess started when it was my turn. The man in the little glass box office was about to hand me back my id card along with some silly tourist post card when he suddenly realized that something was wrong with my id card: It had expired a year ago. I was baffled. How could this be and why didn’t they say anything on my way out of Switzerland. They must have overlooked it. Not to mention of course that I had been an idiot for not looking at it myself in time …

Things started to go on a much faster pace than my Turkish speaking abilities would allow me to follow so I was happy to eventually get my wife on the phone. I was allowed to see her for short 5 minutes after which we were told she had to leave. I was led to a holding facility for people that are to deported. Before that I had to sign some papers which were pretty much exclusively in Turkish. Someone with bad English vaguely told me what i was about but i absolutely can’t remember now.

In the following hours I wasn’t quite sure what and especially when anything is going to happen. Initially they had told me that there would be a flight back to Switzerland right away but apparently that was booked out. I still hadn’t completely given up hope that there might be a way that I could perhaps stay in Turkey. Since it was a saturday I couldn’t call the German consulate. (I just checked the website. There is a phone number for emergencies, which however will not provide any information on passport/visa matters. Not very helpful then is it?)

My feelings at this point where mixed and largely depended on the way the security staff was treating me there. Fortunately however they were mostly very friendly. I got something to eat and drink. At some point one of the guys brought me some tea and we sat together and tried to chat a bit. Things could have been worse (and for some they were, I will get to that shortly).

So far so good. The fact remained that i’m in a holding facility while my wife and kid are at my grandparents 5km down the road. After some hours had gone by I began to understand the role
of the security officers. They were not exactly security personnel per se they were what I would call appeasement officers:

‘No, no its alright. here have something to drink. Things will be okay.’

This of course only works well until the detained become aware of this. Muhammad had long reached that point. Muhammad is a 28 year old afghan currently living in Sweden. He managed to leave Afghanistan about 6 years ago. Other close relatives including a son (if I understood correctly) have been living in Teheran since. Muhammad somehow managed to collect the money for a flight to visit them. Just like me however he didn’t reach his destination:

Izmir was one stop on his journey from Gothenburg/Sweden to Teheran/Iran via Athens/Greece and Izmir/Turkey. He was stopped there because he didn’t have the necessary papers that would allow him to travel on. Why he wasn’t stopped earlier on is beyond me.

Fact is he was now stranded in Izmir. At the point I met him he had been there for 5 days. The appeasement effect was clearly wearing off. He had already cut his wrist hoping that this would somehow change his fate. It was to no avail.

Muhammad has been through a lot. Life in Afganistan sure must have been hard. His father like many others was shot there and he hasn’t seen the rest of his family for 6 years. He managed to make a short phone call telling them that they should not wait at the airport since he won’t be able to make it there. Everyone was crying and he had to end the phone call.

Talking to Muhammad is not so easy because his English isn’t that good and I obviously don’t speak Farsi. One of the security guys spoke a bit of Farsi though. He kept on telling him that he will make it to Teheran somehow eventually while in fact the airline was preparing to have him sent to Cologne/Germany. Muhammad kept on saying that he doesn’t know anyone in Germany and that he doesn’t have any cash at all that would enable him to fly to anywhere. Despite repeated pleas by him nobody from the airline he bought the ticket from ever came to talk to him.

Security talking to Muhammad

Later on some airport staff members arrived and told him that he has only 2 options: Either he flies to Cologne/Germany or Athens/Greece. In either case he needs to take care of getting a ticket to anywhere on his own.

He refused to fly to Cologne. I can’t tell what happened after that because I was ‘offered’ a seat to Cologne which I accepted. Cologne is a 7h train ride away from home but i’d rather sit in a train for 7 hours then being locked up in the airport. Also if I had neglected to fly to Cologne i might have had to wait 2 full days for another flight.

Fast forward to today, Tuesday. Yesterday I got myself a preliminary id card and bought a new ticket to Izmir. The whole journey was quite exhausting. I was on the road for about 30h. Yet here I am sitting on my couch typing this into my macbook and listening to music. The whole experience was very annoying and bothersome and at times also worrying. But that is all. If I was to really empty my bank account I could fly around between Turkey and Germany a dozen times. Same goes for a large number of people reading this now.

For the limited time that I sat in the holding facility with Muhammad we shared something: We were both held in a place where we did not want to be, separated from our beloved. Yet there are worlds between Muhammad and me. I haven’t seen my wife and kid for a week. Muhammad still hasn’t seen his family in 6 years. Flying back and forth is an annoyance for me – For Muhammad it is a crisis. He doesn’t have any money let alone several hundred EUR to fly anywhere. On top of that he doesn’t have a travel permit. So even if he did indeed have
the money necessary i’m not sure he can get the required papers.

Before I left Muhammad at the airport I told him that I would try to help him. I got in touch with Pro Asyl (http://www.proasyl.de/) who in turned got me in touch with Multeci-Der (www.multeci.org.tr). I was in touch with them again a few hours ago and found out that Muhammad is in fact still at the airport. They are waiting for a translator to arrive and will then hopefully go to the airport to talk to him as soon as possible. Anything beyond that remains
uncertain until all details are known. I am convinced however that in either case it will be good if there is someone who Muhammad can talk to in his native language and who is going to represent his interests.

I hope this will happen real soon. I hope that when I’m at the airport again tomorrow he won’e be locked up there anymore. Finally I hope that I will remember this for a good while and waste less time being angry about idiotic first world problems.

Polaroid GL10 – failure & review

Prologue

Some weeks ago I was looking for a present for my wife’s present. At first I considered getting her a polaroid camera but after giving it some thought (the only source for polaroid films is through http://the-impossible-project.com/ and that’s quite pricey) I decided to go for a modern alternative – a zero ink printer …

(Note that this review doesn’t go into the technical details you may or may not be looking for. It’s written from a plain usage perspective)

Polaroid GL10: Unboxing

So instead of grabbing some used polaroid camera from ebay I decided to get the polaroid GL10. For 130EUR you get mobile printer which prints to 7.6 x 10.2 cm (3×4 inch) via USB or Bluetooth. If your camera supports PictBridge you can connect it directly to your camera. Unpacking the box you get …

  • The printer itself
  • power supply
  • zero ink paper package (10pcs)
  • battery
  • instruction leaflet (i refuse to call it a manual)

The first thing I was looking for was a CD with software/drivers. Checking the leaflet it turns out that I am supposed to go to polaroid.com to download the software there. I have to admit I hate that. Its not like I don’t have a 16mbit internet flatrate but when I spend 130EUR i just expect to have at hand to get started. The same applies for a mini-usb cable required to hook up the printer to a Mac or PC – not included. After going through some boxes of gadgets, dongles and cables I found the right USB cable and it was time to hook up the printer to my macbook and check it out..

Polaroid GL10: Software

After visiting the polaroid website it dawned on me that there are no drivers which leaves you with no other choice but using the Polaroid GL10 App for everything..

Now this is were things really start to fall apart. I don’t even know where I should begin. Lets just assume I want to print a couple of pictures of my newborn son: For that I have to use the “Add Images” button. So I pick some cute smiling picture. When I try to “add” more pictures after that it turns out the app discards whatever I had selected previously. Annoying.

Now lets print some picture. I add some file to the app library and click it:

The app displays the picture in some white frame. It doesn’t quite fit. There is no way to auto-zoom the picture. There is no way to auto-center the picture. There is nothing like a sticky grid to position the picture on. It all feels like walking over a frozen sea without ice skates. So there is no way to get a proper format filling print of that picture unless I just use the zoom in/out button. Not sure in what steps it zooms in or out. It doesn’t tell..

So apparently Polaroid and Lady Gaga (oh yes, I forgot to mention.. the whole product line is made in cooperation with Lady Gaga…) didn’t spend much thought on that. What they did come up with though is a selection of ‘effects’ (really just overlays) that range from silly to hideous. Below you see one of my favorites, the mindbogglingly fantastic”Heart Burst” effect. I could come up with more suitable names but I digress.

So I decide to not use any effect and print a picture. It looks okay. I’m not overwhelmed and after printing some more I find that sometimes the colors aren’t quite correct but at 130EUR I don’t expect miracles.

Polaroid GL10: Add effect to printer

After being more than underwhelmed by the application so far I start playing around and stumble over the “Add effect to printer” text on the top right. I click it and get a notification that the template has now been set on the printer. Hm. I look for a help menu. But that pops up a window with the message: “Help is not available for GL10”. Nice. It turns out that the next time I print something it will be printed with the downloaded effect applied automatically. I look everywhere for a reset feature. Power-cycling the printer doesn’t help, its probably stored on flash. I check the available effects again to see if there is a ‘default’ or ’empty’ effect. Nope. I have to create an empty/transparent png and add it to the effect library and then send that to the printer – WHAT THE **** ?

Polaroid GL10: Android App

I install the polaroid app from the android market. It comes as no surprise that the app isn’t a master piece either. I can’t remember the times it got stuck and I had to kill the app. Furthermore it doesn’t provide the ‘Add effect to printer’ feature. Imagine setting an effect on your GL10 and then selling it to someone who only wants to use it with his Android mobile. That would be… fun.

Its is worth noting however that there is one thing the Android app actually even does better than the desktop version. I uses the build in picture gallery which means I can access/browse my photos from picasa. It is annoying though that whenever I select a picture to print it downloads the image and stores it in a local collection.

Another thing that the android app does is scaling images properly. So I can actually get format filling prints without ugly white borders. Fantastic! If I want to rotate a picture i’m out of luck though. No can do. I can only rotate text that I added using the app. But at this point I had already decided that there is no way I’m keeping the GL10 anyway so I plan to use up the zero ink paper I had ordered with it and return it.

Easier said than done. Either the app crashes or the printer crashes. When the printer crashes power cycling doesn’t help. I have to reset it (Hold the ‘print-again’ button for  a few seconds). Sometimes it works right away and I get vertical stripes. And then, finally it just stops working altogether. I can pair with it but it won’t print anything. Not when connected to the Mac via USB either. But i’ve reached a point where I couldn’t care less. So I pack up and start writing this blog entry.

Polaroid GL10: Conclusions

I don’t get it. Maybe the fact that Polaroid is promoting this device with Lady Gaga should have been a clear warning signal which I foolishly chose to ignore. Who is this device for ? teenage lady gaga fans ? They can’t seriously think that anyone who is only in the least bit serious about photography would be satisfied by what they are offering. What I was looking for was a way for my wife to easily and quickly print pictures of our son. She doesn’t need the ‘Heart Burst’ or the ‘SnowFlake’ effect but it should at the very least be possible to get format filling prints without too much hassle.

PS: In case you are flabbergasted by my point of view because the GL10 and its accompanying applications work like a charm for you – be sure to let me now. But I doubt it.

Hello world!

Just set up this blog .. nothing much to see here – yet ;-)